All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer
@ 2013-09-12 10:41 Duan Jiong
  2013-09-12 10:43 ` [PATCH 01/11] " Duan Jiong
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:41 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

the ip6_redirect() could be replaced with
ip6_redirect_no_header(), we could always use ip6_redirect()
for route updating in ndisc layer and use the data of the
redirected header option just for finding the socket to be
notified and then notify user in protocols' err_handler.

---

 include/net/ip6_route.h |  3 ---
 net/dccp/ipv6.c         | 10 +++-------
 net/ipv6/ah6.c          |  9 ++-------
 net/ipv6/esp6.c         |  9 ++-------
 net/ipv6/icmp.c         |  2 --
 net/ipv6/ip6_tunnel.c   |  5 -----
 net/ipv6/ipcomp6.c      |  9 ++-------
 net/ipv6/ndisc.c        |  6 ++----
 net/ipv6/raw.c          |  2 +-
 net/ipv6/route.c        | 29 ++---------------------------
 net/ipv6/tcp_ipv6.c     | 12 ++++--------
 net/ipv6/udp.c          |  4 ++--
 net/sctp/input.c        | 12 ------------
 net/sctp/ipv6.c         |  6 +++---
 14 files changed, 23 insertions(+), 95 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 01/11] ipv6: Do route updating for redirect in ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
@ 2013-09-12 10:43 ` Duan Jiong
  2013-09-12 21:54   ` Hannes Frederic Sowa
  2013-09-12 10:44 ` [PATCH 02/11] dccp: move route updating for redirect to " Duan Jiong
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:43 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

Do the whole verification and route updating in ndisc
lay and then just call into icmpv6_notify() to notify
the upper protocols if we have the data of the
redirected header option.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 include/net/ip6_route.h |  3 ---
 net/ipv6/ndisc.c        |  6 ++----
 net/ipv6/route.c        | 29 ++---------------------------
 3 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index f525e70..5db259e 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -133,9 +133,6 @@ extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu,
 extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,
 			       __be32 mtu);
 extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);
-extern void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
-				   u32 mark);
-extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
 
 struct netlink_callback;
 
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index f8a55ff..6bd1b41 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1368,11 +1368,9 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
 	if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts))
 		return;
 
-	if (!ndopts.nd_opts_rh) {
-		ip6_redirect_no_header(skb, dev_net(skb->dev),
-					skb->dev->ifindex, 0);
+	ip6_redirect(skb, dev_net(skb->dev), skb->dev->ifindex, 0);
+	if (!ndopts.nd_opts_rh)
 		return;
-	}
 
 	hdr = (u8 *)ndopts.nd_opts_rh;
 	hdr += 8;
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index c979dd9..151bd6c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1227,27 +1227,7 @@ static struct dst_entry *ip6_route_redirect(struct net *net,
 				flags, __ip6_route_redirect);
 }
 
-void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark)
-{
-	const struct ipv6hdr *iph = (struct ipv6hdr *) skb->data;
-	struct dst_entry *dst;
-	struct flowi6 fl6;
-
-	memset(&fl6, 0, sizeof(fl6));
-	fl6.flowi6_oif = oif;
-	fl6.flowi6_mark = mark;
-	fl6.flowi6_flags = 0;
-	fl6.daddr = iph->daddr;
-	fl6.saddr = iph->saddr;
-	fl6.flowlabel = ip6_flowinfo(iph);
-
-	dst = ip6_route_redirect(net, &fl6, &ipv6_hdr(skb)->saddr);
-	rt6_do_redirect(dst, NULL, skb);
-	dst_release(dst);
-}
-EXPORT_SYMBOL_GPL(ip6_redirect);
-
-void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
+void ip6_redirect(struct sk_buff *skb, struct net *net, int oif,
 			    u32 mark)
 {
 	const struct ipv6hdr *iph = ipv6_hdr(skb);
@@ -1266,12 +1246,7 @@ void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
 	rt6_do_redirect(dst, NULL, skb);
 	dst_release(dst);
 }
