-
Notifications
You must be signed in to change notification settings - Fork 435
babeld: send events via ubus #633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I try upstreaming the change in babeld: |
|
@kerneis This is what I mean with sending notifications on the bus. Now I just receive the part I need. Polling would require babeld to create each time probably thousands of messages. With updates I can just check the updates. For example, I can check if a certain prefix is announced, by just looking add the "route.add" methods. Maybe it would be interesting to create objects or to make more options allowing a more fine grade decision what to send over the ubus bus. |
Send a notification via the ubus bus if we experience any changes in
neighbours, routes or xroutes.
The format looks like this:
{route,xroute,neighbour}.add: Object was added
{route,xroute,neighbour}.change: Object was changed
{route,xroute,neighbour}.flush: Object was flushed
If ubus_bindings is turned off, it will minimally effect performance,
since only an if-statement has to be evaluated.
If no subscriber is available, it will minimally change the performance,
since only an if-statmenet that checks for subscribers has to be
evaluated.
Signed-off-by: Nick Hainke <vincent@systemli.org>
|
I wrote some small daemon that shows how to connect to the ubus interface and process the data: More logic will follow soon. |
kerneis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me with a few minor comments.
babeld/src/ubus.c
Outdated
|
|
||
| blob_buf_init(&b, 0); | ||
| babeld_add_route_buf(route, &b); | ||
| sprintf(method, "route.%s", local_kind(kind)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use snprintf(method, sizeof(method), ...), I'm paranoid about buffer overflow. Idem below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True story. :)
babeld/src/ubus.c
Outdated
|
|
||
| void ubus_notify_route(struct babel_route *route, int kind) { | ||
| struct blob_buf b = {0}; | ||
| char method[13]; // max is route.change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
char method[sizeof("route.change")]; // possible methods are route.change, route.add, route.flush
Idem below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just use a largish value and don't bother (50, 100)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will just go for 50. ;)
|
Probably I will rewrite "a lot of stuff" again, if this is merged upstream: |
Send a notification via the ubus bus if we experience any changes in neighbors, routes or xroutes.
The format looks like this:
If ubus_bindings is turned off, it will minimally effect performance, since only an if-statement has to be evaluated. If no subscriber is available, it will minimally change the performance, since only an if-statmenet that checks for subscribers has to be evaluated.