xdp-tutorial
xdp-tutorial copied to clipboard
bpf_fib_lookup write equivalent?
Is there a way to write into the kernel table? The only option currently that I see is to poll a map from userspace and do a write then, or?
Polynomdivision [email protected] writes:
Is there a way to write into the kernel table?
Not from BPF; you'd need to do that from userspace.
The only option currently that I see is to poll a map and do a write then, or?
To do what? What, exactly, is your use case?
To do what? What, exactly, is your use case?
We switched in our community wireless mesh network (freifunk) to babeld and I would like to interact with the daemon. :) Typically, you use some proto number and install a redistribute route for that proto. Here, I would like for example just install a "/128" route for a new client, if I see some IP from another prefix on the client interface, so layer 3 roaming works.
So I would probably write into a map and just poll it and use netlink to interace with kernel again... ^^ But this takes unnecessary CPU, or? Or is there some mechanism I can use that just interacts if new data is available in a map?
BTW, I have no idea if this will work but I heard other people do similar things to enable layer 3 roaming. xD
Polynomdivision [email protected] writes:
To do what? What, exactly, is your use case?
We switched in our community wireless mesh network (freifunk) to babeld and I would like to interact with the daemon. :) Typically, you use some proto number and install a redistribute route for that proto. Here, I would like for example just install a "/128" route for a new client, if I see some IP from another prefix on the client interface, so layer 3 raoming works.
Ah, I see. For that I'd suggest using the bpf_perf_event_output() helper to send events to userspace. You can have a userspace process that listens for those events and updates the routing table accordingly.
The pping program does something similar to output its data points. See the sender side in XDP here:
https://github.com/xdp-project/bpf-examples/blob/master/pping/pping_kern_xdp.c#L57
And the userspace reader side here: https://github.com/xdp-project/bpf-examples/blob/master/pping/pping.c#L392
Polynomdivision [email protected] writes:
BTW, I have no idea if this will work but I heard other people do similar things to enable layer 3 roaming. xD
Are you aware of https://alioth-lists.debian.net/pipermail/babel-users/2020-April/003692.html ?
I was not aware of that. Wow, thanks! :)