diff options
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r-- | net/ipv6/ndisc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 510aa747a404..53b546019fd5 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1092,6 +1092,12 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1092 | return; | 1092 | return; |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | if (skb->ndisc_nodetype == NDISC_NODETYPE_HOST) { | ||
1096 | ND_PRINTK2(KERN_WARNING | ||
1097 | "ICMPv6 RA: from host or unauthorized router\n"); | ||
1098 | return; | ||
1099 | } | ||
1100 | |||
1095 | /* | 1101 | /* |
1096 | * set the RA_RECV flag in the interface | 1102 | * set the RA_RECV flag in the interface |
1097 | */ | 1103 | */ |
@@ -1115,6 +1121,10 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1115 | return; | 1121 | return; |
1116 | } | 1122 | } |
1117 | 1123 | ||
1124 | /* skip link-specific parameters from interior routers */ | ||
1125 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) | ||
1126 | goto skip_linkparms; | ||
1127 | |||
1118 | if (in6_dev->if_flags & IF_RS_SENT) { | 1128 | if (in6_dev->if_flags & IF_RS_SENT) { |
1119 | /* | 1129 | /* |
1120 | * flag that an RA was received after an RS was sent | 1130 | * flag that an RA was received after an RS was sent |
@@ -1229,6 +1239,8 @@ skip_defrtr: | |||
1229 | } | 1239 | } |
1230 | } | 1240 | } |
1231 | 1241 | ||
1242 | skip_linkparms: | ||
1243 | |||
1232 | /* | 1244 | /* |
1233 | * Process options. | 1245 | * Process options. |
1234 | */ | 1246 | */ |
@@ -1268,6 +1280,10 @@ skip_defrtr: | |||
1268 | } | 1280 | } |
1269 | #endif | 1281 | #endif |
1270 | 1282 | ||
1283 | /* skip link-specific ndopts from interior routers */ | ||
1284 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) | ||
1285 | goto out; | ||
1286 | |||
1271 | if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) { | 1287 | if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) { |
1272 | struct nd_opt_hdr *p; | 1288 | struct nd_opt_hdr *p; |
1273 | for (p = ndopts.nd_opts_pi; | 1289 | for (p = ndopts.nd_opts_pi; |
@@ -1331,6 +1347,14 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1331 | int optlen; | 1347 | int optlen; |
1332 | u8 *lladdr = NULL; | 1348 | u8 *lladdr = NULL; |
1333 | 1349 | ||
1350 | switch (skb->ndisc_nodetype) { | ||
1351 | case NDISC_NODETYPE_HOST: | ||
1352 | case NDISC_NODETYPE_NODEFAULT: | ||
1353 | ND_PRINTK2(KERN_WARNING | ||
1354 | "ICMPv6 Redirect: from host or unauthorized router\n"); | ||
1355 | return; | ||
1356 | } | ||
1357 | |||
1334 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { | 1358 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { |
1335 | ND_PRINTK2(KERN_WARNING | 1359 | ND_PRINTK2(KERN_WARNING |
1336 | "ICMPv6 Redirect: source address is not link-local.\n"); | 1360 | "ICMPv6 Redirect: source address is not link-local.\n"); |