-
-void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk)
-{
-	ip6_redirect(skb, sock_net(sk), sk->sk_bound_dev_if, sk->sk_mark);
-}
-EXPORT_SYMBOL_GPL(ip6_sk_redirect);
+EXPORT_SYMBOL_GPL(ip6_redirect);
 
 static unsigned int ip6_default_advmss(const struct dst_entry *dst)
 {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 02/11] dccp: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
  2013-09-12 10:43 ` [PATCH 01/11] " Duan Jiong
@ 2013-09-12 10:44 ` Duan Jiong
  2013-09-12 10:45 ` [PATCH 03/11] ipv6: " Duan Jiong
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:44 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

In additon, like net/ipv6/tcp_ipv6.c, when dealing with
redirect message, it should directly return;

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/dccp/ipv6.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 9c61f9c..300840c 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -98,6 +98,9 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		return;
 	}
 
+	if (type == NDISC_REDIRECT)
+		return;
+
 	sk = inet6_lookup(net, &dccp_hashinfo,
 			&hdr->daddr, dh->dccph_dport,
 			&hdr->saddr, dh->dccph_sport, inet6_iif(skb));
@@ -130,13 +133,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 
 	np = inet6_sk(sk);
 
-	if (type == NDISC_REDIRECT) {
-		struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
-
-		if (dst)
-			dst->ops->redirect(dst, sk, skb);
-	}
-
 	if (type == ICMPV6_PKT_TOOBIG) {
 		struct dst_entry *dst = NULL;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 03/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
  2013-09-12 10:43 ` [PATCH 01/11] " Duan Jiong
  2013-09-12 10:44 ` [PATCH 02/11] dccp: move route updating for redirect to " Duan Jiong
@ 2013-09-12 10:45 ` Duan Jiong
  2013-09-12 10:46 ` [PATCH 04/11] " Duan Jiong
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

So the ah6_err() only handle the ICMPV6_PKT_TOOBIG.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/ah6.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 73784c3..79fb40f 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -618,19 +618,14 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	struct ip_auth_hdr *ah = (struct ip_auth_hdr*)(skb->data+offset);
 	struct xfrm_state *x;
 
-	if (type != ICMPV6_DEST_UNREACH &&
-	    type != ICMPV6_PKT_TOOBIG &&
-	    type != NDISC_REDIRECT)
+	if (type != ICMPV6_PKT_TOOBIG)
 		return;
 
 	x = xfrm_state_lookup(net, skb->mark, (xfrm_address_t *)&iph->daddr, ah->spi, IPPROTO_AH, AF_INET6);
 	if (!x)
 		return;
 
-	if (type == NDISC_REDIRECT)
-		ip6_redirect(skb, net, skb->dev->ifindex, 0);
-	else
-		ip6_update_pmtu(skb, net, info, 0, 0);
+	ip6_update_pmtu(skb, net, info, 0, 0);
 	xfrm_state_put(x);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 04/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (2 preceding siblings ...)
  2013-09-12 10:45 ` [PATCH 03/11] ipv6: " Duan Jiong
@ 2013-09-12 10:46 ` Duan Jiong
  2013-09-12 19:03   ` David Miller
  2013-09-12 10:47 ` [PATCH 05/11] " Duan Jiong
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:46 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

So the esp6_err() only handle the ICMPV6_PKT_TOOBIG.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/esp6.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index d3618a7..6aa64e1 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -436,9 +436,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	struct ip_esp_hdr *esph = (struct ip_esp_hdr *)(skb->data + offset);
 	struct xfrm_state *x;
 
-	if (type != ICMPV6_DEST_UNREACH &&
-	    type != ICMPV6_PKT_TOOBIG &&
-	    type != NDISC_REDIRECT)
+	if (type != ICMPV6_PKT_TOOBIG)
 		return;
 
 	x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
@@ -446,10 +444,7 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	if (!x)
 		return;
 
-	if (type == NDISC_REDIRECT)
-		ip6_redirect(skb, net, skb->dev->ifindex, 0);
-	else
-		ip6_update_pmtu(skb, net, info, 0, 0);
+	ip6_update_pmtu(skb, net, info, 0, 0);
 	xfrm_state_put(x);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 05/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (3 preceding siblings ...)
  2013-09-12 10:46 ` [PATCH 04/11] " Duan Jiong
