diff options
-rw-r--r-- | Documentation/networking/ip-sysctl.txt | 9 | ||||
-rw-r--r-- | include/linux/ipv6.h | 4 | ||||
-rw-r--r-- | include/linux/sysctl.h | 1 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 19 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 4 |
5 files changed, 36 insertions, 1 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 88efed0a533f..35aed1c6dd98 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -729,6 +729,15 @@ accept_ra_pinfo - BOOLEAN | |||
729 | Functional default: enabled if accept_ra is enabled. | 729 | Functional default: enabled if accept_ra is enabled. |
730 | disabled if accept_ra is disabled. | 730 | disabled if accept_ra is disabled. |
731 | 731 | ||
732 | accept_ra_rt_info_max_plen - INTEGER | ||
733 | Maximum prefix length of Route Information in RA. | ||
734 | |||
735 | Route Information w/ prefix larger than or equal to this | ||
736 | variable shall be ignored. | ||
737 | |||
738 | Functional default: 0 if accept_ra_rtr_pref is enabled. | ||
739 | -1 if accept_ra_rtr_pref is disabled. | ||
740 | |||
732 | accept_ra_rtr_pref - BOOLEAN | 741 | accept_ra_rtr_pref - BOOLEAN |
733 | Accept Router Preference in RA. | 742 | Accept Router Preference in RA. |
734 | 743 | ||
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index c609cc702375..1263d8cb3c18 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -150,6 +150,9 @@ struct ipv6_devconf { | |||
150 | #ifdef CONFIG_IPV6_ROUTER_PREF | 150 | #ifdef CONFIG_IPV6_ROUTER_PREF |
151 | __s32 accept_ra_rtr_pref; | 151 | __s32 accept_ra_rtr_pref; |
152 | __s32 rtr_probe_interval; | 152 | __s32 rtr_probe_interval; |
153 | #ifdef CONFIG_IPV6_ROUTE_INFO | ||
154 | __s32 accept_ra_rt_info_max_plen; | ||
155 | #endif | ||
153 | #endif | 156 | #endif |
154 | void *sysctl; | 157 | void *sysctl; |
155 | }; | 158 | }; |
@@ -177,6 +180,7 @@ enum { | |||
177 | DEVCONF_ACCEPT_RA_PINFO, | 180 | DEVCONF_ACCEPT_RA_PINFO, |
178 | DEVCONF_ACCEPT_RA_RTR_PREF, | 181 | DEVCONF_ACCEPT_RA_RTR_PREF, |
179 | DEVCONF_RTR_PROBE_INTERVAL, | 182 | DEVCONF_RTR_PROBE_INTERVAL, |
183 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, | ||
180 | DEVCONF_MAX | 184 | DEVCONF_MAX |
181 | }; | 185 | }; |
182 | 186 | ||
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index f49488ffefef..8ad4beab2888 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -535,6 +535,7 @@ enum { | |||
535 | NET_IPV6_ACCEPT_RA_PINFO=19, | 535 | NET_IPV6_ACCEPT_RA_PINFO=19, |
536 | NET_IPV6_ACCEPT_RA_RTR_PREF=20, | 536 | NET_IPV6_ACCEPT_RA_RTR_PREF=20, |
537 | NET_IPV6_RTR_PROBE_INTERVAL=21, | 537 | NET_IPV6_RTR_PROBE_INTERVAL=21, |
538 | NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22, | ||
538 | __NET_IPV6_MAX | 539 | __NET_IPV6_MAX |
539 | }; | 540 | }; |
540 | 541 | ||
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index e7add61e6e39..eb82cd5df8c6 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -170,6 +170,9 @@ struct ipv6_devconf ipv6_devconf = { | |||
170 | #ifdef CONFIG_IPV6_ROUTER_PREF | 170 | #ifdef CONFIG_IPV6_ROUTER_PREF |
171 | .accept_ra_rtr_pref = 1, | 171 | .accept_ra_rtr_pref = 1, |
172 | .rtr_probe_interval = 60 * HZ, | 172 | .rtr_probe_interval = 60 * HZ, |
173 | #ifdef CONFIG_IPV6_ROUTE_INFO | ||
174 | .accept_ra_rt_info_max_plen = 0, | ||
175 | #endif | ||
173 | #endif | 176 | #endif |
174 | }; | 177 | }; |
175 | 178 | ||
@@ -197,6 +200,9 @@ static struct ipv6_devconf ipv6_devconf_dflt = { | |||
197 | #ifdef CONFIG_IPV6_ROUTER_PREF | 200 | #ifdef CONFIG_IPV6_ROUTER_PREF |
198 | .accept_ra_rtr_pref = 1, | 201 | .accept_ra_rtr_pref = 1, |
199 | .rtr_probe_interval = 60 * HZ, | 202 | .rtr_probe_interval = 60 * HZ, |
203 | #ifdef CONFIG_IPV6_ROUTE_INFO | ||
204 | .accept_ra_rt_info_max_plen = 0, | ||
205 | #endif | ||
200 | #endif | 206 | #endif |
201 | }; | 207 | }; |
202 | 208 | ||
@@ -3133,6 +3139,9 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf, | |||
3133 | #ifdef CONFIG_IPV6_ROUTER_PREF | 3139 | #ifdef CONFIG_IPV6_ROUTER_PREF |
3134 | array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; | 3140 | array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; |
3135 | array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval; | 3141 | array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval; |
3142 | #ifdef CONFIV_IPV6_ROUTE_INFO | ||
3143 | array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen; | ||
3144 | #endif | ||
3136 | #endif | 3145 | #endif |
3137 | } | 3146 | } |
3138 | 3147 | ||
@@ -3620,6 +3629,16 @@ static struct addrconf_sysctl_table | |||
3620 | .proc_handler = &proc_dointvec_jiffies, | 3629 | .proc_handler = &proc_dointvec_jiffies, |
3621 | .strategy = &sysctl_jiffies, | 3630 | .strategy = &sysctl_jiffies, |
3622 | }, | 3631 | }, |
3632 | #ifdef CONFIV_IPV6_ROUTE_INFO | ||
3633 | { | ||
3634 | .ctl_name = NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN, | ||
3635 | .procname = "accept_ra_rt_info_max_plen", | ||
3636 | .data = &ipv6_devconf.accept_ra_rt_info_max_plen, | ||
3637 | .maxlen = sizeof(int), | ||
3638 | .mode = 0644, | ||
3639 | .proc_handler = &proc_dointvec, | ||
3640 | }, | ||
3641 | #endif | ||
3623 | #endif | 3642 | #endif |
3624 | { | 3643 | { |
3625 | .ctl_name = 0, /* sentinel */ | 3644 | .ctl_name = 0, /* sentinel */ |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 1f6256909674..dfa20d3be9b6 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1214,11 +1214,13 @@ skip_defrtr: | |||
1214 | } | 1214 | } |
1215 | 1215 | ||
1216 | #ifdef CONFIG_IPV6_ROUTE_INFO | 1216 | #ifdef CONFIG_IPV6_ROUTE_INFO |
1217 | if (ndopts.nd_opts_ri) { | 1217 | if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) { |
1218 | struct nd_opt_hdr *p; | 1218 | struct nd_opt_hdr *p; |
1219 | for (p = ndopts.nd_opts_ri; | 1219 | for (p = ndopts.nd_opts_ri; |
1220 | p; | 1220 | p; |
1221 | p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) { | 1221 | p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) { |
1222 | if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen) | ||
1223 | continue; | ||
1222 | rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, | 1224 | rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, |
1223 | &skb->nh.ipv6h->saddr); | 1225 | &skb->nh.ipv6h->saddr); |
1224 | } | 1226 | } |