OPNSense/src e13f0desys/netpfil/pf pf_table.c

pf: align sanity checks for pfrw_free
DeltaFile
+7-3sys/netpfil/pf/pf_table.c
+7-31 files

OPNSense/src 94a56b8sys/net pfvar.h, sys/netpfil/pf pf.c

pf: backport changes around the following commit #242

 commit 49f39043a02d6011c1907e1b07eb034652a1269c
 Author: phessler <phessler at 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@
DeltaFile
+38-2sys/netpfil/pf/pf.c
+3-1sys/net/pfvar.h
+41-32 files

OPNSense/src 8d5ed9esys/netpfil/pf pf.c

pf: Cleanup leftover PF_ICMP_MULTI_* code that is not needed anymore.

ok henning

Obtained from:  OpenBSD, mikeb <mikeb at openbsd.org>, ecdc46e922
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+17-19sys/netpfil/pf/pf.c
+17-191 files

OPNSense/src 0306a28sys/net pfvar.h, sys/netpfil/pf pf.c pf_norm.c

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 at opnsense.org
DeltaFile
+22-0sys/netpfil/pf/pf.c
+15-0sys/netpfil/pf/pf_norm.c
+1-0sys/net/pfvar.h
+38-03 files

OPNSense/src eeca0a9sys/netinet ip_output.c ip_fastfwd.c

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
DeltaFile
+7-1sys/netinet/ip_output.c
+1-1sys/netinet/ip_fastfwd.c
+8-22 files

OPNSense/src 493c147sys/netpfil/pf pf.c

pf: only force state failure logging if logging was requested

PR: https://forum.opnsense.org/index.php?topic=45801.0
Fixes: 1a2a481
DeltaFile
+3-1sys/netpfil/pf/pf.c
+3-11 files

OPNSense/src 7bbca23sys/net if_pflog.h pfvar.h, sys/netpfil/pf pf.c pf_norm.c

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")
DeltaFile
+11-11sys/netpfil/pf/pf.c
+5-5sys/netpfil/pf/pf_norm.c
+2-2sys/net/if_pflog.h
+2-2sys/netpfil/pf/if_pflog.c
+1-1sys/net/pfvar.h
+21-215 files

OPNSense/src 63822e8sys/netpfil/pf pf.c

pf: fix NAT action regression in 18af3384c #223
DeltaFile
+1-1sys/netpfil/pf/pf.c
+1-11 files

OPNSense/src 64936a3sys/net pfil.c if_ethersubr.c, sys/netinet ip_input.c

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
DeltaFile
+6-1sys/net/pfil.c
+0-4sys/netinet/ip_input.c
+4-0sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c
+0-2sys/netinet6/ip6_input.c
+1-1sys/net/if_ethersubr.c
+11-85 files

OPNSense/src f93511asys/dev/axgbe if_axgbe_pci.c xgbe-common.h

axgbe: add support for Yellow Carp Ethernet device
DeltaFile
+4-0sys/dev/axgbe/if_axgbe_pci.c
+2-0sys/dev/axgbe/xgbe-common.h
+6-02 files

OPNSense/src 56fcaf2sys/dev/axgbe xgbe-phy-v2.c if_axgbe_pci.c

axgbe: Implement ifdi_i2c_req for diagnostics information

Fixes https://github.com/opnsense/src/issues/178
DeltaFile
+23-29sys/dev/axgbe/xgbe-phy-v2.c
+11-0sys/dev/axgbe/if_axgbe_pci.c
+2-1sys/dev/axgbe/xgbe.h
+36-303 files

OPNSense/src 591f58csys/dev/axgbe xgbe-phy-v2.c

axgbe: apply RRC to miibus attached PHYs and add support for variable bitrate 25G SFP+ DACs
DeltaFile
+43-16sys/dev/axgbe/xgbe-phy-v2.c
+43-161 files

OPNSense/src 62a3fe4sys/dev/axgbe if_axgbe_pci.c

axgbe: enable RSF to prevent zero-length packets while in Netmap mode

Initially, RSF (Receive Queue Store and Forward) was disabled for
unknown reasons, but the cut-through mode that's enabled as a result
seems to send 0 length packets up to the DMA when the RX queue is
full.
DeltaFile
+1-1sys/dev/axgbe/if_axgbe_pci.c
+1-11 files

OPNSense/src e2ffbf4sys/dev/axgbe xgbe-phy-v2.c xgbe-mdio.c

axgbe: move phy_stop to axgbe_if_detach()

Since the iflib interface needs axgbe_pci_init() and its phy starting capabilities, no data was passed in its absence.

With the NULL check of the axgbe_miibus we also resort back to an MDIO read as a module might be capable of both
clause 22 and clause 45 methods of communication.

with the move of phy_stop() to if_detach() in https://github.com/opnsense/src/commit/d50d4e8cd499882d4ac77765797a81306e316795, it's better to prevent reconfiguring the phy should the pci_init() callout trigger more than once.
DeltaFile
+7-0sys/dev/axgbe/xgbe-phy-v2.c
+5-1sys/dev/axgbe/xgbe-mdio.c
+1-3sys/dev/axgbe/if_axgbe_pci.c
+13-43 files

OPNSense/src ab44c53sys/dev/axgbe xgbe-phy-v2.c xgbe-mdio.c

axgbe: fix link issues for gigabit external SFP PHYs and 100/1000 fiber modules

Within the code path of autonegotiation for gigabit SFP modules was a bug, causing
a report of LINK_ERR for cases where an external SFP PHY was present. Fixing this issue
did not resolve to a link however, as it turned out that while autonegotiation interrupts
were happening, it's resulting status cannot be correctly determined in all cases. In these
specific cases we have no other option than to assume a module has negotiated to 1Gbit/s.

PHY-specific configuration has been delegated to the miibus driver, if an external PHY is present.
It's possible that the i2c bus does not recognize a PHY on the first pass, so in all cases we
retry up to a maximum of 5 times during each link poll pass to ensure we didn't miss the presence
of an external PHY.

This commit also addresses link issues on both 100 mbit and 1Gb fiber modules. Not all of these modules
have the correct data set according to SFF-8472, as such we first check for gigabit compliance and
the associated baudrate, otherwise we resort back to determining what type of fiber module is plugged
in by checking the baudrate, cable length and wavelength and setting the MAC speed accordingly.
DeltaFile
+96-20sys/dev/axgbe/xgbe-phy-v2.c
+1-5sys/dev/axgbe/xgbe-mdio.c
+1-1sys/dev/axgbe/xgbe-i2c.c
+98-263 files

OPNSense/src 8d3679esys/dev/axgbe xgbe-phy-v2.c xgbe-sysctl.c

axgbe: remove old annotations and a bit of whitespace cleanup
DeltaFile
+8-8sys/dev/axgbe/xgbe-phy-v2.c
+2-2sys/dev/axgbe/xgbe-sysctl.c
+1-1sys/dev/axgbe/if_axgbe_pci.c
+1-1sys/dev/axgbe/xgbe-dev.c
+12-124 files

OPNSense/src d6870e3sys/dev/axgbe xgbe-phy-v2.c

axgbe: account for 4 SFP ports during GPIO expander check
DeltaFile
+36-36sys/dev/axgbe/xgbe-phy-v2.c
+36-361 files

OPNSense/src 1dd3163sys/dev/axgbe xgbe-phy-v2.c xgbe-i2c.c

axgbe: gracefully handle i2c bus failures

In (unknown) situations it seems the i2c bus can have trouble,
while nothing about the current link state has changed, the driver
would react by going into a link down state, and start busylooping
on up to 4 cores. Even if there was a valid link, such spinning
on a cpu by a kernel thread would wreak havoc to existing and
new connections.

This patch does the following:
1. If such a bus failure occurs, we keep the last known link state.
2. Prevent busy looping by implementing the lockmgr() facility to
be able to sleep while the i2c code waits on the i2c ISR. We cap
this with a timeout.
3. Pin the admin queues to the last CPU in the system, to prevent
other scenarios where busy looping might occur from landing on CPU
0, which especially seems to cause a lot of issues.

Given the design constraints both in hardware and in software,

    [9 lines not shown]
DeltaFile
+62-29sys/dev/axgbe/xgbe-phy-v2.c
+37-13sys/dev/axgbe/xgbe-i2c.c
+5-0sys/dev/axgbe/xgbe.h
+4-1sys/dev/axgbe/xgbe-mdio.c
+2-1sys/dev/axgbe/if_axgbe_pci.c
+1-1sys/dev/axgbe/xgbe-phy-v1.c
+111-456 files

OPNSense/src 28c298csys/dev/axgbe xgbe-phy-v2.c xgbe-mdio.c