@ 2013-09-12 10:47 ` Duan Jiong
  2013-09-12 10:49 ` [PATCH 06/11] ip6tnl: " Duan Jiong
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:47 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/icmp.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index eef8d94..4bde43c 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -91,8 +91,6 @@ 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, skb->dev->ifindex, 0);
 
 	if (!(type & ICMPV6_INFOMSG_MASK))
 		if (icmp6->icmp6_type == ICMPV6_ECHO_REQUEST)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 06/11] ip6tnl: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (4 preceding siblings ...)
  2013-09-12 10:47 ` [PATCH 05/11] " Duan Jiong
@ 2013-09-12 10:49 ` Duan Jiong
  2013-09-12 10:49 ` [PATCH 07/11] ipv6: " Duan Jiong
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:49 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

In rfc2473, we can know that the tunnel ICMP redirect
message should not be reported to the source of the
original packet, so after calling ip6_tnl_err(), the
rel_msg is set to 0 in function ip4ip6_err(), and the
redirect will never be handled.

In order to deal with this, we move route updating for
redirect to ndisc layer.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/ip6_tunnel.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 61355f7..3ea834b 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -576,9 +576,6 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		rel_type = ICMP_DEST_UNREACH;
 		rel_code = ICMP_FRAG_NEEDED;
 		break;
-	case NDISC_REDIRECT:
-		rel_type = ICMP_REDIRECT;
-		rel_code = ICMP_REDIR_HOST;
 	default:
 		return 0;
 	}
@@ -637,8 +634,6 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 
 		skb_dst(skb2)->ops->update_pmtu(skb_dst(skb2), NULL, skb2, rel_info);
 	}
-	if (rel_type == ICMP_REDIRECT)
-		skb_dst(skb2)->ops->redirect(skb_dst(skb2), NULL, skb2);
 
 	icmp_send(skb2, rel_type, rel_code, htonl(rel_info));
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 07/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (5 preceding siblings ...)
  2013-09-12 10:49 ` [PATCH 06/11] ip6tnl: " Duan Jiong
@ 2013-09-12 10:49 ` Duan Jiong
  2013-09-12 10:50 ` [PATCH 08/11] " Duan Jiong
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:49 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

So the ipcomm6_err() only handle the ICMPV6_PKT_TOOBIG.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/ipcomp6.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 5636a91..e943158 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -64,9 +64,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		(struct ip_comp_hdr *)(skb->data + offset);
 	struct xfrm_state *x;
 
-	if (type != ICMPV6_DEST_UNREACH &&
-	    type != ICMPV6_PKT_TOOBIG &&
-	    type != NDISC_REDIRECT)
+	if (type != ICMPV6_PKT_TOOBIG)
 		return;
 
 	spi = htonl(ntohs(ipcomph->cpi));
@@ -75,10 +73,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	if (!x)
 		return;
 
