Commit graph

152259 commits

Author SHA1 Message Date
Bjoern A. Zeeb
857d924cd9 LinuxKPI: 802.11: stop queues during key updates
When beginning key updates do stop and afterwards re-enable the tx queues
to avoid packets being passed to the driver.  This is a theoretical
problem at this point but helps some cases.  These functions will likely
need refinement in the future.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit db480c29879cac1afba1d887d7b8871aa4eef6db)
2025-07-16 08:49:06 +02:00
Bjoern A. Zeeb
59ea420e71 LinuxKPI: dummy: add more dummy hreader files
These are needed for mt76.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit e8e2ed66f0978c439c7e93ff3d30a86ffad5bf56)
2025-07-16 08:48:15 +02:00
Bjoern A. Zeeb
45d0a75002 LinuxKPI: pci: fix two errors in lkpi_pci_get_device()
On any result we need to acquire a reference. pci_dev_get() deals with
a NULL argument so we can simply pass what we "found" at the end.
This will avoid reference count problems.

If the iteration on the linux list in lkpi_pci_get_device() does
not find a match pdev will still be defined at the end of the
loop but not pointing to a valid pdev.
Store the found entry in a 2nd variable which otherwise will be NULL.
This will avoid random panics, usually in sysfs_remove_dir() when
the reference gets released.

Found during mt76 bringup.

Sponsored by:	The FreeBSD Foundation
Fixes:		8f61992d7c
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D50153

(cherry picked from commit 2c65f965146a7f822302715a439e17996d17453c)
2025-07-16 08:46:44 +02:00
Bjoern A. Zeeb
098d70f5ab LinuxKPI: pci: deal with kobject_add() being able to fail
lkpifill_pci_dev() uses a sequene of kobject_init/set_name/add.
The problem is that kobject_add could fail.

Move the entire logic to the beginning of the function,
switch to kobject_init_and_add() and check the return code.
Make lkpifill_pci_dev() return the error and deal in the callers
with a possible error accordingly.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D50154

(cherry picked from commit 96e86aa6faa6fde4ff75fd757db55afe9e4be132)
2025-07-16 08:46:32 +02:00
Bjoern A. Zeeb
25bbb6c554 LinuxKPI: style
Check results of non-bool to be != 0.

No functional changes intended.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D50158

(cherry picked from commit 76b66ac45ea804f23ffb35712b0ceaa98864c06f)
2025-07-16 08:45:48 +02:00
Bjoern A. Zeeb
55b4ef5444 LinuxKPI: skbuff: make csum_unfold return __wsum
Given the internal field now stores a __wsum csum (after we added
the type) also make sure csum_unfold() returns a __wsum.

Sponsored by:	The FreeBSD Foundation
Fixes:		59481c7db234

(cherry picked from commit 36ca21722c2700e00e41444a29aeabf246eea90d)
2025-07-16 08:45:25 +02:00
Bjoern A. Zeeb
1ca66ac330 LinuxKPI: skbuff: add dummy skb_copy_header()
There's one case which needs skb_copy_header();  add a dummy function
for now until we get to the code which uses it to test an implementation.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 84c5998ccb0b3e8a401d1f2b5a32649e88847d63)
2025-07-16 08:45:25 +02:00
Bjoern A. Zeeb
6e214c2140 LinuxKPI: add struct_group_tagged()
Restructure struct_group() into a wrapper around __struct_group().
Various callers have arguments annotated as /* no foo */ so try to
add all we can find.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D50157

(cherry picked from commit 54d0e1772fb6b83d72725764e0a5d3ead8337673)
2025-07-16 08:45:06 +02:00
Bjoern A. Zeeb
1a1a1ffd85 LinuxKPI: add ktime_get_boottime_seconds()
ktime_get_boottime_seconds() is needed by an updated iwlwifi driver.

Sposored by:	The FreeBSD Foundation
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D50005

(cherry picked from commit 93b82146c43b8ecad4fd7694ec1daf6d79cca65c)
2025-07-16 08:44:48 +02:00
Bjoern A. Zeeb
2ca8d402df LinuxKPI: add is_unicast_ether_addr()
Needed by mediatek/mt76 wireless driver.

While here adjust the way is_multicast_ether_addr() is implemented
to not look weird. [1]

Sponsored by:	The FreeBSD Foundation
Suggested by:	emaste [1]
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D50152

(cherry picked from commit a4618caa43c16e6e672c27dac1943fd833f8bd8f)
2025-07-16 08:43:58 +02:00
Bjoern A. Zeeb
ddb311ffab LinuxKPI: add _devcd_free_sgtable() to devcoredump.h
It may be that once we implement freeing of chained tables
_devcd_free_sgtable() will become our _lkpi_dev_coredumpsg_free()
but further investigations need to happen.  For now make an
updated iwlwifi driver happy which should not need more.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D50006

