Commit 2ec5bf4c authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Kernel calls back into babel only when routes don't cocome from us.

parent a903a1f3
...@@ -340,6 +340,7 @@ netlink_listen(int (*monitor)(struct nlmsghdr *nh, void *data), void *data) { ...@@ -340,6 +340,7 @@ netlink_listen(int (*monitor)(struct nlmsghdr *nh, void *data), void *data) {
struct iovec iov; struct iovec iov;
struct nlmsghdr *nh; struct nlmsghdr *nh;
int len, i; int len, i;
int interesting = 0;
static char buf[8192]; static char buf[8192];
...@@ -405,14 +406,15 @@ netlink_listen(int (*monitor)(struct nlmsghdr *nh, void *data), void *data) { ...@@ -405,14 +406,15 @@ netlink_listen(int (*monitor)(struct nlmsghdr *nh, void *data), void *data) {
if(monitor) { if(monitor) {
err = monitor(nh,data); err = monitor(nh,data);
if(err) return err; if(err < 0) return err;
interesting = interesting || err;
} }
} }
if(msg.msg_flags & MSG_TRUNC) { if(msg.msg_flags & MSG_TRUNC) {
fprintf(stderr, "netlink_listen: Message truncated\n"); fprintf(stderr, "netlink_listen: Message truncated\n");
} }
return 0; return interesting;
} }
int int
...@@ -712,10 +714,16 @@ monitor_kernel_route(struct nlmsghdr *nh, void *data) ...@@ -712,10 +714,16 @@ monitor_kernel_route(struct nlmsghdr *nh, void *data)
rtm = (struct rtmsg*)NLMSG_DATA(nh); rtm = (struct rtmsg*)NLMSG_DATA(nh);
len -= NLMSG_LENGTH(0); len -= NLMSG_LENGTH(0);
if(rtm->rtm_protocol == RTPROT_BOOT || rtm->rtm_protocol == RTPROT_BABEL)
return 0;
if(debug >= 2) {
parse_kernel_route_rta(rtm, len, &route); parse_kernel_route_rta(rtm, len, &route);
print_kernel_route(nh->nlmsg_type, rtm->rtm_protocol, print_kernel_route(nh->nlmsg_type, rtm->rtm_protocol,
rtm->rtm_type, &route); rtm->rtm_type, &route);
return 0; }
return 1;
} }
static int static int
......
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