-	if (type == NDISC_REDIRECT)
-		ip6_redirect(skb, net, skb->dev->ifindex, 0);
-	else
-		ip6_update_pmtu(skb, net, info, 0, 0);
+	ip6_update_pmtu(skb, net, info, 0, 0);
 	xfrm_state_put(x);
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 08/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (6 preceding siblings ...)
  2013-09-12 10:49 ` [PATCH 07/11] ipv6: " Duan Jiong
@ 2013-09-12 10:50 ` Duan Jiong
  2013-09-12 10:51 ` [PATCH 09/11] sctp: " Duan Jiong
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:50 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>


Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/tcp_ipv6.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 5c71501..d3ca8a4 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -346,6 +346,10 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	__u32 seq;
 	struct net *net = dev_net(skb->dev);
 
+
+	if (type == NDISC_REDIRECT)
+		return;
+
 	sk = inet6_lookup(net, &tcp_hashinfo, &hdr->daddr,
 			th->dest, &hdr->saddr, th->source, skb->dev->ifindex);
 
@@ -382,14 +386,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 
 	np = inet6_sk(sk);
 
-	if (type == NDISC_REDIRECT) {
-		struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
-
-		if (dst)
-			dst->ops->redirect(dst, sk, skb);
-		goto out;
-	}
-
 	if (type == ICMPV6_PKT_TOOBIG) {
 		/* We are not interested in TCP_LISTEN and open_requests
 		 * (SYN-ACKs send out by Linux are always <576bytes so
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/11] sctp: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (7 preceding siblings ...)
  2013-09-12 10:50 ` [PATCH 08/11] " Duan Jiong
@ 2013-09-12 10:51 ` Duan Jiong
  2013-09-12 12:33     ` Daniel Borkmann
  2013-09-12 10:51 ` [PATCH 10/11] ipv6: " Duan Jiong
  2013-09-12 10:52 ` [PATCH 11/11] " Duan Jiong
  10 siblings, 1 reply; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

In additon, when dealing with redirect message, it should
not report error message to user, and need to return
directly.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/sctp/input.c | 12 ------------
 net/sctp/ipv6.c  |  6 +++---
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index 5f20686..0d2d4b7 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -413,18 +413,6 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
 	sctp_retransmit(&asoc->outqueue, t, SCTP_RTXR_PMTUD);
 }
 
-void sctp_icmp_redirect(struct sock *sk, struct sctp_transport *t,
-			struct sk_buff *skb)
-{
-	struct dst_entry *dst;
-
-	if (!t)
-		return;
-	dst = sctp_transport_dst_check(t);
-	if (dst)
-		dst->ops->redirect(dst, sk, skb);
-}
-
 /*
  * SCTP Implementer's Guide, 2.37 ICMP handling procedures
  *
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index da613ce..ee12d87 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -151,6 +151,9 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	int err;
 	struct net *net = dev_net(skb->dev);
 
+	if (type == NDISC_REDIRECT)
+		return;
+
 	idev = in6_dev_get(skb->dev);
 
 	/* Fix up skb to look at the embedded net header. */
@@ -181,9 +184,6 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 			goto out_unlock;
 		}
 		break;
-	case NDISC_REDIRECT:
-		sctp_icmp_redirect(sk, transport, skb);
-		break;
 	default:
 		break;
 	}
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 10/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (8 preceding siblings ...)
  2013-09-12 10:51 ` [PATCH 09/11] sctp: " Duan Jiong
@ 2013-09-12 10:51 ` Duan Jiong
  2013-09-12 22:04   ` Hannes Frederic Sowa
  2013-09-12 10:52 ` [PATCH 11/11] " Duan Jiong
  10 siblings, 1 reply; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

And when dealing with redirect message, the err shoud
be assigned to 0.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/raw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 58916bb..6138199 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -336,7 +336,7 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
 		harderr = (np->pmtudisc == IPV6_PMTUDISC_DO);
 	}
 	if (type == NDISC_REDIRECT)
