OPNSense/src 8624279stand/efi/loader main.c bootinfo.c

Revert "stand: add EFI support for mmio serial consoles"

This reverts commit 56b85fc10c2a83e59820860f2446bbfbb2edfdf4.
DeltaFile
+0-18stand/efi/loader/main.c
+0-8stand/efi/loader/bootinfo.c
+0-262 files

OPNSense/src 0ceba6estand/efi/loader main.c

loader.efi: Parse SPCR table entry in ACPI tables

If there's a SPCR, then use it to create and pass the right values to
the uart.  We pass xo=0 in to calcuate the xo from the baud rate. We try
to be smart about what we set. We either set io or mm or pv/pd. Old
kernels will still work, despite pb/pd not being supported, because
we'll fall back to the SPCR parsing in the kernel.

We don't support Rev3 or Rev4 SPCR yet. It's too new to be in real
hardware yet.

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D47085

(cherry picked from commit 70253b538f68f2787d5913702337eb600799a3c3)
DeltaFile
+205-15stand/efi/loader/main.c
+205-151 files

OPNSense/src 4979452stand/efi/loader main.c

loader.efi: |= the boot flags how

how is assumed to be 0, so we directly assign to it. It might not always
be 0, so or-in these bits.

Sponsored by:           Netflix
Reviewed by:            bz, andrew
Differential Revision:  https://reviews.freebsd.org/D47084

(cherry picked from commit 94164106c0a7e18b5ac7a1508fed179b6e6939f9)
DeltaFile
+2-2stand/efi/loader/main.c
+2-21 files

OPNSense/src eb684e5stand/efi/loader main.c

loader.efi: Make rsdp global

Make rsdp pointer to the RSDP global so we can look up other tables.

Sponsored by:           Netflix
Reviewed by:            andrew
Differential Revision:  https://reviews.freebsd.org/D47083

(cherry picked from commit c5f3a7f62217f20f0c7b2c4fc3fb2646336b0802)
DeltaFile
+5-1stand/efi/loader/main.c
+5-11 files

OPNSense/src f0c4525stand/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
+17-0stand/efi/loader/main.c
+8-0stand/efi/loader/bootinfo.c
+25-02 files

OPNSense/src 57db6f0stand/efi/loader main.c

Revert "loader.efi: Parse SPCR v3 and v4"

This reverts commit 501983e62e754d0b260c0dfe7f23042c89acd9f1.
DeltaFile
+7-17stand/efi/loader/main.c
+7-171 files

OPNSense/src aa47a49stand/efi/loader main.c

Revert "loader.efi: Only use SPCR if enabled."

This reverts commit 34c94bee0cee0cbf67e14d47809acc751fca8da5.
DeltaFile
+5-9stand/efi/loader/main.c
+5-91 files

OPNSense/src 8d3e14esys/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 3cbd64asys/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
+4-1sys/dev/axgbe/xgbe-mdio.c
+5-0sys/dev/axgbe/xgbe.h
+2-1sys/dev/axgbe/if_axgbe_pci.c
+1-1sys/dev/axgbe/xgbe-phy-v1.c
+111-456 files

OPNSense/src 2de9498sys/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
+108-10sys/netinet/ip_output.c
+39-48sys/netinet6/ip6_fastfwd.c
+28-46sys/netpfil/ipfw/ip_fw_pfil.c
+36-31sys/netinet6/ip6_forward.c
+28-37sys/netinet/ip_fastfwd.c
+375-1846 files not shown
+459-23712 files

OPNSense/src 0f0ca47sys/dev/axgbe xgbe-phy-v2.c if_axgbe_pci.c

axgbe: XXX leftovers to figure out

axgbe: several patches from 22.1 not yet present in FreeBSD
axgbe: remove old annotations and a bit of whitespace cleanup

This is a stub from applying f45a2d1e5a + b9eca9d898 on top of
the upstreamed changes.  The enable_rss remove is correct and
looks like an oversight in the upstreaming.  About the others
I'm not sure but since we have them on file here we can discuss
and rearrange.
DeltaFile
+4-0sys/dev/axgbe/xgbe-phy-v2.c
+0-1sys/dev/axgbe/if_axgbe_pci.c
+1-0sys/dev/axgbe/xgbe_osdep.h
+5-13 files

OPNSense/src b4c91bcsys/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 311f7dcsys/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 1932218sys/netinet ip_fastfwd.c

netinet6: fix shared forwarding new edge case
DeltaFile
+1-1sys/netinet/ip_fastfwd.c
+1-11 files

OPNSense/src 119b20asbin/ipfw ipv6.c ipfw2.c, sbin/ipfw/tests test_add_rule.py

ipfw: treat ipv6 address with zero mask as 'any'

Make the behaviour similar for both IPv4 and IPv6. Also add
the corresponding tests.

PR:             294733
Differential Revision:  https://reviews.freebsd.org/D56618

(cherry picked from commit 2872268c7f6d473aae9b02ebb5d2c24fc2cff9b1)
DeltaFile
+24-0sbin/ipfw/tests/test_add_rule.py
+7-4sbin/ipfw/ipv6.c
+4-3sbin/ipfw/ipfw2.c
+2-0tests/atf_python/sys/netpfil/ipfw/insns.py
+37-74 files

OPNSense/src d796c02sbin/ipfw15 ipfw2.c ipfw.8

