Commit graph

154179 commits

Author SHA1 Message Date
Bjoern A. Zeeb
a7c19b8a99 LinuxKPI; 802.11: start implementing cfg80211_calculate_bitrate()
For now we only return the legacy rate and have two TODOs for HT and
VHT which still need to be implemented as needed.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-16 22:33:03 +00:00
Bjoern A. Zeeb
470aaf42c3 LinuxKPI: 802.11: make struct ieee80211_tx_info a bit more packed
Given I was looking at the struct make it more packed at the beginning
at least.  In fact it did not shrink but the tx_time_est got expanded.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-16 22:24:53 +00:00
Bjoern A. Zeeb
49010ba706 LinuxKPI: 802.11: fill in a lot more RX status fields
Convert a lot more LinuxKPI rx_status fields to net80211 rx_stats
bits for as much as we can see fit.  Factor the entire logic out
into its own function as it got quite long.

Now only net80211 needs to start using more of these values and
report them.

Also fix some related fields and struct definitions in LinuxKPI.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-16 22:09:00 +00:00
Doug Moore
3f850550d6 pctrie: Fix size of printed value in KASSERT
The value 'index' in a pctrie iterator cannot be written
with "%lx" on a 32-bit machine.  Use '%jx' after a uintmax_t cast instead.

Reported by:	bz
Fixes:	bba883df5e
2025-02-16 15:27:21 -06:00
Bjoern A. Zeeb
3afc0bfecb net80211: crypto: ccmp: fix more hardware offload bits
Add the missing IEEE80211_RX_F_DECRYPTED and IEEE80211_RX_F_MMIC_STRIP
(really just MIC_STRIP) checks to make hwaccel offload work.
This makes rtw8x drivers pass RX packets again at least with LinuxKPI
if HW_CRYPTO support is enabled.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D49030
2025-02-16 20:23:01 +00:00
Bjoern A. Zeeb
ec6185c526 net80211/crypto: LinuxKPI/802.11: introduce IEEE80211_RX_F_PN_VALIDATED
There are cases when we see "rx seq# violation (CCMP)".

Historically these were AHDEMO/IBBS cases (IEEE80211_KEY_NOREPLAY,
see 5d766a09da).

With iwlwifi(4) doing RSS for newer chipsets and us not having any idea
about multiple rx-queues (passed all the way through) leads to the same
problem.  An easy way to trigger this is doing an IPv6 all-nodes echo
request.  With a sufficient amount of nodes answering the answers will
be hashed to different queues and re-ordering will likely take place
as queues get released individually.
However crypto validation is already done in fw/driver for these cases
and we need to carry the state forward.  Add IEEE80211_RX_F_PN_VALIDATED
to indicate that the checks were done passing the information from driver
through LinuxKPI to net80211.
LinuxKPI enforces that a frame was indeed decrypted; otherwise the flag
would be invalid.

This also avoids returning an error and no key from
ieee80211_crypto_decap() and thus avoids dropping the frame.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D49029
2025-02-16 20:20:50 +00:00
Doug Moore
bba883df5e pctrie: iter_remove check from panic to KASSERT
pctrie_iter_remove checks to see if the thing the iterator points to
is actually there, and panics if it is not. This panic would likely
indicate the same iterator had been used for removal twice, without
advancing the iterator in-between. This test takes a bit of time, and
as it indicates a programmer error rather than some external
condition, it is better handled as a KASSERT. This means with KASSERTs
disabled, a wee bit of time is saved.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D49015
2025-02-16 13:05:18 -06:00
Bojan Novković
19f202f859 sdhci: Fixes for sdhci_fdt_rockchip.c
This change fixes a couple of issues in the Rockchip SDHCI driver:
 - Fix a panic caused by sdhci_fdt_rockchip_attach not populating the
   softc's dev variable before initializing clocks
 - Fix a bug where sdhci_fdt_rockchip_set_clock fails to call
   sdhci_fdt_set_clock

Fixes:	e17e33f997
Reported by:	Alonso Cárdenas Márquez (acardenas@bsd-peru.org)
2025-02-16 11:41:43 +01:00
Bjoern A. Zeeb
5778cbdae7 LinuxKPI: 802.11: implement various VHT helper functions
Implement ieee80211_rate_set_vht(), ieee80211_rate_get_vht_{mcs,nss}(),
and ieee80211_get_vht_max_nss().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-02-15 23:53:19 +00:00
Bjoern A. Zeeb
c272abc5c6 LinuxKPI: 802.11: adjust the hw_scan channel list
Until net80211 will grow proper scan offload with the various options
needed and will allow switching the scan engine try to improve the
situation if we are doing a hw_scan and the device supports
SINGLE_SCAN_ON_ALL_BANDS.  In that case create the channel list from
our device information of supported channels rather than from the
net80211 scan list.  Filter out currently unsupported bands.

