From a7288181001144b4d44c4265624828045b80f988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Sat, 19 Apr 2014 19:13:04 +0300 Subject: [PATCH] netlink: additional fixes to route-table matching (fix previous commit) --- nhrp/sysdep_netlink.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/nhrp/sysdep_netlink.c b/nhrp/sysdep_netlink.c index 44063ad..74907bb 100644 --- a/nhrp/sysdep_netlink.c +++ b/nhrp/sysdep_netlink.c @@ -738,13 +738,15 @@ static void netlink_route_new(struct nlmsghdr *msg) return; if (iface->flags & NHRP_INTERFACE_FLAG_SHORTCUT_DEST) { - /* Local shortcut target routes */ - if (rtm->rtm_table != iface->route_table) + /* Off-NBMA bound routes, include kernel subnet + * routes, and anything routing table. */ + if (rtm->rtm_table != iface->route_table && + rtm->rtm_protocol != RTPROT_KERNEL) return; type = NHRP_PEER_TYPE_LOCAL_ADDR; } else if (iface->flags & NHRP_INTERFACE_FLAG_CONFIGURED) { - /* Routes which might get additional outbound - * shortcuts */ + /* In-NBMA bound routes, include only specifed table + * and only non-kernel created routes */ if (rtm->rtm_table != iface->route_table || rtm->rtm_protocol == RTPROT_KERNEL) return; @@ -792,13 +794,15 @@ static void netlink_route_del(struct nlmsghdr *msg) return; if (iface->flags & NHRP_INTERFACE_FLAG_SHORTCUT_DEST) { - /* Local shortcut target routes */ - if (rtm->rtm_table != RT_TABLE_MAIN) + /* Off-NBMA bound routes, include kernel subnet + * routes, and anything routing table. */ + if (rtm->rtm_table != iface->route_table && + rtm->rtm_protocol != RTPROT_KERNEL) return; type = NHRP_PEER_TYPE_LOCAL_ADDR; } else if (iface->flags & NHRP_INTERFACE_FLAG_CONFIGURED) { - /* Routes which might get additional outbound - * shortcuts */ + /* In-NBMA bound routes, include only specifed table + * and only non-kernel created routes */ if (rtm->rtm_table != iface->route_table || rtm->rtm_protocol == RTPROT_KERNEL) return; -- 2.4.6