(cherry picked from commit 71576ed24b56143429a3b6774a7862965c2dea88)
2025-07-16 08:43:07 +02:00
Bjoern A. Zeeb
bf1e748dfd LinuxKPI: netdev features style, annotate, and add %b decoding mask
Start to sort through the netdevice features to match them with
FreeBSD.  Annotate them a bit more verbose though the names are
pretty telling already.

While here adjust style(9) as well.

Lastly add the bit definitions for use with printf(9) %b as names
read easier than bitmasks.  We will use that in LinuxKPI 802.11.

No functional changes.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4b6b9c1368b346f7093153d14e7931403ac3202d)
2025-07-16 08:42:44 +02:00
Bjoern A. Zeeb
5ddd593b7a LinuxKPI: netdev: add NETIF_F_HW_TC
Add a new flag needed by mt76.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9c05d6320cc091ffb43002a149c04c122ccb798c)
2025-07-16 08:42:42 +02:00
Bjoern A. Zeeb
d55b73ac4e iwlwifi: compile in ACPI support
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI we only need to provide the debug macro to
allow us to compile in ACPI support.

This ties into regulatory and will be used, e.g., for 11ax, 11be,
and Per Platform Antenna Gain (PPAG) settings.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 228b43c258d24c293b135ae94c120e7ccf0a7aea)
2025-07-16 08:34:34 +02:00
Bjoern A. Zeeb
43bd8bf721 rtw89: enable ACPI support on FreeBSD
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI remove the #ifdef around the code and compile in
ACPI support.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8c97c46418f9767a9984df259116da08d9659076)
2025-07-16 08:34:33 +02:00
Bjoern A. Zeeb
029e6b79e2 LinuxKPI: acpi: add acpi_evaluate_dsm()
Add a acpi_evaluate_dsm() wrapper around the native implementation
as needd by wireless drivers.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D50864

(cherry picked from commit ba6460df5607e572e9c868413c75ce9bc5ce9a00)
2025-07-16 08:34:33 +02:00
Bjoern A. Zeeb
1be17baf53 LinuxKPI: acpi: provide union [linuxkpi]_acpi_(object|buffer)
Provide union acpi_(object|buffer) as linuxkpi_ versions and in Linux
native lower case spelling so that driver code compiles unmodified.

Use the linuxkpi_ prefix to avoid name clashes with the native ACPI
implementation which uses CamelCase.

Use the linuxkpi_ names internally and redefine the linuxkpi_ unions
to their native names so they are avail as expected in drivers.