While the general "scan EBUSY" problem remains at least in my local
testing I am seeing a lot more 2 and 5 GHz band results rather than
being stuck on a single band (as was also often the case with iwm for
me in the past).

Tested by:	rene (previous version)
MFC after:	3 days
2025-02-15 23:22:39 +00:00
Adrian Chadd
0f10a33fc1 ar40xx: fix to compile/run under the new ifnet rules
Locally tested:

* IPQ4018, Asus router, w/ ethernet driver

Differential Revision:	https://reviews.freebsd.org/D49025
Reviewed by:	imp, zlei
2025-02-15 12:43:42 -08:00
Doug Moore
fa462b8b8e vm_object: drop pointless assignment
An assignment in collapse_scan() has become useless because, on every
path, another assignment to that variable overrides it before that
variable is read.  Another assignment can be avoided sometimes, so
move it down in the loop to where it's really necessary.

Reviewed by:	alc, markj
Differential Revision:	https://reviews.freebsd.org/D49017
2025-02-15 12:09:26 -06:00
Bjoern A. Zeeb
9763fec11b net80211: use IEEE80211_KEY_UNDEFINED() insetad of checking they keyix
For ieee80211_node_delucastkey() rather than checking the keyix to be
IEEE80211_KEYIX_NONE use the IEEE80211_KEY_UNDEFINED() macro (which
chekes the wk_cipher to be 'none').

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D48980
2025-02-15 15:50:23 +00:00
Bjoern A. Zeeb
d688c20395 net80211: crypto: enhance comment about IEEE80211_RX_F_MMIC_STRIP
net80211 crypto currently re-uses the M[ichael]MIC flag for MIC as well
at least in CCMP.  This is a bit confusing so at least try to improve
the comment that it becomes more obvious.
In the long-term we may want to just add a MIC flag as well?

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D48978
2025-02-15 15:49:53 +00:00
Bjoern A. Zeeb
7f31d95c98 net80211: rename \4 in IEEE80211_VHTCAP_BITS for clarity
Bits 2 and 3 (\3 and \4 of the %b flag mask) are the 'Supported Channel
Width Set' indicating VHT160 (B2) or VHT160 and VHT80P80 (B3) support.
Though longer rename \4 from CHAN80P80 to CHAN160+80P80 to not confuse
the reader that VHT160 might not be supported.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D48977
2025-02-15 15:49:27 +00:00
Bjoern A. Zeeb
8f2e5b6ef3 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
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D48976
2025-02-15 15:49:02 +00:00
Bjoern A. Zeeb
75fb66d824 net80211 / LinuxKPI 802.11: add 802.11-2016 VHT Extended NSS BW defines
Add the mask and shift for the VHT Extended NSS BW Support field.
Document them in net80211 and further related bitmasks in LinuxKPI.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D48975
2025-02-15 15:48:36 +00:00
Adrian Chadd
89e3c2d27a flash: add w25n (nand flash) support
This adds read only support for the W25N series of flash parts.

Specifically starting with the W25N01GV, a 128MiB SPI NAND flash.

This doesn't currently support writing or erasing, as this requires
a NAND flash layer that we don't currently have.  There are also
plenty of other commands that aren't currently supported - notably
maintaining the on-chip flash translation layer, flash wear statistics,
etc.

But read support is fine enough for now; it at least allows for
reading the boot / config / calibration flash on my ASUS IPQ4018 based
router.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D48979
2025-02-14 19:03:55 -08:00
Rick Macklem
464372940b param.h: Bump FreeBSD_version for commit 4517fbfd42
Commit 4517fbfd42 changed the internal API between
the nfscommon and nfscl modules.  As such, both need
to be rebuilt from sources.
2025-02-14 13:04:15 -08:00
Rick Macklem
4517fbfd42 nfscl: Add support for CB_RECALL_SLOT
The callback CB_RECALL_SLOT is required for NFSv4.1/4.2.
Fortunately, there does not appear to be any extant
NFSv4.1/4.2 servers that use it.  Since commit b97a478896
fixed handling of session slot shrinking, this patch
adds support for CB_RECALL_SLOT, which shrinks the
number of session slots as well.

