5e1a59d5 | 20-Mar-2024 |
Aaron LI <aly@aaronly.me> |
netinet: Improve the deletion of loopback route
When the target host address is still bound to another interface address (e.g., an address on another interface added later), the loopback route shoul
netinet: Improve the deletion of loopback route
When the target host address is still bound to another interface address (e.g., an address on another interface added later), the loopback route should be updated to point to that address instead of simply being removed.
Given that our rtrequest1() only supports route addition and deletion, but not route change, we have to first remove the original loopback route and then re-add a route with the wanted interface address.
See also in_localip_more() and ifa_switch_loopback_route() in FreeBSD.
show more ...
|
951ecd7f | 18-Mar-2024 |
Aaron LI <aly@aaronly.me> |
netinet: Auto add loopback routes to interface addresses
When adding an address to an interface, a loopback route will be created to route the traffic targeting it through the lo0 interface. The lo
netinet: Auto add loopback routes to interface addresses
When adding an address to an interface, a loopback route will be created to route the traffic targeting it through the lo0 interface. The loopback route will also be removed when the corresponding interface address is deleted.
In principle, this can help simplify the network input and output paths by avoiding special handling of local addresses. That deserves some further efforts.
Nonetheless, an immediate benefit goes to wg(4). Now we can access (e.g., ping) from localhost a wg(4) interface's IPv4 addresses. Previously it was broken because wg(4) is a virtual device and doesn't have/use ARP. For Ethernet devices, the ether_output() function will redirect the traffic targeting its own address to the loopback interface by calling if_simloop().
Derived from FreeBSD; the major commits are: - This patch adds a host route to an interface address ... https://github.com/freebsd/freebsd-src/commit/ebc90701ac6c1f814c5bd6f3e19f0113ebe06156 - Self pointing routes are installed for configured interface addr ... https://github.com/freebsd/freebsd-src/commit/9bb7d0f47a3265a1782a64837ae93dde4c550a6a - Unify loopback route switching https://github.com/freebsd/freebsd-src/commit/59c180c35c1ddc1d544a1c73c789d126a8fbac78 - Fix rt_ifa selection during loopback route insertion process https://github.com/freebsd/freebsd-src/commit/2ad7ed6e4a84448234e9aaef3c9fa884848f7387
Discussed-with: dillon
show more ...
|
22dac581 | 27-Jun-2023 |
Aaron LI <aly@aaronly.me> |
net/radix: Add 'const' qualifier to input key/netmask
They're only referenced in the radix tree and wouldn't be modified, so add 'const' qualifier to make it clear.
Adjust callers for this change a
net/radix: Add 'const' qualifier to input key/netmask
They're only referenced in the radix tree and wouldn't be modified, so add 'const' qualifier to make it clear.
Adjust callers for this change accordingly.
Referred to FreeBSD.
show more ...
|
2ba12c9c | 09-Jul-2023 |
Matthew Dillon <dillon@apollo.backplane.com> |
network - Remove ip_len header-length adjustment
* This should remove the last main code path modifications to packet mbuf contents. The IP header in the mbuf is now basically left alone whenev
network - Remove ip_len header-length adjustment
* This should remove the last main code path modifications to packet mbuf contents. The IP header in the mbuf is now basically left alone whenever possible, bringing us in-line with FreeBSD and Linux and removing cache-line bounces between cpus and between a cpu and the related PCIe DMA.
* Do not adjust ip_len to remove the IP header length.
* Various protocol stacks do the subtraction themselves, when needed.
* Various bits of code that added the length back in to execute a function then removed it again cleaned up.
* IP reassembly (in ip_input.c and pf_norm.c) cleaned up.
show more ...
|