Skip to content

Linux kernel module that hooks into the AF_PACKET kernel notifier via kprobes to monitor bpctl bridge interfaces and automatically enable bypass on link-down events.

License

Notifications You must be signed in to change notification settings

redBorder/kernel-bpcontroller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kernel-bpcontroller

Linux kernel module to control bypass on network segments managed by custom bpctl bridges.

What it does

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.

How it works

  • 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_CHANGE event with link down (__LINK_STATE_NOCARRIER) is detected:
    • Schedules deferred work to run outside interrupt context.
    • Work calls bpctl_kernel_ioctl with SET_BYPASS on the master interface.
  • On load, scans all network devices to build a list of bpctl bridge interface pairs (master/slave/bridge).

Build RPM (RHEL9)

./build.sh

License

GPL v2

Author

Miguel Álvarez [email protected]

About

Linux kernel module that hooks into the AF_PACKET kernel notifier via kprobes to monitor bpctl bridge interfaces and automatically enable bypass on link-down events.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published