MFC after:	2 weeks
2025-02-14 12:56:52 -08:00
Kristof Provost
8e8a77c56e pf: allow multiple pflog interfaces to be created
Fixes:		3bf6554017
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-14 18:47:53 +01:00
Kristof Provost
d2bb19883f pf: introduce a way to match "any" interface, excluding loopback ones
pfi_kkif_attach() annotates the kif with a flag indicating it is the "any" match.
pfi_kif_match obeys() that flag.

ok benno

Obtained from:	OpenBSD, henning <henning@openbsd.org>, 4be478ce5d
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-14 18:47:52 +01:00
Kristof Provost
7e7f88001d pf: use time_t for storing time_t values
No change to the underlying type, so no ABI change.

We define __time_t as uint64_t if __LP64__, otherwise uint32_t,
and only define __LP64__ if long is 64 bits.
In other words: __time_t == long.

ok henning@ deraadt@

Obtained from:	OpenBSD, guenther <guenther@openbsd.org>, 6c1b69a0ff
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D48963
2025-02-14 18:47:52 +01:00
Mark Johnston
36631977d8 ktr: Use STAILQ_EMPTY_ATOMIC when checking for records in ktr_drain()
This is an unlocked check, and after commit 34740937f7 the debug
checks in STAILQ_EMPTY may spuriously fail here.  In particular, the per
process queue is updated under the global ktrace mutex, not held in
ktr_drain().  If a record is enqueued concurrently, the recording thread
will schedule an AST to drain the queue again, so it should not be
possible for a race to leave records in the queue indefinitely.

Reviewed by:	kib, olce
Reported by:	syzbot+d67eddd8c4923ee28bb7@syzkaller.appspotmail.com
MFC after:	2 weeks
Fixes:		34740937f7 ("queue: New debug macros for STAILQ")
Differential Revision:	https://reviews.freebsd.org/D48899
2025-02-14 15:52:29 +00:00
Mark Johnston
d2870b8666 queue: Add atomic variants for *_EMPTY
In some places, these macros are used without a lock, under the
assumption that they are naturally atomic.  After commit
34740937f7 ("queue: New debug macros for STAILQ"), this assumption is
false.

Provide *_EMPTY_ATOMIC for such cases.  This lets us include extra debug
checks for the non-atomic case, and gives us a way to explicitly
annotate unlocked checks, which generally deserve extra scrutiny and
might otherwise raise reports from KCSAN.

Reviewed by:	kib, olce (previous version)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48899
2025-02-14 15:45:11 +00:00
Mark Johnston
fbacadf103 vmm: Add vmm_fence.c to SRCS for vmm.ko on riscv
Fixes:	8f6b66a9d3 ("riscv vmm: implement SBI RFNC extension.")
2025-02-14 15:26:49 +00:00
Franco Fichtner
685fb42538 pf: Log the intended action when a NAT rule matches a packet
When a packet matches a binat/nat/rdr rule, pf logs the match.  The log
metadata includes the rule's action on the packet, e.g., PF_PASS.  NAT
rules have their own actions: PF_BINAT, PF_NAT, PF_RDR.

Before commit 948e8413ab ("pflog: pass the action to pflog directly"),
pflog_packet() would obtain the action from the rule definition, whereas
after that commit the action is passed as a parameter.  When a NAT rule
matches, we want to log the rule action, but after that commit, PF_PASS
is hard-coded.  Restore the previous behaviour.

Add a regression test which installs a redirect, logs packets matching
the redirect rule, and verifies that the corresponding pflog entry
includes the correct action.

Reviewed by:	kp
Fixes:		948e8413ab ("pflog: pass the action to pflog directly")
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	OPNsense
Differential Revision:	https://reviews.freebsd.org/D48911
2025-02-14 15:24:15 +00:00
Jesper Schmitz Mouridsen
b968644127 mtw: Use correct cmd for radio
Approved by:	adrian, wireless
Differential Revision:	https://reviews.freebsd.org/D49003
2025-02-14 16:20:40 +01:00
Jasper Tran O'Leary
73c3fe4db3 gve: Fix qpl_buf_head being initialized improperly
Currently, for DQO QPL our MPASS assertion on qpl_buf_head for available
pending_pkts (i.e. not holding a packet) fails due to incorrect
initialization. The MPASS fails on the first run of packets through the
ring when INVARIANTS is on, and when INVARIANTS is off, things work
without a bug.

The MPASS guards against improper reaping of "pending_pkt" objects,
and thus was failing for the first run through the ring. By correctly
initializing the objects in this patch we make the MPASS not fail on the
first run too.

Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48968
2025-02-14 15:08:23 +00:00
Jasper Tran O'Leary
031800c786 gve: Do minor cleanup and bump version
This commit fixes several minor issues:

