Commit f2a762d8 authored by Ben Greear's avatar Ben Greear Committed by David S. Miller

ipv6: Add more debugging around accept-ra logic.

This is disabled by default, just like similar debug info
already in this module.  But, makes it easier to find out
why RA is not being accepted when debugging strange behaviour.
Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4135ab82
...@@ -1070,6 +1070,9 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1070,6 +1070,9 @@ static void ndisc_router_discovery(struct sk_buff *skb)
optlen = (skb_tail_pointer(skb) - skb_transport_header(skb)) - optlen = (skb_tail_pointer(skb) - skb_transport_header(skb)) -
sizeof(struct ra_msg); sizeof(struct ra_msg);
ND_PRINTK(2, info,
"RA: %s, dev: %s\n",
__func__, skb->dev->name);
if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
ND_PRINTK(2, warn, "RA: source address is not link-local\n"); ND_PRINTK(2, warn, "RA: source address is not link-local\n");
return; return;
...@@ -1102,13 +1105,21 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1102,13 +1105,21 @@ static void ndisc_router_discovery(struct sk_buff *skb)
return; return;
} }
if (!ipv6_accept_ra(in6_dev)) if (!ipv6_accept_ra(in6_dev)) {
ND_PRINTK(2, info,
"RA: %s, did not accept ra for dev: %s\n",
__func__, skb->dev->name);
goto skip_linkparms; goto skip_linkparms;
}
#ifdef CONFIG_IPV6_NDISC_NODETYPE #ifdef CONFIG_IPV6_NDISC_NODETYPE
/* skip link-specific parameters from interior routers */ /* skip link-specific parameters from interior routers */
if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) {
ND_PRINTK(2, info,
"RA: %s, nodetype is NODEFAULT, dev: %s\n",
__func__, skb->dev->name);
goto skip_linkparms; goto skip_linkparms;
}
#endif #endif
if (in6_dev->if_flags & IF_RS_SENT) { if (in6_dev->if_flags & IF_RS_SENT) {
...@@ -1130,11 +1141,20 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1130,11 +1141,20 @@ static void ndisc_router_discovery(struct sk_buff *skb)
(ra_msg->icmph.icmp6_addrconf_other ? (ra_msg->icmph.icmp6_addrconf_other ?
IF_RA_OTHERCONF : 0); IF_RA_OTHERCONF : 0);
if (!in6_dev->cnf.accept_ra_defrtr) if (!in6_dev->cnf.accept_ra_defrtr) {
ND_PRINTK(2, info,
"RA: %s, defrtr is false for dev: %s\n",
__func__, skb->dev->name);
goto skip_defrtr; goto skip_defrtr;
}
if (ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, NULL, 0)) if (ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
NULL, 0)) {
ND_PRINTK(2, info,
"RA: %s, chk_addr failed for dev: %s\n",
__func__, skb->dev->name);
goto skip_defrtr; goto skip_defrtr;
}
lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime); lifetime = ntohs(ra_msg->icmph.icmp6_rt_lifetime);
...@@ -1163,8 +1183,10 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1163,8 +1183,10 @@ static void ndisc_router_discovery(struct sk_buff *skb)
rt = NULL; rt = NULL;
} }
ND_PRINTK(3, info, "RA: rt: %p lifetime: %d, for dev: %s\n",
rt, lifetime, skb->dev->name);
if (rt == NULL && lifetime) { if (rt == NULL && lifetime) {
ND_PRINTK(3, dbg, "RA: adding default router\n"); ND_PRINTK(3, info, "RA: adding default router\n");
rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref); rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref);
if (rt == NULL) { if (rt == NULL) {
...@@ -1260,12 +1282,21 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1260,12 +1282,21 @@ static void ndisc_router_discovery(struct sk_buff *skb)
NEIGH_UPDATE_F_ISROUTER); NEIGH_UPDATE_F_ISROUTER);
} }
if (!ipv6_accept_ra(in6_dev)) if (!ipv6_accept_ra(in6_dev)) {
ND_PRINTK(2, info,
"RA: %s, accept_ra is false for dev: %s\n",
__func__, skb->dev->name);
goto out; goto out;
}
#ifdef CONFIG_IPV6_ROUTE_INFO #ifdef CONFIG_IPV6_ROUTE_INFO
if (ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr, NULL, 0)) if (ipv6_chk_addr(dev_net(in6_dev->dev), &ipv6_hdr(skb)->saddr,
NULL, 0)) {
ND_PRINTK(2, info,
"RA: %s, chk-addr (route info) is false for dev: %s\n",
__func__, skb->dev->name);
goto skip_routeinfo; goto skip_routeinfo;
}
if (in6_dev->cnf.accept_ra_rtr_pref && 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;
...@@ -1293,8 +1324,12 @@ static void ndisc_router_discovery(struct sk_buff *skb) ...@@ -1293,8 +1324,12 @@ static void ndisc_router_discovery(struct sk_buff *skb)
#ifdef CONFIG_IPV6_NDISC_NODETYPE #ifdef CONFIG_IPV6_NDISC_NODETYPE
/* skip link-specific ndopts from interior routers */ /* skip link-specific ndopts from interior routers */
if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) {
ND_PRINTK(2, info,
"RA: %s, nodetype is NODEFAULT (interior routes), dev: %s\n",
__func__, skb->dev->name);
goto out; goto out;
}
#endif #endif
if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) { if (in6_dev->cnf.accept_ra_pinfo && ndopts.nd_opts_pi) {
......
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