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 /net/ipv6/ndisc.c | |
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>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r-- | net/ipv6/ndisc.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 |