- Removes an unnecessary function pointer parameter on gve_start_tx_ring
- Adds a presubmit check against style(9)
- Replaces mb() and rmb() macros with native
  atomic_thread_fence_seq_cst() and atomic_thread_fence_acq()
  respectively
- Fixes various typos throughout
- Increments the version number to 1.3.2

Co-authored-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48969
2025-02-14 15:08:23 +00:00
Jasper Tran O'Leary
62b2d0c3f4 gve: Fix memory leak during reset
Before this change, during reset we were allocating new memory for
priv->ptype_lut_dqo, irq_db_array and the counter_array over the old
memory. This change ensures we do not allocate new memory during reset
and avoid memory leaks.

Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48970
2025-02-14 15:08:18 +00:00
Jasper Tran O'Leary
909e2d7b69 gve: Disallow MTUs within a problematic range
If hardware LRO is enabled with GVE, then setting the driver's MTU to a
range of values around 8000 will cause dropped packets and drastically
degraded performance. While this issue is being investigated, we need
to prohibit the driver's MTU being set to a value within this range.

Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48971
2025-02-14 14:57:06 +00:00
Zhenlei Huang
91bae242bc bnxt_en: Improve sysctl handler bnxt_dcb_list_app()
Prefer sbuf_new_for_sysctl() over error-prone manually managed buffer.

No functional change intended.

Reviewed by:	markj
Tested by:	Daniel Porsch <daniel.porsch@loopia.se>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48496
2025-02-14 18:38:30 +08:00
Zhenlei Huang
747fd2db53 bnxt_en: Remove pointless NULL check for sysctl arg1
Those sysctl handlers have been guaranteed to have non-null softc. No
need for NULL check within sysctl handlers.

No functional change intended.

Reviewed by:	markj
Tested by:	Daniel Porsch <daniel.porsch@loopia.se>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48495
2025-02-14 18:38:30 +08:00
Zhenlei Huang
0bc672b38f bnxt_en: Fix the description of sysctl knob dev.bnxt.X.dcb.dcbx_cap
While here, update the description of dev.bnxt.X.dcb to more informative
words "Data Center Bridging".

Reviewed by:	markj
Fixes:	35b53f8c98 bnxt_en: Add PFC, ETS & App TLVs protocols support
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48993
2025-02-14 18:38:30 +08:00
Zhenlei Huang
3de231b4d9 bnxt_en: Retrieve maximum of 128 APP TLVs
It appears that the maximum number of APP TLVs supported by the hardware
is 128 according to D45005. Well Daniel Porsch reported an issue PR284073
which shows that the number can exceed the limit, causing out of bound
write to on-stack allocated variable app[128] and the kernel panics.

Limit to 128 while retrieving APP TLVs.

PR:		284073
Reviewed by:	markj
Tested by:	Daniel Porsch <daniel.porsch@loopia.se>
Fixes:	35b53f8c98 bnxt_en: Add PFC, ETS & App TLVs protocols support
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48589
2025-02-14 18:38:29 +08:00
Navdeep Parhar
04bf43505b cxgbe(4): Use correct priority in begin_synchronized_op.
It was always set to PCATCH because the driver tested (INTR_OK) instead
of (flags & INTR_OK).  Fit a WITNESS_WARN in a single line while here.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 22:15:18 -08:00
Navdeep Parhar
f79fba05a0 cxgbe(4): Remove smt_idx from the L2 table entry structure.
An L2 table entry isn't associated with a particular SMT (Source MAC
Table) entry.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 21:54:59 -08:00
Navdeep Parhar
9d76f6d042 cxgbe(4): Remove some unused PCI routines and associated headers.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 20:52:25 -08:00
Navdeep Parhar
762d32354a cxgb(4): Use routines from pci(9) instead of hand rolled equivalents.
There is no need to include private PCI headers in the driver.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 20:44:23 -08:00
Navdeep Parhar
f4ab14044c cxgbe(4): Make sure suspend/resume works in recovery mode.
The driver does minimal initialization in this mode and suspend/resume
should ignore resources that aren't setup.  This is for debug only.

kenv hw.cxgbe.sos="1"
kldload if_cxgbe
devctl suspend t6nex0
devctl resume t6nex0

MFC after:	1 week
Sponsored by:	Chelsio Communications
2025-02-13 16:41:50 -08:00
Kevin Bowling
124b7722aa 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.

