a77facd2 | 01-Jun-2023 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
ifnet: consistently call hooks when the interface gets up.
Some context on the current IPv6 interface setup & address management:
There are two data path for IPv6 initialisation in context of assig
ifnet: consistently call hooks when the interface gets up.
Some context on the current IPv6 interface setup & address management:
There are two data path for IPv6 initialisation in context of assigning LL addresses: 1) Userland explicitly requests IFF_UP for the interface w/o any addresses. if_up() then calls in6_if_up(), which calls in6_ifattach(). The latter sets up some initial ND/IN6 state and disables IPv6 for the interface if it’s not loopback. If the interface is loopback, then it adds ::1/128 and LL addresses via in6_ifattach_loopback(). Then, devd notification is generated (if the VNET is the default one), which triggers rc.network ifconfig_up(), causing ifdisabled to be removed via SIOCSIFINFO_IN6 from ifconfig. The kernel SIOCSIFINFO_IN6 handler calls in6_if_up() once again and it assigns the interface link-local address.
2) Userland adds IPv4 or IPv6 address to the interface. SIOCAIFADDR[_IN6] kernel handler calls IPv4/IPv6 protocol handler to add the address. Both then call if_ioctl() with SIOCSIFADDR. Ethernet/loopback ioctl handlers silently sets IFF_UP for the interface. Finally, if.c:ifioctl() wrapper code compares old and new interface flags and, if IFF_UP is added, it explicitly calls in6_if_up(), which adds link-local address if either the original address is IPv6 or the interface is loopback.
In the latter case, “formal” interface-up notifications are missing. The kernel does not trigger event handler event, does not call carp hook and does not provide any userland notification.
This diff unifies the event handling in both scenarios, providing the necessary notifications to the kernel and userland.
Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D40332 MFC after: 2 weeks
show more ...
|
d1871547 | 31-May-2023 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netlink: use custom uma zone for the mbuf storage.
Netlink communicates with userland via sockets, utilising MCLBYTES-sized mbufs to append data to the socket buffers. These mbufs are never transmi
netlink: use custom uma zone for the mbuf storage.
Netlink communicates with userland via sockets, utilising MCLBYTES-sized mbufs to append data to the socket buffers. These mbufs are never transmitted via logical or physical network.
It may be possible that the 2k mbuf zone is temporary exhausted due to the DDoS-style traffic, leading to Netlink failure to respond to the requests.
To address it, this change introduces a custom Netlink-specific zone for the mbuf storage. It has the following benefits: * no precious memory from UMA_ZONE_CONTIG zones is utilized for Netlink * Netlink becomes (more) independent from the traffic spikes and other related network "corner" conditions. * Netlink allocations are now isolated within a specific zone, making it easier to track Netlink mbuf usage and attribute mbufs.
Reviewed by: gallatin, adrian Differential Revision: https://reviews.freebsd.org/D40356 MFC after: 2 weeks
show more ...
|
30d0fc6f | 10-May-2023 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netlink: export more IPv6 ifa info
* Fill in IFA_CACHEINFO with prefix lifetime data * Map IPv6 IN6_IFF_ flags to Netlink IFA_F_ flags * Store original ia6_flags in the FreeBSD-specific IFAF_FLAGS f
netlink: export more IPv6 ifa info
* Fill in IFA_CACHEINFO with prefix lifetime data * Map IPv6 IN6_IFF_ flags to Netlink IFA_F_ flags * Store original ia6_flags in the FreeBSD-specific IFAF_FLAGS field
MFC after: 2 weeks
show more ...
|
88bd9ef6 | 09-May-2023 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netlink: automatically fill sin6_scope_id in the default snl(3) parsers.
Add the optional post-parse hook to the snl(3) parser declaration. Use this hook to automatically add the interface indexes t
netlink: automatically fill sin6_scope_id in the default snl(3) parsers.
Add the optional post-parse hook to the snl(3) parser declaration. Use this hook to automatically add the interface indexes to the link-local sockaddrs.
MFC after: 2 weeks
show more ...
|