-		ip6_sk_redirect(skb, sk);
+		err = 0;
 	if (np->recverr) {
 		u8 *payload = skb->data;
 		if (!inet->hdrincl)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 11/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
                   ` (9 preceding siblings ...)
  2013-09-12 10:51 ` [PATCH 10/11] ipv6: " Duan Jiong
@ 2013-09-12 10:52 ` Duan Jiong
  10 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-12 10:52 UTC (permalink / raw)
  To: davem; +Cc: netdev, hannes

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

And when dealing with the redirect message, the err
should be assigned to 0.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
---
 net/ipv6/udp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index f405815..d212c62 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -525,8 +525,6 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 
 	if (type == ICMPV6_PKT_TOOBIG)
 		ip6_sk_update_pmtu(skb, sk, info);
-	if (type == NDISC_REDIRECT)
-		ip6_sk_redirect(skb, sk);
 
 	np = inet6_sk(sk);
 
@@ -536,6 +534,8 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 	if (sk->sk_state != TCP_ESTABLISHED && !np->recverr)
 		goto out;
 
+	if (type == NDISC_REDIRECT)
+		err = 0;
 	if (np->recverr)
 		ipv6_icmp_error(sk, skb, err, uh->dest, ntohl(info), (u8 *)(uh+1));
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 09/11] sctp: move route updating for redirect to ndisc layer
  2013-09-12 10:51 ` [PATCH 09/11] sctp: " Duan Jiong
@ 2013-09-12 12:33     ` Daniel Borkmann
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Borkmann @ 2013-09-12 12:33 UTC (permalink / raw)
  To: Duan Jiong; +Cc: davem, netdev, hannes, linux-sctp

(Please also cc linux-sctp on this one.)

On 09/12/2013 12:51 PM, Duan Jiong wrote:
> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> 
> In additon, when dealing with redirect message, it should
> not report error message to user, and need to return
> directly.
> 
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> ---
>   net/sctp/input.c | 12 ------------
>   net/sctp/ipv6.c  |  6 +++---
>   2 files changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/net/sctp/input.c b/net/sctp/input.c
> index 5f20686..0d2d4b7 100644
> --- a/net/sctp/input.c
> +++ b/net/sctp/input.c
> @@ -413,18 +413,6 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
>   	sctp_retransmit(&asoc->outqueue, t, SCTP_RTXR_PMTUD);
>   }
>   
> -void sctp_icmp_redirect(struct sock *sk, struct sctp_transport *t,
> -			struct sk_buff *skb)
> -{
> -	struct dst_entry *dst;
> -
> -	if (!t)
> -		return;
> -	dst = sctp_transport_dst_check(t);
> -	if (dst)
> -		dst->ops->redirect(dst, sk, skb);
> -}
> -
>   /*
>    * SCTP Implementer's Guide, 2.37 ICMP handling procedures
>    *
> diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
> index da613ce..ee12d87 100644
> --- a/net/sctp/ipv6.c
> +++ b/net/sctp/ipv6.c
> @@ -151,6 +151,9 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>   	int err;
>   	struct net *net = dev_net(skb->dev);
>   
> +	if (type == NDISC_REDIRECT)
> +		return;
> +
>   	idev = in6_dev_get(skb->dev);
>   
>   	/* Fix up skb to look at the embedded net header. */
> @@ -181,9 +184,6 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>   			goto out_unlock;
>   		}
>   		break;
> -	case NDISC_REDIRECT:
> -		sctp_icmp_redirect(sk, transport, skb);
> -		break;
>   	default:
>   		break;
>   	}
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 09/11] sctp: move route updating for redirect to ndisc layer
@ 2013-09-12 12:33     ` Daniel Borkmann
  0 siblings, 0 replies; 18+ messages in thread
From: Daniel Borkmann @ 2013-09-12 12:33 UTC (permalink / raw)
  To: Duan Jiong; +Cc: davem, netdev, hannes, linux-sctp

(Please also cc linux-sctp on this one.)

On 09/12/2013 12:51 PM, Duan Jiong wrote:
> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> 
> In additon, when dealing with redirect message, it should
> not report error message to user, and need to return
> directly.
> 
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> ---
>   net/sctp/input.c | 12 ------------
>   net/sctp/ipv6.c  |  6 +++---
>   2 files changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/net/sctp/input.c b/net/sctp/input.c
> index 5f20686..0d2d4b7 100644
> --- a/net/sctp/input.c
> +++ b/net/sctp/input.c
> @@ -413,18 +413,6 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
>   	sctp_retransmit(&asoc->outqueue, t, SCTP_RTXR_PMTUD);
>   }
>   
> -void sctp_icmp_redirect(struct sock *sk, struct sctp_transport *t,
> -			struct sk_buff *skb)
> -{
> -	struct dst_entry *dst;
> -
> -	if (!t)
> -		return;
> -	dst = sctp_transport_dst_check(t);
> -	if (dst)
> -		dst->ops->redirect(dst, sk, skb);
> -}
> -
>   /*
>    * SCTP Implementer's Guide, 2.37 ICMP handling procedures
>    *
> diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
> index da613ce..ee12d87 100644
> --- a/net/sctp/ipv6.c
> +++ b/net/sctp/ipv6.c
> @@ -151,6 +151,9 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>   	int err;
>   	struct net *net = dev_net(skb->dev);
>   
> +	if (type = NDISC_REDIRECT)
> +		return;
> +
>   	idev = in6_dev_get(skb->dev);
>   
>   	/* Fix up skb to look at the embedded net header. */
> @@ -181,9 +184,6 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
>   			goto out_unlock;
>   		}
>   		break;
> -	case NDISC_REDIRECT:
> -		sctp_icmp_redirect(sk, transport, skb);
> -		break;
>   	default:
>   		break;
>   	}
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 04/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:46 ` [PATCH 04/11] " Duan Jiong
@ 2013-09-12 19:03   ` David Miller
  0 siblings, 0 replies; 18+ messages in thread
From: David Miller @ 2013-09-12 19:03 UTC (permalink / raw)
  To: duanj.fnst; +Cc: netdev, hannes


It is completely pointless to use the same exact subject line for
several patches in a patch set.

You absolutely must choose unique subject line text for each patch so
that someone skimming the shortlog can tell what might be unique to
each patch.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 01/11] ipv6: Do route updating for redirect in ndisc layer
  2013-09-12 10:43 ` [PATCH 01/11] " Duan Jiong
@ 2013-09-12 21:54   ` Hannes Frederic Sowa
  0 siblings, 0 replies; 18+ messages in thread
From: Hannes Frederic Sowa @ 2013-09-12 21:54 UTC (permalink / raw)
  To: Duan Jiong; +Cc: davem, netdev

On Thu, Sep 12, 2013 at 06:43:56PM +0800, Duan Jiong wrote:
> -
> -void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk)
> -{
> -	ip6_redirect(skb, sock_net(sk), sk->sk_bound_dev_if, sk->sk_mark);
> -}
> -EXPORT_SYMBOL_GPL(ip6_sk_redirect);
> +EXPORT_SYMBOL_GPL(ip6_redirect);
>  
>  static unsigned int ip6_default_advmss(const struct dst_entry *dst)
>  {

This breaks bisectability. Please remove the function after you cleared up all
references to it. Otherwise git bisect would throw compiler errors.

Greetings,

  Hannes

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 10/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 10:51 ` [PATCH 10/11] ipv6: " Duan Jiong
@ 2013-09-12 22:04   ` Hannes Frederic Sowa
  2013-09-13  1:38     ` Duan Jiong
  0 siblings, 1 reply; 18+ messages in thread
From: Hannes Frederic Sowa @ 2013-09-12 22:04 UTC (permalink / raw)
  To: Duan Jiong; +Cc: davem, netdev

On Thu, Sep 12, 2013 at 06:51:49PM +0800, Duan Jiong wrote:
> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> 
> And when dealing with redirect message, the err shoud
> be assigned to 0.
> 
> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> ---
>  net/ipv6/raw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
> index 58916bb..6138199 100644
> --- a/net/ipv6/raw.c
> +++ b/net/ipv6/raw.c
> @@ -336,7 +336,7 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
>  		harderr = (np->pmtudisc == IPV6_PMTUDISC_DO);
>  	}
>  	if (type == NDISC_REDIRECT)
> -		ip6_sk_redirect(skb, sk);
> +		err = 0;
>  	if (np->recverr) {
>  		u8 *payload = skb->data;
>  		if (!inet->hdrincl)

Hm, I don't like the cirumstance that we first call icmpv6_err_convert at
first and get back a bogus error value and later on convert it to something
meaningful.

Either:
a) Don't call icmpv6_err_convert at all for redirects. Then we could
   place a WARN_ON(type == NDISC_REDIRECT) into this function to find future
   missuse of this function with redirects or

b) handle the update of the NDISC_REDIRECT error code directly in
   icmpv6_err_convert.

Also that you used the same headings for some commits shows that you could
perhaps squash them into one patch.

Otherwise I'm fine with the changes, thanks.

Greetings,

  Hannes

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 10/11] ipv6: move route updating for redirect to ndisc layer
  2013-09-12 22:04   ` Hannes Frederic Sowa
@ 2013-09-13  1:38     ` Duan Jiong
  0 siblings, 0 replies; 18+ messages in thread
From: Duan Jiong @ 2013-09-13  1:38 UTC (permalink / raw)
  To: hannes; +Cc: davem, netdev

于 2013年09月13日 06:04, Hannes Frederic Sowa 写道:
> On Thu, Sep 12, 2013 at 06:51:49PM +0800, Duan Jiong wrote:
>> From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>>
>> And when dealing with redirect message, the err shoud
>> be assigned to 0.
>>
>> Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
>> ---
>>  net/ipv6/raw.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
>> index 58916bb..6138199 100644
>> --- a/net/ipv6/raw.c
>> +++ b/net/ipv6/raw.c
>> @@ -336,7 +336,7 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb,
>>  		harderr = (np->pmtudisc == IPV6_PMTUDISC_DO);
>>  	}
>>  	if (type == NDISC_REDIRECT)
>> -		ip6_sk_redirect(skb, sk);
>> +		err = 0;
>>  	if (np->recverr) {
>>  		u8 *payload = skb->data;
>>  		if (!inet->hdrincl)
> 
> Hm, I don't like the cirumstance that we first call icmpv6_err_convert at
> first and get back a bogus error value and later on convert it to something
> meaningful.
> 
> Either:
> a) Don't call icmpv6_err_convert at all for redirects. Then we could
>    place a WARN_ON(type == NDISC_REDIRECT) into this function to find future
>    missuse of this function with redirects or
> 
> b) handle the update of the NDISC_REDIRECT error code directly in
>    icmpv6_err_convert.
> 
> Also that you used the same headings for some commits shows that you could
> perhaps squash them into one patch.
> 
> Otherwise I'm fine with the changes, thanks.
> 

Thanks for you help, i will modify my patch.

Thanks,
  Duan

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-09-13  1:39 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-12 10:41 [PATCH 00/11] ipv6: Do route updating for redirect in ndisc layer Duan Jiong
2013-09-12 10:43 ` [PATCH 01/11] " Duan Jiong
2013-09-12 21:54   ` Hannes Frederic Sowa
2013-09-12 10:44 ` [PATCH 02/11] dccp: move route updating for redirect to " Duan Jiong
2013-09-12 10:45 ` [PATCH 03/11] ipv6: " Duan Jiong
2013-09-12 10:46 ` [PATCH 04/11] " Duan Jiong
2013-09-12 19:03   ` David Miller
2013-09-12 10:47 ` [PATCH 05/11] " Duan Jiong
2013-09-12 10:49 ` [PATCH 06/11] ip6tnl: " Duan Jiong
2013-09-12 10:49 ` [PATCH 07/11] ipv6: " Duan Jiong
2013-09-12 10:50 ` [PATCH 08/11] " Duan Jiong
2013-09-12 10:51 ` [PATCH 09/11] sctp: " Duan Jiong
2013-09-12 12:33   ` Daniel Borkmann
2013-09-12 12:33     ` Daniel Borkmann
2013-09-12 10:51 ` [PATCH 10/11] ipv6: " Duan Jiong
2013-09-12 22:04   ` Hannes Frederic Sowa
2013-09-13  1:38     ` Duan Jiong
2013-09-12 10:52 ` [PATCH 11/11] " Duan Jiong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.