summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-04-20 21:04:55 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2012-04-20 21:04:55 +0200
commit9b2b502be521b58a736f7b78644e89ee01b4418b (patch)
treeaccf66fc0b1186b5c3d8e0073857d647df6ab95c
parent3e17e380598b9a512bb369f51a4cf55da269f608 (diff)
Fixes missing device attributes when exporting routes to kernel.
Thanks to Howden Nick for the bugreport.
-rw-r--r--sysdep/linux/netlink/netlink.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sysdep/linux/netlink/netlink.c b/sysdep/linux/netlink/netlink.c
index c8eed0f3..2b0d7633 100644
--- a/sysdep/linux/netlink/netlink.c
+++ b/sysdep/linux/netlink/netlink.c
@@ -588,9 +588,9 @@ krt_capable(rte *e)
switch (a->dest)
{
case RTD_ROUTER:
- if (ipa_has_link_scope(a->gw) && (a->iface == NULL))
- return 0;
case RTD_DEVICE:
+ if (a->iface == NULL)
+ return 0;
case RTD_BLACKHOLE:
case RTD_UNREACHABLE:
case RTD_PROHIBIT:
@@ -653,20 +653,16 @@ nl_send_route(struct krt_proto *p, rte *e, struct ea_list *eattrs, int new)
if (ea = ea_find(eattrs, EA_KRT_REALM))
nl_add_attr_u32(&r.h, sizeof(r), RTA_FLOW, ea->u.data);
+ /* a->iface != NULL checked in krt_capable() for router and device routes */
+
switch (a->dest)
{
case RTD_ROUTER:
r.r.rtm_type = RTN_UNICAST;
+ nl_add_attr_u32(&r.h, sizeof(r), RTA_OIF, a->iface->index);
nl_add_attr_ipa(&r.h, sizeof(r), RTA_GATEWAY, a->gw);
-
- /* a->iface != NULL checked in krt_capable() */
- if (ipa_has_link_scope(a->gw))
- nl_add_attr_u32(&r.h, sizeof(r), RTA_OIF, a->iface->index);
-
break;
case RTD_DEVICE:
- if (!a->iface)
- return -1;
r.r.rtm_type = RTN_UNICAST;
nl_add_attr_u32(&r.h, sizeof(r), RTA_OIF, a->iface->index);
break;