Commit a903a1f3 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Call back into babel when a route changes.

parent 458af5c3
......@@ -79,6 +79,7 @@ struct network *add_network(char *ifname, int ifindex, int bufsize,
int wired, unsigned int cost, int hello_interval);
void expire_routes(void);
static int kernel_routes_changed(void *closure);
static void init_signals(void);
static void dump_tables(FILE *out);
......@@ -407,7 +408,7 @@ main(int argc, char **argv)
break;
if(kernel_socket >= 0 && FD_ISSET(kernel_socket, &readfds)) {
kernel_callback();
kernel_callback(kernel_routes_changed, NULL);
}
if(FD_ISSET(protocol_socket, &readfds)) {
......@@ -620,6 +621,12 @@ dump_tables(FILE *out)
fflush(out);
}
static int
kernel_routes_changed(void *closure)
{
return 0;
}
struct network *
add_network(char *ifname, int ifindex, int mtu,
int wired, unsigned int cost, int hello_interval)
......
......@@ -790,10 +790,16 @@ kernel_routes(int maxplen, struct kernel_route *routes, int maxroutes)
}
int
kernel_callback()
kernel_callback(int (*fn)(void*), void *closure)
{
int rc;
if(nl_listen.sock < 0)
return -1;
return netlink_listen(monitor_kernel_route, NULL);
rc = netlink_listen(monitor_kernel_route, NULL);
if(rc)
return fn(closure);
return 0;
}
......@@ -42,4 +42,4 @@ int kernel_route(int operation, const unsigned char *dest, unsigned short plen,
const unsigned char *gate, int ifindex,
unsigned int metric, unsigned int newmetric);
int kernel_routes(int maxplen, struct kernel_route *routes, int maxroutes);
int kernel_callback(void);
int kernel_callback(int (*fn)(void*), void *closure);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment