Linux kernel module to control bypass on network segments managed by custom bpctl bridges.
Hooks into the kernel’s AF_PACKET notifier via a kprobe to monitor network device events.
When a link goes down on a master or slave interface of a bpctl bridge, it triggers the bpctl ioctl to enable bypass on that segment.
Additionally, it supports hot-add of interfaces by detecting NETDEV_UP events to dynamically include new interfaces in the bpctl bridge management.
No polling. No kernel network stack modifications. Just hooking and reacting.
- Registers a kprobe on
packet_notifier(the AF_PACKET kernel notifier function). - On netdevice events, the kprobe pre-handler runs before
packet_notifier. - Checks if the device is part of a bpctl bridge interface pair.
- If a
NETDEV_CHANGEevent with link down (__LINK_STATE_NOCARRIER) is detected:- Schedules deferred work to run outside interrupt context.
- Work calls
bpctl_kernel_ioctlwithSET_BYPASSon the master interface.
- On load, scans all network devices to build a list of bpctl bridge interface pairs (master/slave/bridge).
./build.shGPL v2
Miguel Álvarez [email protected]