Commit 09c884d4 authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller

[IPV6]: ROUTE: Add accept_ra_rt_info_max_plen sysctl.

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e317da96
...@@ -729,6 +729,15 @@ accept_ra_pinfo - BOOLEAN ...@@ -729,6 +729,15 @@ accept_ra_pinfo - BOOLEAN
Functional default: enabled if accept_ra is enabled. Functional default: enabled if accept_ra is enabled.
disabled if accept_ra is disabled. disabled if accept_ra is disabled.
accept_ra_rt_info_max_plen - INTEGER
Maximum prefix length of Route Information in RA.
Route Information w/ prefix larger than or equal to this
variable shall be ignored.
Functional default: 0 if accept_ra_rtr_pref is enabled.
-1 if accept_ra_rtr_pref is disabled.
accept_ra_rtr_pref - BOOLEAN accept_ra_rtr_pref - BOOLEAN
Accept Router Preference in RA. Accept Router Preference in RA.
......
...@@ -150,6 +150,9 @@ struct ipv6_devconf { ...@@ -150,6 +150,9 @@ struct ipv6_devconf {
#ifdef CONFIG_IPV6_ROUTER_PREF #ifdef CONFIG_IPV6_ROUTER_PREF
__s32 accept_ra_rtr_pref; __s32 accept_ra_rtr_pref;
__s32 rtr_probe_interval; __s32 rtr_probe_interval;
#ifdef CONFIG_IPV6_ROUTE_INFO
__s32 accept_ra_rt_info_max_plen;
#endif
#endif #endif
void *sysctl; void *sysctl;
}; };
...@@ -177,6 +180,7 @@ enum { ...@@ -177,6 +180,7 @@ enum {
DEVCONF_ACCEPT_RA_PINFO, DEVCONF_ACCEPT_RA_PINFO,
DEVCONF_ACCEPT_RA_RTR_PREF, DEVCONF_ACCEPT_RA_RTR_PREF,
DEVCONF_RTR_PROBE_INTERVAL, DEVCONF_RTR_PROBE_INTERVAL,
DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
DEVCONF_MAX DEVCONF_MAX
}; };
......
...@@ -535,6 +535,7 @@ enum { ...@@ -535,6 +535,7 @@ enum {
NET_IPV6_ACCEPT_RA_PINFO=19, NET_IPV6_ACCEPT_RA_PINFO=19,
NET_IPV6_ACCEPT_RA_RTR_PREF=20, NET_IPV6_ACCEPT_RA_RTR_PREF=20,
NET_IPV6_RTR_PROBE_INTERVAL=21, NET_IPV6_RTR_PROBE_INTERVAL=21,
NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
__NET_IPV6_MAX __NET_IPV6_MAX
}; };
......
...@@ -170,6 +170,9 @@ struct ipv6_devconf ipv6_devconf = { ...@@ -170,6 +170,9 @@ struct ipv6_devconf ipv6_devconf = {
#ifdef CONFIG_IPV6_ROUTER_PREF #ifdef CONFIG_IPV6_ROUTER_PREF
.accept_ra_rtr_pref = 1, .accept_ra_rtr_pref = 1,
.rtr_probe_interval = 60 * HZ, .rtr_probe_interval = 60 * HZ,
#ifdef CONFIG_IPV6_ROUTE_INFO
.accept_ra_rt_info_max_plen = 0,
#endif
#endif #endif
}; };
...@@ -197,6 +200,9 @@ static struct ipv6_devconf ipv6_devconf_dflt = { ...@@ -197,6 +200,9 @@ static struct ipv6_devconf ipv6_devconf_dflt = {
#ifdef CONFIG_IPV6_ROUTER_PREF #ifdef CONFIG_IPV6_ROUTER_PREF
.accept_ra_rtr_pref = 1, .accept_ra_rtr_pref = 1,
.rtr_probe_interval = 60 * HZ, .rtr_probe_interval = 60 * HZ,
#ifdef CONFIG_IPV6_ROUTE_INFO
.accept_ra_rt_info_max_plen = 0,
#endif
#endif #endif
}; };
...@@ -3133,6 +3139,9 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf, ...@@ -3133,6 +3139,9 @@ static void inline ipv6_store_devconf(struct ipv6_devconf *cnf,
#ifdef CONFIG_IPV6_ROUTER_PREF #ifdef CONFIG_IPV6_ROUTER_PREF
array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref; array[DEVCONF_ACCEPT_RA_RTR_PREF] = cnf->accept_ra_rtr_pref;
array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval; array[DEVCONF_RTR_PROBE_INTERVAL] = cnf->rtr_probe_interval;
#ifdef CONFIV_IPV6_ROUTE_INFO
array[DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN] = cnf->accept_ra_rt_info_max_plen;
#endif
#endif #endif
} }
...@@ -3620,6 +3629,16 @@ static struct addrconf_sysctl_table ...@@ -3620,6 +3629,16 @@ static struct addrconf_sysctl_table
.proc_handler = &proc_dointvec_jiffies, .proc_handler = &proc_dointvec_jiffies,
.strategy = &sysctl_jiffies, .strategy = &sysctl_jiffies,
}, },
#ifdef CONFIV_IPV6_ROUTE_INFO
{
.ctl_name = NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN,
.procname = "accept_ra_rt_info_max_plen",
.data = &ipv6_devconf.accept_ra_rt_info_max_plen,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
#endif
#endif #endif
{ {
.ctl_name = 0, /* sentinel */ .ctl_name = 0, /* sentinel */
......
...@@ -1214,11 +1214,13 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1214,11 +1214,13 @@ static void ndisc_router_discovery(struct sk_buff *skb)
} }
#ifdef CONFIG_IPV6_ROUTE_INFO #ifdef CONFIG_IPV6_ROUTE_INFO
if (ndopts.nd_opts_ri) { if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) {
struct nd_opt_hdr *p; struct nd_opt_hdr *p;
for (p = ndopts.nd_opts_ri; for (p = ndopts.nd_opts_ri;
p; p;
p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) { p = ndisc_next_option(p, ndopts.nd_opts_ri_end)) {
if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
continue;
rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
&skb->nh.ipv6h->saddr); &skb->nh.ipv6h->saddr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment