summaryrefslogtreecommitdiffstats
path: root/sysdep/linux
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2011-10-06 22:48:49 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2011-10-06 22:48:49 +0200
commit32f95476a8d60508ca9d24fe20b09899b72de9d7 (patch)
tree84c2084a43f5c76e5feff07a3b8cafb521d067f1 /sysdep/linux
parent35c875f0d1eb7c72e0b0ab8a90eb32cbcbfdac02 (diff)
downloadbird-32f95476a8d60508ca9d24fe20b09899b72de9d7.tar
bird-32f95476a8d60508ca9d24fe20b09899b72de9d7.zip
Signal problems with route installation to kernel tables.
Diffstat (limited to 'sysdep/linux')
-rw-r--r--sysdep/linux/netlink/netlink.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c
index 0830097..f8a5d63 100644
--- a/sysdep/linux/netlink/netlink.c
+++ b/sysdep/linux/netlink/netlink.c
@@ -198,7 +198,7 @@ nl_exchange(struct nlmsghdr *pkt)
break;
log(L_WARN "nl_exchange: Unexpected reply received");
}
- return nl_error(h);
+ return nl_error(h) ? -1 : 0;
}
/*
@@ -616,7 +616,7 @@ nh_bufsize(struct mpnh *nh)
return rv;
}
-static void
+static int
nl_send_route(struct krt_proto *p, rte *e, int new)
{
eattr *ea;
@@ -663,7 +663,7 @@ nl_send_route(struct krt_proto *p, rte *e, int new)
break;
case RTD_DEVICE:
if (!a->iface)
- return;
+ return -1;
r.r.rtm_type = RTN_UNICAST;
nl_add_attr_u32(&r.h, sizeof(r), RTA_OIF, a->iface->index);
break;
@@ -684,17 +684,24 @@ nl_send_route(struct krt_proto *p, rte *e, int new)
bug("krt_capable inconsistent with nl_send_route");
}
- nl_exchange(&r.h);
+ return nl_exchange(&r.h);
}
void
-krt_set_notify(struct krt_proto *p, net *n UNUSED, rte *new, rte *old)
+krt_set_notify(struct krt_proto *p, net *n, rte *new, rte *old)
{
+ int err = 0;
+
if (old)
nl_send_route(p, old, 0);
if (new)
- nl_send_route(p, new, 1);
+ err = nl_send_route(p, new, 1);
+
+ if (err < 0)
+ n->n.flags |= KRF_SYNC_ERROR;
+ else
+ n->n.flags &= ~KRF_SYNC_ERROR;
}