Commit graph

151164 commits

Author SHA1 Message Date
Franco Fichtner
5dc500ba7a route: protect against unattached AF deep down #207
For pppoe/ng interfaces sometimes we enter ip6_tryforward() with
a NULL pointer array and IN6_LINKMTU() glancing over the fact
that this is not a valid destination since if_afdata structure
is not initialized.

While here remove the RT_LINK_IS_UP macro since nothing outside
of nhop is using it.

This is probably a side effect generator, but fixing one spot
instead of the general case would leave other holes in the stack.
Do not return a route destination if the address families were not
yet attached.
2025-03-03 10:35:30 +01:00
Kevin Lo
fade76e8b0 ixgbe: Fix a logic error in ixgbe_read_mailbox_vf()
Reviewed by:	kbowling
Differential Revision:	https://reviews.freebsd.org/D49156

(cherry picked from commit 5c7087c349fc1d826807aa1a11912c9e774e3321)
2025-03-03 08:07:43 +01:00
Bjoern A. Zeeb
c16466b03e iwlwifi: bring in some of the rs code
Bring in code to call into rs-fw.c functionality for firmware
supported rate select.

Anything before AX200 (firmware matching iwlwiif-[0-9]*.ucode) will
still need further implementation, and so does iwl_mvm_rs_tx_status().
These bits marked with compat.linuxkpi.80211.debug TODO()s for now.

Implement some lindebugfs bits to gather more statistical information.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 3f8cfb8a3a3b9fbe6d4aebde81aee80f8e89e2ea)
2025-03-03 08:07:01 +01:00
Kristof Provost
5be39bc21c pf: fix fragment hole count
Fragment reassembly finishes when no holes are left in the fragment
queue.  In certain overlap conditions, the hole counter was wrong
and pf(4) created an incomplete IP packet.  Before adjusting the
length, remove the overlapping fragment from the queue and insert
it again afterwards.  pf_frent_remove() and pf_frent_insert() adjust
the hole counter automatically.

bug reported and fix tested by Lucas Aubard with Johan Mazel, Gilles
Guette and Pierre Chifflier; OK claudio@

MFC after:	1 week
Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 9915416fe8
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 8b2feafb535d10a559b995c6fc2529715f927e2a)
2025-02-25 10:36:06 +01:00
Kristof Provost
ebfe6da010 pf: do not keep state when dropping overlapping IPv6 fragments
ok sperreault@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, cd45765685
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 3b79f6d2d39405bcac395dc036ceb6f8fd09ce99)
2025-02-25 10:35:03 +01:00
Kristof Provost
7386d91261 pf: drop IPv6 packets built from overlapping fragments in pf reassembly
The reassembly state will be dropped after timeout, all related
fragments are dropped until that.  This is conforming to RFC 5722.
- Sort pf_fragment fields while there.
- If the fr_queue is empty, we had overlapping fragments, don't add
  new ones.
- If we detect overlapping IPv6 fragments, flush the fr_queue and
  drop all fragments immediately.
- Rearrange debug output, to make clear what happens.
- An IPv4 fragment that is totaly overlapped does not inclease the
  bad fragment counter.
- Put an KASSERT into pf_isfull_fragment() to make sure that the
  fr_queue is never emtpy there.
discussed with Fernando Gont; ok henning@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 8b45f36762
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 6a3266f72e437aecf3edcfb8aa919466b270d548)
2025-02-25 10:34:25 +01:00
Bjoern A. Zeeb
e47898ee0f net80211/ifconfig: swap IEEE80211_FVHT_USEVHT160 and 80P80
ieee80211_setupcurchan() compares the flags in a greater than manner.
In this case VHT160 should be > VHT80P80 as it is preferable.
Swap the two flags and add a comment to note this.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D48976

(cherry picked from commit 8f2e5b6ef32304ce340b91057b1eb4b191dbeac1)
2025-02-25 10:34:06 +01:00
Zhenlei Huang
accbbd1a64 carp: Fix checking IPv4 multicast address
An IPv4 address stored in `struct in_addr` is in network byte order but
`IN_MULTICAST` wants host order.

PR:		284872
Reported by:	Steven Perreau
Reported by:	Brett Merrick <brett.merrick@itcollective.nz>
Reviewed by:	Franco Fichtner <franco@opnsense.org>, ae, kp, glebius
Tested by:	Steven Perreau
Fixes:		137818006d carp: support unicast
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D49053

(cherry picked from commit 1776633438f24df09cb9815650891bcef0152874)
2025-02-25 09:11:42 +01:00
Franco Fichtner
2640600509 pf: backport changes around the following commit #242
commit 49f39043a02d6011c1907e1b07eb034652a1269c
 Author: phessler <phessler@openbsd.org>
 Date:   Fri Apr 28 14:08:34 2023 +0000

    Relax the "pass all" rule so all forms of neighbor advertisements are allowed
    in either direction.

    This more closely matches the IPv4 ARP behaviour.

    From sashan@
    discussed with kn@ deraadt@
2025-02-24 17:14:06 +01:00
Kristof Provost
7953277963 pf: Cleanup leftover PF_ICMP_MULTI_* code that is not needed anymore.
ok henning

Obtained from:	OpenBSD, mikeb <mikeb@openbsd.org>, ecdc46e922
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-24 16:24:48 +01:00
Mark Johnston
11140653cd pf: Stop using net_epoch to synchronize access to eth rules
Commit 20c4899a8e modified pf_test_eth_rule() to not acquire the
rules read lock, so pf_commit_eth() was changed to wait until the
now-inactive rules are no longer in use before freeing them.  In
particular, it uses the net_epoch to schedule callbacks once the
inactive rules are no longer visible to packet processing threads.

However, since commit 812839e5aa, pf_test_eth_rule() acquires the
rules read lock, so this deferred action is unneeded.  This patch
reverts a portion of 20c4899a8e such that we avoid using deferred
callbacks to free inactive rules.

The main motivation is performance: epoch_drain_callbacks() is quite
slow, especially on busy systems, and its use in the DIOCXBEGIN handler
in particular causes long stalls in relayd when reloading configuration.

Reviewed by:	kp
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D48822

(cherry picked from commit 7a66b3008693ce61957e8b2a3d99829063e1e4af)
2025-02-21 17:08:44 +01:00
Gordon Tetlow
97415dba25 Add UPDATING entries and bump version
Approved by:	so
2025-02-21 17:07:19 +01:00
Doug Moore
e33a9f9b08 dev/mana: replace power2 function
Replace is_power_of_2(length) with power2(length).  When length != 0, as in
this case, they produce the same result.  This will allow an implementation
of is_power_of_two to be dropped.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D45536

(cherry picked from commit a94ed493b50752cee09245fc312c63b00331f217)
2025-02-18 11:25:12 +01:00
Bjoern A. Zeeb
59333e85a8 LinuxKPI: 802.11: adjustments for v6.11 iwlwifi, rtw88 and rtw89
Bring in the LinuxKPI 802.11 compat bits which are altering
the mac80211 KPI.

* In struct ieee80211_bss_conf chandef -> chanreq.
* Various struct ieee80211_ops gained a link_id arguemnt,
  stop gained a suspend flag.
* Various functions gained a link_id argument.
* ieee80211_tx_status() was renamed to ieee80211_tx_status_skb()

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7b43f4d064195bcf66816cb9fe350a1392fe24ce)
2025-02-18 11:13:59 +01:00
Doug Moore
0f5c5aecfe libkern: don't use MPASS
Using MPASS in libkern breaks buildworld.  Replace MPASS with KASSERT
in three places.

(cherry picked from commit 08f6f78f81e21b21dd002a9389436b0333cb3488)
2025-02-18 10:44:28 +01:00
Doug Moore
5e66087774 libkern: avoid local var in order_base_2()
order_base_2(n) is implemented with a variable, which keeps it from
being used at file scope. Implement it instead as ilog2(2*n-1), which
produces a different result when 2*n overflows, which appears unlikely
in practice.

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D46826

(cherry picked from commit b7cbf741d55468ba34305a14ac3acc1c286af034)
2025-02-18 10:44:28 +01:00
Doug Moore
c88d1ce792 log2: move log2 functions from linuxkpi to libkern
Linux has a header file that defines an ilog2 function and some simple
functions/macros that use it: roundup_pow_of_two, is_power_of_2,
rounddown_pow_of_two, and order_base_2.  This change moves three of
those simple functions (all but is_power_of_2) from linuxkpi to
libkern.  It also deletes a few implementations of these functions
that have previously been copied into code for various device drivers,
so that they can use the libkern version.  The is_power_of_2 macro was
not moved because powerof2 in param.h provides almost the same service
already (except that they disagree about whether 0 is a power of two).

Since the linux definitions of these functions were copied into
FreeBSD 11 years ago, linux has improved them, and this change
provides those improvements.  In particular, a giant table of log
values for evaluating ilog2 for constant values is no longer
necessary.

Reviewed by:	alc, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D45536

(cherry picked from commit c8b0c33b03ac072413b27bed2bdae2ae27426f3a)
2025-02-18 10:44:10 +01:00
Doug Moore
feeeb1c7a1 libkern: add ilog2 macro
The kernel source contains several definitions of an ilog2 function;
some are slower than necessary, and one of them is incorrect.
Elimininate them all and define an ilog2 macro in libkern to replace
them, in a way that is fast, correct for all argument types, and, in a
GENERIC kernel, includes a check for an invalid zero parameter.

Folks at Microsoft have verified that having a correct ilog2
definition for their MANA driver doesn't break it.

Reviewed by:	alc, markj, mhorne (older version), jhibbits (older version)
Differential Revision:	https://reviews.freebsd.org/D45170
Differential Revision:	https://reviews.freebsd.org/D45235

(cherry picked from commit b0056b31e90029553894d17c441cbb2c06d31412)
2025-02-18 10:44:00 +01:00
Aurelien Cazuc
96f5dd4578 e1000: Fix vlan PCP/DEI on lem(4)
The vlan PCP and CFI/DEI were discarded when receiving vlan tagged
packets on lem(4) interfaces with vlanhwtag.

According to the 82540 SDM[1] (pg. 24), vlan tag is in the standard
format, so there's no reason to discard PCP/DEI.

[1]: http://iommu.com/datasheets/ethernet/controllers-nics/intel/e1000/pci-pci-x-family-gbe-controllers-software-dev-manual.pdf

Sponsored by:	Stormshield (author)
Differential Revision:	https://reviews.freebsd.org/D48987

(cherry picked from commit 4b29599fbbe33b75b7b58cfc5deea7a881e9a10e)
2025-02-18 10:05:11 +01:00
Kevin Bowling
2ff3730ec9 igc: Remove unused register IGC_RXD_SPC_VLAN_MASK
We don't use legacy receive descriptors and masking out the vlan ID
isn't necessary since the tag is in the standard format, so remove it.

(cherry picked from commit 124b7722aad7d4cf12d96c030659aef78175aa9c)
2025-02-18 10:04:20 +01:00
Zhenlei Huang
a9d080a15a ifnet: Detach BPF descriptors on interface vmove event
When an interface is moving to/from a vnet jail, it may still have BPF
descriptors attached. The userland (e.g. tcpdump) does not get noticed
that the interface is departing and still opens BPF descriptors thus
may result in leaking sensitive traffic (e.g. an interface is moved
back to parent jail but a user is still sniffing traffic over it in
the child jail).

Detach BPF descriptors so that the userland will be signaled.

Reviewed by:	ae
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45727

(cherry picked from commit 1ed9b381d4701fc9f66741256e93b96e22273217)

ifnet: Fix build without BPF

The newly introduced function bpf_ifdetach() is only available when
device bpf is enabled.

Fixes:	1ed9b381d470 ifnet: Detach BPF descriptors on interface vmove event
(cherry picked from commit d8413a1c3ba235a79ae6b8cc35767a861855c7e2)
2025-02-18 10:03:32 +01:00
Zhenlei Huang
3de3dbaffc ifnet: Make if_detach_internal() and if_vmove() void
if_detach_internal() never fail since change [1]. As a consequence,
also does its caller if_vmove(). While here, remove a stall comment.

No functional change intended.

This reverts commit c7bab2a7ca.

[1] a779388f8b if: Protect V_ifnet in vnet_if_return()

Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D48820

(cherry picked from commit bb0348a17974d83671becbd32ea0e4bd2ea61906)
2025-02-18 10:03:23 +01:00
Andrey V. Elsukov
b62f195b06 ipfw: add missing initializer for 'limit' table value
PR:		284691

(cherry picked from commit 95ab7b3223c08cf48ccf764815523ea995a7ea0e)
2025-02-18 10:02:34 +01:00
Kristof Provost
de69fe0121 pf: add extra SCTP multihoming probe points
Add probe points in the SCTP multihome parsing code. This is intended to help
debug a multihome issue, and is expected to be generally useful, so will be
included for everyone.

MFC after:	2 weeks
Sponsored by:	Orange Business Services

(cherry picked from commit 2d2481c35f5a53322e982e47a2bb8f9085f525b7)
2025-02-18 10:02:11 +01:00
Kristof Provost
efd622d007 pf: verify SCTP v_tag before updating connection state
Make it harder to manipulate the firewall state by verifying the v tag before we
update states.

MFC after:	2 weeks
Sponsored by:	Orange Business Services

(cherry picked from commit 4713d2fd5663eb64aa582dabced21d253c901a66)
2025-02-18 10:01:36 +01:00
Kristof Provost
0f09722c20 pf: verify that ABORT chunks are not mixed with DATA chunks
RFC4960 3.3.7: DATA chunks MUST NOT be bundled with ABORT.

MFC after:	2 weeks
Sponsored by:	Orange Business Services

(cherry picked from commit 541ea3d7828e0ede161ac2d8ef3e8419657ef5cb)
2025-02-18 10:01:35 +01:00
Kristof Provost
5658e37b53 pf: allow ICMP messages related to an SCTP state to pass
Much like we already do for TCP and UDP we should also parse SCTP-in-ICMP
messages to see if they apply to an SCTP connection we've already allowed. If so
we should allow the ICMP packet to pass, even if we'd otherwise block it.

Add a test case where we generate an 'ICMP unreachable - need to frag' packet
and check that it passes through pf.

MFC after:	2 weeks
Sponsored by:	Orange Business Services

(cherry picked from commit 7d5e02b01577047290e937399accc02e6b184ce9)
2025-02-18 10:00:47 +01:00
Kevin Bowling
6e76039a9b net: if_media for 100BASE-BX
d82c3e81:
net: if_media for 100BASE-BX

Renumber 1000BASE-BX and add 100BASE-BX sequentially

I added this 1000BASE-BX in 78c63ed260fa20b3500aedfe41dc0dcae9593f51 but
did not connect it to any code yet, appologize for the churn.

7835a4ad:
net: if_media fix syntax/build

Fixes:		d82c3e815a5f ("net: if_media for 100BASE-BX")

(cherry picked from commit d82c3e815a5fc0069562b69145ad695f9aa183f9)
(cherry picked from commit 7835a4ad6948290c92ea55c7be34ae72f4e2b0bd)
2025-02-18 09:59:10 +01:00
Bjoern A. Zeeb
f0a184b0bb rtw88/rtw89: avoid duplicate top-level directory with debugfs
If people like me having multiple cards in the same system
creating the debugfs dirctory leads to a panic upon attaching
the 2nd card due to the duplicate name.
Rather than using the hard coded driver name, use the device name
(e.g., rtw880, rtw881, rtw882).
This solves two issues: it avoids the duplicate name and we get
individual debugging/statistic information for each card.

Sponsored by:	The FreeBSD Foundation
X-Note:		ath1[01]k and mt76 likely will need a similar change

(cherry picked from commit b4886c4ece3e692c294aa853da7aec849f8d00a2)
2025-02-18 09:58:37 +01:00
Bjoern A. Zeeb
c8d1d54f5b rtw88/rtw89: add module_param to enable/disable HT/VHT and EHT
In order to better test HT and VHT support with LinuxKPI add (tunable)
options disabled by default to on-demand enable HT/VHT
and for rtw89 also EHT.

It is expected that we will remove this FreeBSD-specific code again in
the future.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7a5b55e3b448744b099c274763992cba2e3ebce5)
2025-02-18 09:58:23 +01:00
Bjoern A. Zeeb
43d7574526 rtw89: update Realtek's rtw89 driver.
This adds support for the Realtek 8922AE PCI
wireless network (Wi-Fi 7) adapter.

This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
98f7e32f20d28ec452afb208f9cffc08448a2652 ( tag: v6.11 ).

Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 6d67aabd63555ab62a2f2b7f52a75ef100a2fe75)
2025-02-18 09:57:36 +01:00
Bjoern A. Zeeb
c296eeb417 rtw88: update Realtek's rtw88 driver.
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
98f7e32f20d28ec452afb208f9cffc08448a2652 ( tag: v6.11 ).

Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 11c53278a8a3e86e14377f09bbaa7bad193d3713)
2025-02-18 09:57:19 +01:00
Kristof Provost
f15f44029f pf: add 'allow-related' to always allow SCTP multihome extra connections
Allow users to choose to allow permitted SCTP connections to set up additional
multihomed connections regardless of the ruleset. That is, allow an already
established connection to set up flows that would otherwise be disallowed.

In case of if-bound connections we initially set the extra associations to
be floating, because we don't know what path they'll be taking when they're
created. Once we see the first traffic we can bind them.

MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D48453

(cherry picked from commit e4f2733df8c9d2fd0c5e8fdc8bec002bf39811f3)
2025-02-18 09:56:41 +01:00
Bjoern A. Zeeb
80d698bf23 LinuxKPI: 802.11: turn on debugfs for iwlwifi and rtw88
Make iwlwifi compile with debugfs after the last updates and turn it on
for both iwlwifi and rtw88 in order to be able to get at least some
useful information on driver/firwmare state.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 07f6575585bf69ae48dffe87c4578057ae4782d8)
2025-02-18 09:55:07 +01:00
Bjoern A. Zeeb
f5d9aedb9e net80211: 11ac: add options to manage VHT STBC
Add IEEE80211_FVHT_STBC_(TX|RX) flags to allow userspace to manage
if STBC will be allowed for VHT RX/TX.
For RX this will only allow us to turn it off but no fine grained
control of the number of supported spatial streams.

Introduce IEEE80211_FVHT_CHANWIDTH_MASK as a helper to make the
spelling out of the IEEE80211_FVHT_MASK more readable.

Update ifconfig to allow setting of these flags.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D47838

(cherry picked from commit 243f6925bf818a64f3c996c6a89fec6c8a6ff058)
2025-02-18 09:54:48 +01:00
Bjoern A. Zeeb
d1342545fa iwlwifi: avoid (hard) hang on loading module
For certain users or chipsets (reports were for CNVi devices but
we are not sure if this is limited or specific to them) loading
if_iwlwifi hangs.

The reason for this is that a SYSINIT (module_load_order()) has not
yet run in this case and the Linux driver tries to load the
chipsets-specific module.  On FreeBSD all supported sub-modules are
part of if_iwlwifi so we do not have to load them separately but
calling into kern_kldload via LinuxKPI request_module while loading
the module gives us a hard hang.

iwlwifi calls request_module_nowait() so we can simply skip over this
and continue and the SYSINIT will do the job later if no other
dependencies fail.

Sponsored by:	The FreeBSD Foundation
PR:		282789
Tested by:	Ruslan Makhmatkhanov, Pete Wright
Differential Revision: https://reviews.freebsd.org/D47994

(cherry picked from commit 87e140a5c6f89eea7ea6320d1ae34566492abfc0)
(cherry picked from commit 5d09d1070737c43738e433b547af1a90c0f10bf1)
2025-02-18 09:52:53 +01:00
Bjoern A. Zeeb
238bd5e0a8 iwlwifi: update Intel's iwlwifi/mvm driver.
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
98f7e32f20d28ec452afb208f9cffc08448a2652 ( tag: v6.11 ).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a4128aad8503277614f2d214011ef60a19447b83)
2025-02-18 09:52:29 +01:00
Zhenlei Huang
067b29595a bpf: Fix potential race conditions
There're two possible race conditions,

1. Concurrent bpfattach() and bpf_setif(), i.e., BIOCSETIF ioctl,
2. Concurrent bpfdetach() and bpf_setif().

For the first case, userland may see BPF interface attached but it has
not been in the attached interfaces list `bpf_iflist` yet. Well it
will eventually be so this case does not matter.

For the second one, bpf_setif() may reference `dead_bpf_if` and the
kernel will panic (spotted by change [1], without the change we will
end up silently corrupted memory).

A simple fix could be that, we add additional check for `dead_bpf_if`
in the function `bpf_setif()`. But that requires to extend protection
of global lock (BPF_LOCK), i.e., BPF_LOCK should also protect the
assignment of `ifp->if_bpf`. That simple fix works but is apparently
not a good design. Since the attached interfaces list `bpf_iflist` is
the single source of truth, we look through it rather than check
against the interface's side, aka `ifp->if_bpf`.

This change has performance regression, that the cost of BPF interface
attach operation (BIOCSETIF ioctl) goes back from O(1) to O(N) (where
N is the number of BPF interfaces). Well we normally have sane amounts
of interfaces, an O(N) should be affordable.

[1] 7a974a649848 bpf: Make dead_bpf_if const

Fixes:		16d878cc99 Fix the following bpf(4) race condition ...
MFC after:	4 days
Differential Revision:	https://reviews.freebsd.org/D45725

(cherry picked from commit 7def047a1ae93b3b10bd57ed1bd28e861f94b596)
2025-02-18 09:51:04 +01:00
Kevin Bowling
2eba2832e9 ixgbe: Add ixgbe_dev_from_hw() back
This got lost many years ago in 8eb6488ebb

It is used by the driver's DBG printfs.

(cherry picked from commit bf6f0db8a762966b08430692c92ae34e667948db)
2025-02-18 09:50:11 +01:00
Kristof Provost
1a58aadf5d if_ovpn: fix module load in NOINET6 kernels
PR:		284459
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-18 09:49:56 +01:00
Kristof Provost
cc316253c6 pf: send ICMP destination unreachable fragmentation needed when appropriate
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D48805
Targeted-backport-for-stable/14-by: franco@opnsense.org
2025-02-05 11:21:18 +01:00
Kristof Provost
eb2415e79d pfil: set PFIL_FWD for IPv4 forwarding
Just like we already do for IPv6 set the PFIL_FWD flag when we're forwarding
IPv4 traffic. This allows firewalls to make more precise decisions.

Reviewed by:	glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D48824
2025-02-05 11:21:18 +01:00
Zhenlei Huang
65e2d9d506 if_vxlan(4): Use static initializers
MFC after:	1 week

(cherry picked from commit 5e0dbbc238e2e935c68e293314a90f2ce6e6ef16)
2025-02-05 10:09:30 +01:00
Zhenlei Huang
a00bfe0fa7 vnet: Fix style nits
MFC after:	3 days

(cherry picked from commit 903c7cdac5b5b4b720aba7a48abffb48b2588c77)
2025-02-05 10:09:09 +01:00
Zhenlei Huang
3ff2763a72 if_vxlan(4): Prefer SYSCTL_INT over TUNABLE_INT
This driver does not need to retrieve those tunable during early boot.
Meanwhile SYSCTL_INT can provide rich info such as description.
Also `sysctl net.link.vxlan.[legacy_port|reuse_port]` can report the
current settings.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48621

(cherry picked from commit 92632371b360010709fad60146f1aee0b8b99776)
2025-02-05 10:08:57 +01:00
Mark Johnston
1a2a481caf pf: Force logging if pf_create_state() fails
Currently packets are logged before pf_create_state() is called, so we
might log a packet as passed that is subsequently dropped due to state
creation failure.  In particular, the drop is not logged, which is
wrong.

Improve the situation a bit: force logging if state creation fails.
This isn't totally right as we'll end up logging the packet twice in
this case, but it's better than not logging the drop at all.

Add a regression test.

Discussed with:	kp, ks
Co-authored-by:	Franco Fichtner <franco@opnsense.org>
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	OPNsense
Differential Revision:	https://reviews.freebsd.org/D47953

(cherry picked from commit 886396f1b1a727c642071965612e2c2c9dd11d6c)
2025-02-05 10:08:37 +01:00
Mark Johnston
7c445da3ba Add UPDATING entries and bump version
Approved by:	so
2025-01-30 07:25:28 +01:00
Rick Macklem
e4ac2362cc tarfs: Fix the size of struct tarfs_fid and add a static assert
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packs the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reviewed by:	markj
MFC after:	2 weeks

(cherry picked from commit 4db1b113b15158c7d134df83e7a7201cf46d459b)
(cherry picked from commit 155987e201)
2025-01-30 07:25:25 +01:00
Rick Macklem
9192b514fa ext2fs: Fix the size of struct ufid and add a static assert
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packed the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reviewed by:	markj
MFC after:	2 weeks

(cherry picked from commit bfc8e3308bee23d0f7836d57f32ed8d47da02627)
(cherry picked from commit 7a3a0402ae)
2025-01-30 07:25:24 +01:00
Mark Johnston
519748f4ab cd9660: Make sure that struct ifid fits in generic filehandle structure
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packs the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reported by:	Kevin Miller <mas@0x194.net>
Reviewed by:	olce, imp, kib, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47879

(cherry picked from commit 205659c43d87bd42c4a0819fde8f81e8ebba068e)
(cherry picked from commit 54974e731f)
2025-01-30 07:25:22 +01:00