ipfw: add ability to run ipfw(8) binary with 15.0+ kernel module

After D46183 the KBI was changed and this made the upgrade procedure
to 15.0+ version a bit difficult, because the old binary can not load
firewall rules when the new kernel is loaded.

This commit adds the sbin/ipfw15 binary that uses new KBI, and then
original sbin/ipfw can detect new KBI and run the new binary instead.

PR:             291562
Reviewed by:    jhb, glebius
Fixes:          4a77657cbc01
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D54763
DeltaFile
+6,129-0sbin/ipfw15/ipfw2.c
+5,094-0sbin/ipfw15/ipfw.8
+2,096-0sbin/ipfw15/tables.c
+2,016-0sbin/ipfw15/dummynet.c
+1,196-0sbin/ipfw15/nat.c
+1,172-0sbin/ipfw15/ip_fw15.h
+17,703-017 files not shown
+24,049-023 files

OPNSense/src e51ef05sys/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 cb52dbesys/netinet ip_divert.c

divert: Avoid using atomic_(load|store)_(acq|rel)_16

It's not implemented on some arches.  Use a plain int to count the
number of sockets in a divert lbgroup.

Reported by:    Jenkins
Fixes:          895a0ae67fe2 ("divert: Define semantics for SO_REUSEPORT_LB on divert sockets")
DeltaFile
+7-5sys/netinet/ip_divert.c
+7-51 files

OPNSense/src 879b6a4sys/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 b3b7b0esys/dev/axgbe xgbe-phy-v2.c if_axgbe_pci.c

axgbe: XXX leftovers to figure out

axgbe: several patches from 22.1 not yet present in FreeBSD
axgbe: remove old annotations and a bit of whitespace cleanup

This is a stub from applying f45a2d1e5a + b9eca9d898 on top of
the upstreamed changes.  The enable_rss remove is correct and
looks like an oversight in the upstreaming.  About the others
I'm not sure but since we have them on file here we can discuss
and rearrange.
DeltaFile
+4-0sys/dev/axgbe/xgbe-phy-v2.c
+0-1sys/dev/axgbe/if_axgbe_pci.c
+1-0sys/dev/axgbe/xgbe_osdep.h
+5-13 files

OPNSense/src 0d6ecdesys/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 6254eb7sys/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
+12-7sys/net/if_gre.c
+19-0sys/netinet/ip_input.c
+7-0sys/netinet6/frag6.c
+6-0sys/netinet6/ip6_output.c
+101-811 files not shown
+131-1017 files

OPNSense/src 33d28aelib/libsys getsockopt.2, share/man/man4 divert.4

divert: Define semantics for SO_REUSEPORT_LB on divert sockets

Allow SO_REUSEPORT_LB to be set on divert sockets.  If set, then bind()
will add the socket to a "load-balancing group".  When a divert-to rule
matches a port with an associated group, the corresponding state ID is
used to select a specific socket from the group.  Packets without an
associated state are simply forwarded to the first socket in the group.
For now I only pass a state ID from pf, as I couldn't see a useful
identifier on the ipfw side.

This implementation is simple but has a caveat, that being that if
sockets are added to the group while flows are being processed, the size
of the group will change and this changes the mapping of state IDs to
sockets.  So, to get a consistent mapping, the divert socket application
must bind all of its sockets before any traffic is diverted by the
firewall.

Reviewed by:    glebius
MFC after:      1 month

    [3 lines not shown]
DeltaFile
+143-17sys/netinet/ip_divert.c
+21-3share/man/man4/divert.4
+5-1lib/libsys/getsockopt.2
+1-1sys/netpfil/pf/pf.c
+1-1sys/netinet/ip_var.h
+1-1sys/netinet/raw_ip.c
+172-241 files not shown
+173-257 files

OPNSense/src 0c23c77sys/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 50ac3bfsys/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 1af4018usr.sbin/rtsold rtsol.c

rtsold: check RA lifetime before triggering the one-shot always script

Historic context: rtsold is used by *sense to get a router address which
wasn't originally the daemon's purpose.  We only ever get the first address
per interface lifetime so if the RA contains an invalid router with a zero
lifetime and we catch it we cannot get a valid one ever again.

This is suboptimal in a number of ways, but the obvious way to deal with
this is to ignore all RA messages from routers that do not advertise a
default route.

PR: https://github.com/opnsense/core/issues/9551
DeltaFile
+4-2usr.sbin/rtsold/rtsol.c
+4-21 files

OPNSense/src 886b4e5sys/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
+108-10sys/netinet/ip_output.c
+39-48sys/netinet6/ip6_fastfwd.c
+28-46sys/netpfil/ipfw/ip_fw_pfil.c
+36-31sys/netinet6/ip6_forward.c
+27-36sys/netinet/ip_fastfwd.c
+374-1836 files not shown
+458-23612 files

OPNSense/src e40be18sys/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 f0a8254sys/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
+37-2sys/netpfil/pf/pf.c
+3-1sys/net/pfvar.h
+40-32 files

OPNSense/src b6d3ed4sys/netpfil/ipfw dn_sched_fq_codel.c

dummynet: move these exessive logging messages under debug output
DeltaFile
+3-2sys/netpfil/ipfw/dn_sched_fq_codel.c
+3-21 files