MFC after:	3 days
2025-02-13 11:26:35 -07:00
Aurelien Cazuc
4b29599fbb 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

MFC after:	3 days
Sponsored by:	Stormshield (author)
Differential Revision:	https://reviews.freebsd.org/D48987
2025-02-13 11:20:26 -07:00
Kajetan Staszkiewicz
07e070ef08 pf: Add support for multiple source node types
For every state pf creates up to two source nodes: a limiting one
struct pf_kstate -> src_node and a NAT one struct pf_kstate -> nat_src_node.
The limiting source node is tracking information needed for limits using
max-src-states and max-src-nodes and the NAT source node is tracking NAT
rules only.

On closer inspection some issues emerge:
- For route-to rules the redirection decision is stored in the limiting source
  node. Thus sticky-address and source limiting can't be used separately.
- Global source tracking, as promised in the man page, is totally absent from
  the code. Pfctl is capable of setting flags PFRULE_SRCTRACK (enable source
  tracking) and PFRULE_RULESRCTRACK (make source tracking per rule). The kernel
  code checks PFRULE_SRCTRACK but ignores PFRULE_RULESRCTRACK. That makes
  source tracking work per-rule only.

This patch is based on OpenBSD approach where source nodes have a type and each
state has an array of source node pointers indexed by source node type
instead of just two pointers. The conditions for limiting are applied
only to source nodes of PF_SN_LIMIT type. For global limit tracking
source nodes are attached to the default rule.

Reviewed by:		kp
Approved by:		kp (mentor)
Sponsored by:		InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D39880
2025-02-13 15:59:12 +01:00
Zhenlei Huang
b61fbbed73 powerpc: Remove flag CTLFLAG_TUN from sysctl knob hw.platform
Prior to change [1] this flag is useless but harmless. After the change
plat_name[] will be fetched from kernel environment after invoking the
platform probe function `platform_probe_and_attach()`. The probe function
runs at early boot stage prior to `mi_startup()` thus it is too late and
pointless to set plat_name[] after the probe.

Nathan mentioned that the logic to specify the platform pre-dates the
powerpc64 work, and is from the original pre-FDT Book-E bringup from
like 2008, so it's irrelevant these days. Instead of fixing setting the
sysctl knob hw.platform, let's clean it up now.

[1] 3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to ...

Discussed with:	nwhitehorn
Reviewed by:	olce (previous version), jhibbits, #powerpc
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D48897
2025-02-13 22:42:45 +08:00
Kristof Provost
67c19da08f pf: support negated matches on the rcvif
ok dlg benno

Obtained from:	OpenBSD, henning <henning@openbsd.org>, 08c03b768d
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-13 13:38:44 +01:00
Kristof Provost
25dbba4fc6 pf: improve UDP-in-ICMP handling
Translate port numbers for inner udp packets when they're returned
as a payload of icmp error messages. Makes traceroute6 operate
across a nat64 gateway.

prompted by sthen, ok henning

Previous udp port number rewrite fix turned out to be a work around
the incorrect pf_change_ap call. While here make the tcp case use
pf_change_ap since it shares the same properties.  ok henning

Obtained from:	OpenBSD, mikeb <mikeb@openbsd.org>, 7a304f30d6
Obtained from:	OpenBSD, mikeb <mikeb@openbsd.org>, 5d4200d304
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-13 13:38:44 +01:00
Kristof Provost
06c4372a2f pf: do not reassemble atomic IPv6 fragments
IPv6 atomic fragments must not go the reassembly queue, but be
processed immediately.  Let pf step over an atomic fragment header
and handle the packet like an unfragmented.
OK mikeb@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, fd6d9d2982
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-13 13:38:44 +01:00
Kristof Provost
9565df4e7f pf: fix 'quick' for match rules
In pf_test_rule, when dealing with a match rule, obey the match rule's quick
flag to decide wether to abort ruleset eval instead of the last matching rule's
one. Makes "match quick" abort ruleset evaluation with the current block/pass
state. From Maxim Khitrov <max at mxcrypt.com>, ok bluhm mikeb

Obtained from:	OpenBSD, henning <henning@openbsd.org>, c5611d5b70
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-13 13:38:43 +01:00
Kristof Provost
c11d317a8b pf: do not reset the fragment timeout each time a fragment arrives
Start the expire counter when the queue is created by the first
fragment and drop it if the packet could not be reassembled within
60 seconds.
Reported by Antonios Atlasis; OK henning@ deraadt@

Obtained from:	OpenBSD, bluhm <bluhm@openbsd.org>, 4697a20621
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-02-13 13:38:43 +01:00