diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-03-15 23:59:18 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-04-02 21:06:01 -0400 |
commit | de357cc01334a468e4d5b7ba66a17b0d3ca9d63e (patch) | |
tree | 8cae8de67f575dac77c265bf061f46820d6b8c68 | |
parent | 52eeeb8481d705e61e2e9aae974e7799a93783e9 (diff) |
[IPV6] NDISC: Don't rely on node-type hint from L2 unless required.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
-rw-r--r-- | include/linux/skbuff.h | 2 | ||||
-rw-r--r-- | net/ipv6/Kconfig | 4 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 10 |
3 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e10e55c9b081..e517701c25ba 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -313,7 +313,9 @@ struct sk_buff { | |||
313 | __u16 tc_verd; /* traffic control verdict */ | 313 | __u16 tc_verd; /* traffic control verdict */ |
314 | #endif | 314 | #endif |
315 | #endif | 315 | #endif |
316 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | ||
316 | __u8 ndisc_nodetype:2; | 317 | __u8 ndisc_nodetype:2; |
318 | #endif | ||
317 | /* 14 bit hole */ | 319 | /* 14 bit hole */ |
318 | 320 | ||
319 | #ifdef CONFIG_NET_DMA | 321 | #ifdef CONFIG_NET_DMA |
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index 47263e45bacb..7d2e7f0941ac 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
@@ -168,6 +168,7 @@ config IPV6_SIT | |||
168 | tristate "IPv6: IPv6-in-IPv4 tunnel (SIT driver)" | 168 | tristate "IPv6: IPv6-in-IPv4 tunnel (SIT driver)" |
169 | depends on IPV6 | 169 | depends on IPV6 |
170 | select INET_TUNNEL | 170 | select INET_TUNNEL |
171 | select IPV6_NDISC_NODETYPE | ||
171 | default y | 172 | default y |
172 | ---help--- | 173 | ---help--- |
173 | Tunneling means encapsulating data of one protocol type within | 174 | Tunneling means encapsulating data of one protocol type within |
@@ -178,6 +179,9 @@ config IPV6_SIT | |||
178 | 179 | ||
179 | Saying M here will produce a module called sit.ko. If unsure, say Y. | 180 | Saying M here will produce a module called sit.ko. If unsure, say Y. |
180 | 181 | ||
182 | config IPV6_NDISC_NODETYPE | ||
183 | bool | ||
184 | |||
181 | config IPV6_TUNNEL | 185 | config IPV6_TUNNEL |
182 | tristate "IPv6: IP-in-IPv6 tunnel (RFC2473)" | 186 | tristate "IPv6: IP-in-IPv6 tunnel (RFC2473)" |
183 | select INET6_TUNNEL | 187 | select INET6_TUNNEL |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 16273e11e53d..c400b874097a 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1092,11 +1092,13 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1092 | return; | 1092 | return; |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | ||
1095 | if (skb->ndisc_nodetype == NDISC_NODETYPE_HOST) { | 1096 | if (skb->ndisc_nodetype == NDISC_NODETYPE_HOST) { |
1096 | ND_PRINTK2(KERN_WARNING | 1097 | ND_PRINTK2(KERN_WARNING |
1097 | "ICMPv6 RA: from host or unauthorized router\n"); | 1098 | "ICMPv6 RA: from host or unauthorized router\n"); |
1098 | return; | 1099 | return; |
1099 | } | 1100 | } |
1101 | #endif | ||
1100 | 1102 | ||
1101 | /* | 1103 | /* |
1102 | * set the RA_RECV flag in the interface | 1104 | * set the RA_RECV flag in the interface |
@@ -1121,9 +1123,11 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1121 | return; | 1123 | return; |
1122 | } | 1124 | } |
1123 | 1125 | ||
1126 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | ||
1124 | /* skip link-specific parameters from interior routers */ | 1127 | /* skip link-specific parameters from interior routers */ |
1125 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) | 1128 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) |
1126 | goto skip_linkparms; | 1129 | goto skip_linkparms; |
1130 | #endif | ||
1127 | 1131 | ||
1128 | if (in6_dev->if_flags & IF_RS_SENT) { | 1132 | if (in6_dev->if_flags & IF_RS_SENT) { |
1129 | /* | 1133 | /* |
@@ -1239,7 +1243,9 @@ skip_defrtr: | |||
1239 | } | 1243 | } |
1240 | } | 1244 | } |
1241 | 1245 | ||
1246 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | ||
1242 | skip_linkparms: | 1247 | skip_linkparms: |
1248 | #endif | ||
1243 | 1249 | ||
1244 | /* | 1250 | /* |
1245 | * Process options. | 1251 | * Process options. |
@@ -1286,9 +1292,11 @@ skip_linkparms: | |||
1286 | } | 1292 | } |
1287 | #endif | 1293 | #endif |
1288 | 1294 | ||
1295 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | ||
1289 | /* skip link-specific ndopts from interior routers */ | 1296 | /* skip link-specific ndopts from interior routers */ |
1290 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) | 1297 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) |
1291 | goto out; | 1298 | goto out; |
1299 | #endif | ||
1292 | 1300 | ||
1293 | if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) { | 1301 | if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) { |
1294 | struct nd_opt_hdr *p; | 1302 | struct nd_opt_hdr *p; |
@@ -1353,6 +1361,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1353 | int optlen; | 1361 | int optlen; |
1354 | u8 *lladdr = NULL; | 1362 | u8 *lladdr = NULL; |
1355 | 1363 | ||
1364 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | ||
1356 | switch (skb->ndisc_nodetype) { | 1365 | switch (skb->ndisc_nodetype) { |
1357 | case NDISC_NODETYPE_HOST: | 1366 | case NDISC_NODETYPE_HOST: |
1358 | case NDISC_NODETYPE_NODEFAULT: | 1367 | case NDISC_NODETYPE_NODEFAULT: |
@@ -1360,6 +1369,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1360 | "ICMPv6 Redirect: from host or unauthorized router\n"); | 1369 | "ICMPv6 Redirect: from host or unauthorized router\n"); |
1361 | return; | 1370 | return; |
1362 | } | 1371 | } |
1372 | #endif | ||
1363 | 1373 | ||
1364 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { | 1374 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { |
1365 | ND_PRINTK2(KERN_WARNING | 1375 | ND_PRINTK2(KERN_WARNING |