As a transition to not break drm-kmod which has in-place (no #ifdef)
changes from Linux spelling ot FreeBSD spelling, introduce
LINUXKPI_WANT_LINUX_ACPI so we have the Linux spelling as an opt-in.
That way the transition can happen gracefully and once "top-of-trees"
are all sorted we can remove the #ifdefs here again.

Bump __FreeBSD_version to be able to detect this change.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	wulf (previous version), dumbbell
Differential Revision: https://reviews.freebsd.org/D50863

(cherry picked from commit 2ddfcc013c251f13c8c9b24970b8134ddd49afea)
2025-07-16 08:34:33 +02:00
Bjoern A. Zeeb
743d465e86 LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO()
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus
attachments, factor out the bus-specfic MODULE_PNP_INFO() and place
it next to the structure defining the table.

As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with
PCI attachments for the "auxillary" bus so far.  That makes little sense.
Define the MODULE_PNP_INFO() to nothing for that.  We may consider
pulling these LinucKPI bits in semi-native drivers into LinuxKPI
one day as that route is not really sustainabke.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51049

(cherry picked from commit 2f5666c1727c949491f73e6c3277b7b542131714)
2025-07-16 08:34:33 +02:00
Bjoern A. Zeeb
9860e47f49 LinuxKPI: MODULE_DEVICE_TABLE() remove hard coded pci
While we currently only use MODULE_DEVICE_TABLE() for pci (or so I
thought [*]), this may soon change.  Remove a hard coded "pci" for
the bus and use the bus name passed in as _bus.

[*] see follow-up change

Sponsored by:	The FreeBSD Foundation
Reviewed by:	imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51048

(cherry picked from commit f58e032410c93d67c83d6bce8a3e6711f377a4be)
2025-07-16 08:34:33 +02:00
Bjoern A. Zeeb
bc1acdbcb8 LinuxKPI: Implement dma_map_resource/dma_unmap_resource functions
dma_map_resource() and dma_unmap_resource() functions are used to map
and unmap of memory-mapped IO resources so they can be accessed by
the device.

Required by drm-kmod v5.5 to be built.

While for drm-kmod 6.6-lts only amdgpu uses these in one place and
the code apparently has not been exercised a lot it has been around
like this for years.  With changing the underlying implementations
bring it into the tree; should we find errors with it they can also
be fixed here.

Bump __FreeBSD version to be able to detect this change.

Obtained from:	D30933 (by wulf)
Sponsored by:	The FreeBSD Foundation
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D49625

(cherry picked from commit a02180cf60a6a0102669b678e9c81ad9f1aa4d91)
2025-07-16 08:34:33 +02:00
Bjoern A. Zeeb
bef3edfe61 LinuxKPI: add missing bus_dmamap_sync() calls or exclude them
Rename linux_dma_unmap() to lkpi_dma_unmap(), and linux_dma_map_phys()
to lkpi_dma_map_phys() so that we get the full set of function
arguments (direction and attributes were missing).
Leave the old functions as wrappers as they are called from drm-kmod
linuxkpi/bsd still, and leaving them also allows us to MFC this
change.

Add missing bus_dmamap_sync() calls.  Rather than inlining them
in each inline function push them down to the actual implementation.
From there do not inline them either but call the appropriate
function dealing with the sync so that we do not have the same
code splattered in many places.

Adhere to the DMA_ATTR_SKIP_CPU_SYNC attribute and skip synching
when requested.

A previous, less complete version of this change already allowed
me to load firmware on arm64 for iwlwifi (again).

There are four more places which are not currently done as the
functions which came with an OFED sync a long time ago seem to be
unused these days.  Leaving a pr_debug("TODO") call there.

Also dma_[un]map_resource() when brought in from drm-kmod/linuxkpi/bsd
(D30933) should be adjusted to pass the full arguments as the amdgpu
callers are requesting to skip synching.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45294

(cherry picked from commit f99d393f7f787ff080c12b92243adcc310ac7c58)
2025-07-16 08:34:33 +02:00
Bjoern A. Zeeb
871d11b424 net80211: in ieee80211_sta_join() only do_ht if HT is avail
In ieee80211_sta_join() there are currently two ways to set
"do_ht": (1) after checking HT IEs are avail, and (2) after
checking VHT IEs are avail and we are not on 2GHz.

In the latter case no one checks that HT IEs are available and
when we hit ieee80211_ht_updateparams_final() htinfo may be NULL
and we panic.

Avoid this by only checking for VHT if do_ht was set.
No VHT without HT IEs.

While here switch do_ht to be a bool.

Sponsored by:	The FreeBSD Foundation
PR:		287625
Fixes:		51172f62a7
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D50923

(cherry picked from commit f51c794cbc80682931d47264e3c18329bae0a2c1)
2025-07-16 08:28:22 +02:00
Damir Bikmuhametov
a18d19bb2d pf: fix ICMP ECHO handling of ID conflicts
After applying FreeBSD-SA-24:05.pf, a problem with ICMP ECHO passing
through PF NAT was raised: two or more Windows workstations cannot ping
the same destination address at the same time. More precisely, only one
workstation pings normally, while the pings of the others are rejected
by the packet filter.

The thing is that Windows always uses the same ICMP ID (1). Therefore,
the state is created only for the workstation that started pinging
earlier.

In the pf_get_sport() function, we compare *nport with the ICMP_ECHO constant,
while icmptype (virtual_type actually) is passed in the pd->ndport parameter.

MFC after:	2 weeks
Reviewed by:	kp

(cherry picked from commit e7abf8829d8d496a8753946f67fb2016851b4f7c)
2025-07-15 07:04:46 +02:00
Gordon Tetlow
bdd854aae5 Add UPDATING entries and bump version.
Approved by:	so
2025-07-10 09:40:58 +02:00
Gordon Tetlow
5ee703c5d9 Fix corruption in ZFS replication streams from encrypted datasets.
From the upstream pull request merges:
 #17340 b144b160b Fix 2 bugs in non-raw send with encryption

Obtained from:	OpenZFS
Approved by:	so
Security:	FreeBSD-EN-25:10.zfs
2025-07-10 09:40:58 +02:00
Kristof Provost
b2c54d0714 pf: limit extra SCTP states
For SCTP we create states for all combinations of endpoints, to allow multihoming to work.
Malicious users could abuse this to fill our state table more easily
than they otherwise could, because we create states between all
combinations of endpoints. Limit this to no more than 8 extra endpoints
for each side of the connection.

MFC after:	2 weeks
Sponsored by:	Orange Business Services

(cherry picked from commit cd0169c9379c400ec75b77e87ca770e37f964276)
2025-07-10 09:40:58 +02:00
Mark Johnston
004d500df2 virtio_p9fs: Check for completions after enabling interrupts
Otherwise we can end up with a lost interrupt, causing lost request
completion wakeups and hangs in the filesystem layer.

Continue processing until we enable interrupts and then observe an empty
queue, like other virtio drivers do.

Sponsored by:	Klara, Inc.
2025-07-09 10:05:52 +02:00
Zhenlei Huang
99fb6da071 pfsync: Allocate and initialize buckets before attaching the interface
This prevents a potential race that the ioctl threads see NULL or
uninitialized buckets.

Reviewed by:	kp
Fixes:		4fc65bcbe3 pfsync: Performance improvement
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D51064

(cherry picked from commit edc307eca9a9a9b0ce7445cff513b48f6489e5c6)
2025-07-09 10:05:52 +02:00
Zhenlei Huang
947b6d3119 pfsync: Destroy buckets mutexes on clone destroying interface
So that the associated data with them will be freed.

Reviewed by:	kp
Fixes:		4fc65bcbe3 pfsync: Performance improvement
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D51063

(cherry picked from commit 8213c07c20586a67bc7f7152bd7ff76c02cbc007)
2025-07-09 10:05:52 +02:00
Zhenlei Huang
9c2305bc96 if_vlan: Fix up if_type before attaching the interface
ether_ifattach() does not touch if_type, so it is not mandatory to fix
the if_type after ether_ifattach(). Without this change, the event
listeners, e.g. netlink, will see wrong interface type IFT_ETHER rather
than the correct one IFT_L2VLAN. There is also a potential race that
other threads see inconsistent interface type, i.e. initially IFT_ETHER
and eventually IFT_L2VLAN.

As a nice effect, this change eliminates the memory allocation for
if_hw_addr, as vlan(4) interfaces do not support setting or retrieving
the hardware MAC address yet [1].

[1] ddae57504b Persistently store NIC's hardware MAC address, and add a way to retrive it

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

(cherry picked from commit a19b353d354d4ef808965c53253103cb6e7e6708)
2025-07-09 10:05:52 +02:00
Zhenlei Huang
3fe6446523 ifnet: Eliminate unnecessary synchronization of the interface index in the link layer address
Change 80e60e236d made the if_index global, and for the whole lifecycle
of an interface its index never changes, then there is no need to
synchronize the interface index in the link layer address when moving
interfaces from one vnet to another.

No functional change intended.

Reviewed by:	glebius
Fixes:		80e60e236d ifnet: make if_index global
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D50975

(cherry picked from commit 0b4c4833ee3eab0ce46b3bdbf054bca4b6bb7429)
2025-07-09 10:05:52 +02:00
Zhenlei Huang
f6dd2e56a0 ethernet: Set maximum Ethernet header length based on the capability IFCAP_VLAN_MTU
Lots of Ethernet drivers fix the header length after ether_ifattach().
Well since the net stack can conclude it based on the capability
IFCAP_VLAN_MTU, let the net stack do it rather than individual drivers.

Reviewed by:	markj, glebius
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D50846

(cherry picked from commit 6ce8fd1978a9526ff0dc02ed98ef797f9154ec1f)
2025-07-09 10:05:52 +02:00
Zhenlei Huang
66d3fa2553 bridge: Remove a redundant assignment of if_type
ether_ifattach() no longer sets if_type to IFT_ETHER and keeps it as is
since the change [1].

[1] fc74a9f93a Stop embedding struct ifnet at the top of driver softcs

No functional change intended.

MFC after:	1 week

(cherry picked from commit a07604e6264b88222941fa61c6f989bad5490765)
2025-07-09 10:05:52 +02:00
Zhenlei Huang
fdee8ea671 pfsync: Remove a redundant assignment of if_type
On initializing the interface, if_alloc(IFT_PFSYNC) has set if_type
already.

No functional change intended.

MFC after:	1 week

(cherry picked from commit 48af70e7c82150942fd095a38131e454e47ad162)
2025-07-09 10:05:52 +02:00
Zhenlei Huang
e6c091d02a iflib: Some style(9) tweaks
Prefer tab over eight whitespaces for indentation, and four spaces as
second level idents.

MFC after:	3 days

(cherry picked from commit 721e783a2a3316826f92fb44c931e28163118b3f)
2025-07-09 10:05:51 +02:00
Zhenlei Huang
2fc0239e7a if_firewire: Make firewire_broadcastaddr static const
This global variable is used only in this file. While here, constify it
since it is only used to read.

No functional change intended.

MFC after:	1 week

(cherry picked from commit 517eb20e54e59173b9dbede0bb3356f6197b5aa9)
2025-07-09 10:05:51 +02:00
Zhenlei Huang
86fb53c572 ifnet: Initialize the address family dependent data region earlier
if_link_ifnet() adds the interface to the global network interface list,
and it is a natural synchronization point. With this change, any threads
that obtain the reference of the interface via ifunit(), ifunit_ref() etc.,
will be guaranteed to see the address family dependent data rightly.

The issue [1] reported by Mike Belanger also hints the potential race.

MFC note: this change depends on e64fe5ad3a23, as calculating the max
IPv6 MTU through all the interfaces requires the current interface to
be added to the global network interface list firstly.

[1] https://lists.freebsd.org/archives/freebsd-net/2025-May/006817.html

Reviewed by:	glebius
MFC after:	1 month
MFC with:	e64fe5ad3a23 netinet6: Remove a set but not used global variable in6_maxmtu
Differential Revision:	https://reviews.freebsd.org/D49358

(cherry picked from commit 098b5d4dc744283a90b2d80c11395ecc18a84084)
2025-07-09 10:05:51 +02:00
Zhenlei Huang
037938b173 netinet6: Remove a set but not used global variable in6_maxmtu
and its setter in6_setmaxmtu().

This variable was introduced by the KAME projec [1]. It holds the max
IPv6 MTU through all the interfaces, but is never used anywhere.

[1] 82cd038d51 KAME netinet6 basic part(no IPsec,no V6 Multicast
                 Forwarding, no UDP/TCP for IPv6 yet)

Reviewed by:	glebius
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D49357

(cherry picked from commit e64fe5ad3a23a9f471ebf11e04e490588913c7af)
2025-07-09 10:05:51 +02:00
Franco Fichtner
abc7dbb433 pf: align sanity checks for pfrw_free 2025-07-09 10:05:51 +02:00
Franco Fichtner
cd9f3dd758 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-07-09 10:05:51 +02:00
Kristof Provost
7a51e74f92 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-07-09 10:05:51 +02:00
Kristof Provost
f62709b4fa 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-07-09 10:05:51 +02:00
Kristof Provost
a33722184c 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-07-09 10:05:51 +02:00
Franco Fichtner
4f4ebd2896 pf: only force state failure logging if logging was requested
PR: https://forum.opnsense.org/index.php?topic=45801.0
Fixes: 1a2a481
2025-07-09 10:05:50 +02:00
Franco Fichtner
77f8132af9 pf: fix NAT action regression in 18af3384c #223 2025-07-09 10:05:50 +02:00
Kristof Provost
2504a899e4 pflog: pass the action to pflog directly
If a packet is malformed, it is dropped by pf(4).  The rule referenced
in pflog(4) is the default rule.  As the default rule is a pass
rule, tcpdump printed "pass" although the packet was actually
dropped. Use the actual action, rather than the rule's action, or an
attempt at guessing the correct action.

Inspired by OpenBSD's 'pflog(4) logs packet dropped by default rule with block.' commit.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-07-09 10:05:50 +02:00
Kristof Provost
da66e273ff pfil: PFIL_PASS never frees the mbuf
pfil hooks (i.e. firewalls) may pass, modify or free the mbuf passed
to them. (E.g. when rejecting a packet, or when gathering up packets
for reassembly).

If the hook returns PFIL_PASS the mbuf must still be present. Assert
this in pfil_mem_common() and ensure that ipfilter follows this
convention. pf and ipfw already did.
Similarly, if the hook returns PFIL_DROPPED or PFIL_CONSUMED the mbuf
must have been freed (or now be owned by the firewall for further
processing, like packet scheduling or reassembly).

This allows us to remove a few extraneous NULL checks.

Suggested by:	tuexen
Reviewed by:	tuexen, zlei
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D43617
2025-07-09 10:05:50 +02:00
Stephan de Wit
a1cea79db3 axgbe: add support for Yellow Carp Ethernet device 2025-07-09 10:05:50 +02:00
Stephan de Wit
44c9c2da5e axgbe: Implement ifdi_i2c_req for diagnostics information
Fixes https://github.com/opnsense/src/issues/178
2025-07-09 10:05:50 +02:00
Franco Fichtner
b9eca9d898 axgbe: remove old annotations and a bit of whitespace cleanup 2025-07-09 10:05:50 +02:00