aboutsummaryrefslogtreecommitdiffstats
path: root/main/opennhrp/fix-shortcut-route-table-2.patch
blob: 2e3c08cf3766b64167621a51b0e12d7167159417 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;