ipv6:introduce function to find route for redirect
Subsystems (4)
PATCH v2 1/1 ipv6:introduce function to find route for redirect
RFC 4861 says that the IP source address of the Redirect is the same as the current first-hop router for the specified ICMP Destination Address, so the gateway should be taken into consideration when we find the route for redirect.
Signed-off-by Duan Jiong <[email protected]>
--- net/ipv6/ah6.c | 2 +- net/ipv6/esp6.c | 2 +- net/ipv6/icmp.c | 2 +- net/ipv6/ipcomp6.c | 2 +- net/ipv6/ndisc.c | 2 +- net/ipv6/route.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 6 files changed, 80 insertions(+), 11 deletions(-)
net/ipv6/ah6.c +1 -1
@@ -628,7 +628,7 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,return ;if (type ==NDISC_REDIRECT ) -ip6_redirect (skb, net,0 ,0 ); +ip6_redirect (skb, net, skb->dev->ifindex,0 );else ip6_update_pmtu (skb, net, info,0 ,0 );xfrm_state_put (x);
net/ipv6/esp6.c +1 -1
@@ -447,7 +447,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,return ;if (type ==NDISC_REDIRECT ) -ip6_redirect (skb, net,0 ,0 ); +ip6_redirect (skb, net, skb->dev->ifindex,0 );else ip6_update_pmtu (skb, net, info,0 ,0 );xfrm_state_put (x);
net/ipv6/icmp.c +1 -1
@@ -92,7 +92,7 @@ static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,if (type ==ICMPV6_PKT_TOOBIG )ip6_update_pmtu (skb, net, info,0 ,0 );else if (type ==NDISC_REDIRECT ) -ip6_redirect (skb, net,0 ,0 ); +ip6_redirect (skb, net, skb->dev->ifindex,0 );if (!(type &ICMPV6_INFOMSG_MASK ))if (icmp6->icmp6_type ==ICMPV6_ECHO_REQUEST )
net/ipv6/ipcomp6.c +1 -1
@@ -76,7 +76,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,return ;if (type ==NDISC_REDIRECT ) -ip6_redirect (skb, net,0 ,0 ); +ip6_redirect (skb, net, skb->dev->ifindex,0 );else ip6_update_pmtu (skb, net, info,0 ,0 );xfrm_state_put (x);
net/ipv6/ndisc.c +1 -1
@@ -1370,7 +1370,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)return ;if (!ndopts.nd_opts_rh) { -ip6_redirect_no_header (skb,dev_net (skb->dev),0 ,0 ); +ip6_redirect_no_header (skb,dev_net (skb->dev), skb->dev->ifindex,0 );return ; }
net/ipv6/route.c +75 -6
99 lines not on this page · raw message
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Duan Jiong <[email protected]>
Date: Fri, 30 Aug 2013 15:23:34 +0800
net/ipv6/route.c void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu) · line 1186
Quoted 10 lines
net/ipv6/route.c +10
-0+/* +* Get the "current" route for this destination and +* check if the redirect has come from approriate router. +* +* RFC 4861 specifies that redirects should only be +* accepted if they come from the nexthop to the target. +* Due to the way the routes are chosen, this notion +* is a bit fuzzy and one might need to check all possible +* routes. +*/
Comments in the networking code should be formatted:
/* Like * this. */