axgbe: LED control for A30 platform

Since the I/O expander chip does not do a reset when soft power
cycling, the driver will first turn off all LEDs when initializing,
although no specific routine seems to be called when powering down.
This means that the LEDs will stay on until the driver has booted up,
after which the driver will be in a consistent state.
DeltaFile
+86-0sys/dev/axgbe/xgbe-phy-v2.c
+11-2sys/dev/axgbe/xgbe-mdio.c
+10-0sys/dev/axgbe/xgbe.h
+107-23 files

OPNSense/src 845fe60sys/dev/axgbe xgbe-phy-v2.c

axgbe: exclude 10G modules from miibus interface
DeltaFile
+3-0sys/dev/axgbe/xgbe-phy-v2.c
+3-01 files

OPNSense/src f3fb8d1sys/dev/axgbe xgbe-phy-v2.c

axgbe: also validate configuration register in GPIO expander

It is possible for a machine to boot into a state in which the configuration register,
responsible for controlling wether an I/O signal is considered an input or output,
contains randomized values. It was assumed this was programmed by the BIOS.

If I/O is reversed, it's possible for the driver to think an SFPP module has been inserted
when there is none, leading to unrecoverable I2C errors.

The configuration register should contain a state which is determined and provided by the BIOS,
hence no hard-coded values are programmed here.
DeltaFile
+50-27sys/dev/axgbe/xgbe-phy-v2.c
+50-271 files

OPNSense/src eea4346sys/netinet ip_output.c ip_fastfwd.c, sys/netinet6 ip6_output.c ip6_fastfwd.c

pf|ipfw|netinet6?: shared IP forwarding

This removes the if_output calls in the pf(4) code that escape further
processing by defering the forwarding execution to the network stack
using on/off style sysctls for both IPv4 and IPv6.

Also see: https://reviews.freebsd.org/D8877
DeltaFile
+136-12sys/netinet6/ip6_output.c
+107-9sys/netinet/ip_output.c
+37-46sys/netinet6/ip6_fastfwd.c
+28-46sys/netpfil/ipfw/ip_fw_pfil.c
+34-29sys/netinet6/ip6_forward.c
+25-34sys/netinet/ip_fastfwd.c
+367-1766 files not shown
+446-22912 files

OPNSense/src 8167ac3sys/dev/axgbe xgbe-phy-v2.c if_axgbe_pci.c

axgbe: several patches from 22.1 not yet present in FreeBSD
DeltaFile
+212-12sys/dev/axgbe/xgbe-phy-v2.c
+66-24sys/dev/axgbe/if_axgbe_pci.c
+24-0sys/dev/axgbe/xgbe-common.h
+14-0sys/dev/axgbe/xgbe-sysctl.c
+9-1sys/dev/axgbe/xgbe-dev.c
+1-6sys/dev/axgbe/xgbe-txrx.c
+326-433 files not shown
+330-489 files

OPNSense/src 3efe7d4sys/net rss_config.c if_gre.c, sys/netinet ip_input.c

rss: add sysctl enable toggle

This commit also includes the original refactoring changes

This change allows the kernel to operate with the default netisr cpu-affinity settings while having RSS compiled in. Normally, RSS changes quite a bit of the behaviour of the kernel dispatch service - this change allows for reducing impact on incompatible hardware while preserving the option to boost throughput speeds based on packet flow CPU affinity.

Make sure to compile the following options in the kernel:

    options  RSS

As well as setting the following sysctls:

    net.inet.rss.enabled: 1
    net.isr.bindthreads: 1
    net.isr.maxthreads: -1 (automatically sets it to the number of CPUs)

And optionally (to force a 1:1 mapping between CPUs and buckets):

    net.inet.rss.bits: 3 (for 8 CPUs)

    [5 lines not shown]
DeltaFile
+37-1sys/net/rss_config.c
+20-0sys/netinet6/ip6_input.c
+19-0sys/netinet/ip_input.c
+12-7sys/net/if_gre.c
+7-0sys/netinet6/frag6.c
+6-0sys/netinet6/ip6_output.c
+101-811 files not shown
+131-1017 files

OPNSense/src eefbda8stand/efi/loader main.c bootinfo.c

stand: add EFI support for mmio serial consoles

When no legacy serial is found, we may be looking at a non-legacy mmio
serial device mapping, in which case the efi_devpath_name() for name
ConOutDev looks like this:

    VenHw(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,0090DCFE00000000)/Uart(115200,8,N,1)/VenVt100()

Which should tell the kernel to attach a console to 0xfedc9000
(little endian 64 bit value).  The value is stored behind the
VENDOR_DEVICE_PATH struct as a byte stream hence we need to check
if said address is appended behind the node.  Also enforce use for
uart by requiring the console speed read from the same device.

There is no scientific process for "rs:2" derivation, but evidence would
indicate that this is the correct setting for existing MMIO EFI consoles.

See also: http://bsdimp.blogspot.com/2018/07/how-to-get-memory-mapped-serial-console.html
DeltaFile
+18-0stand/efi/loader/main.c
+8-0stand/efi/loader/bootinfo.c
+26-02 files

OPNSense/src a8a12d8sys/amd64/conf GENERIC.hints

Revert "amd64 GENERIC: Switch uart hints from "isa" to "acpi""

This reverts commit 74b9fc7adcf4afb1c3039267e338c3cfdf022957.
DeltaFile
+4-2sys/amd64/conf/GENERIC.hints
+4-21 files

OPNSense/src 461afcclibexec/rc/rc.d hostid

rc: ignore InsydeH2O UEFI BIOS UUID placeholder for hostid

This caused MAC addresses (e.g. bridge0) to clash on systems
running this particular BIOS.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1544
DeltaFile
+2-0libexec/rc/rc.d/hostid
+2-01 files

OPNSense/src 9e9b691sys/netinet udp_usrreq.c, sys/netinet6 udp6_usrreq.c

Add UDP encapsulation of ESP in IPv6

This patch provides UDP encapsulation of ESP packets over IPv6.
Ports the IPv4 code to IPv6 and adds support for IPv6 in udpencap.c
As required by the RFC and unlike in IPv4 encapsulation,
UDP checksums are calculated.

Co-authored-by: Aurelien Cazuc <aurelien.cazuc.external at stormshield.eu>
Sponsored-by:   Stormshield
Sponsored-by:   Wiktel
Sponsored-by:   Klara, Inc.

Fix KASSERT in 80044c78 causing build failures

Move the KASSERT to where struct ip6_hdr is populated

Fixes:          80044c785cb040a2cf73779d23f9e1e81a00c6c3
Reported-by:    bapt
Reviewed-by:    markj
Sponsored-by:   Klara, Inc.
DeltaFile
+144-26sys/netipsec/udpencap.c
+98-32sys/netipsec/key.c
+47-21sys/netinet/udp_usrreq.c
+8-8sys/netipsec/ipsec_support.h
+11-1sys/netinet6/udp6_usrreq.c
+9-0sys/netipsec/ipsec_input.c
+317-883 files not shown
+322-919 files

OPNSense/src abd4bcelibexec/rc/rc.d hostid

rc: ignore InsydeH2O UEFI BIOS UUID placeholder for hostid

This caused MAC addresses (e.g. bridge0) to clash on systems
running this particular BIOS.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1544
DeltaFile
+2-0libexec/rc/rc.d/hostid
+2-01 files

OPNSense/src d8c11c2sys/netinet udp_usrreq.c, sys/netinet6 udp6_usrreq.c

Add UDP encapsulation of ESP in IPv6

This patch provides UDP encapsulation of ESP packets over IPv6.
Ports the IPv4 code to IPv6 and adds support for IPv6 in udpencap.c
As required by the RFC and unlike in IPv4 encapsulation,
UDP checksums are calculated.

Co-authored-by: Aurelien Cazuc <aurelien.cazuc.external at stormshield.eu>
Sponsored-by:   Stormshield
Sponsored-by:   Wiktel
Sponsored-by:   Klara, Inc.

Fix KASSERT in 80044c78 causing build failures

Move the KASSERT to where struct ip6_hdr is populated

Fixes:          80044c785cb040a2cf73779d23f9e1e81a00c6c3
Reported-by:    bapt
Reviewed-by:    markj
Sponsored-by:   Klara, Inc.
DeltaFile
+144-26sys/netipsec/udpencap.c
+98-32sys/netipsec/key.c
+47-21sys/netinet/udp_usrreq.c
+8-8sys/netipsec/ipsec_support.h
+11-1sys/netinet6/udp6_usrreq.c
+9-0sys/netipsec/ipsec_input.c
+317-883 files not shown
+322-919 files