netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: sctp: rfc4443: do not report ICMP redirects to user space
@ 2013-09-16 10:36 Daniel Borkmann
  2013-09-17  1:40 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2013-09-16 10:36 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-sctp, hannes

Adapt the same behaviour for SCTP as present in TCP for ICMP redirect
messages. For IPv6, RFC4443, section 2.4. says:

  ...
  (e) An ICMPv6 error message MUST NOT be originated as a result of
      receiving the following:
  ...
       (e.2) An ICMPv6 redirect message [IPv6-DISC].
  ...

Therefore, do not report an error to user space, just invoke dst's redirect
callback and leave, same for IPv4 as done in TCP as well. The implication
w/o having this patch could be that the reception of such packets would
generate a poll notification and in worst case it could even tear down the
whole connection. Therefore, stop updating sk_err on redirects.

Reported-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Suggested-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
---
 net/sctp/input.c | 3 +--
 net/sctp/ipv6.c  | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/sctp/input.c b/net/sctp/input.c
index 5f20686..98b69bb 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -634,8 +634,7 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info)
 		break;
 	case ICMP_REDIRECT:
 		sctp_icmp_redirect(sk, transport, skb);
-		err = 0;
-		break;
+		/* Fall through to out_unlock. */
 	default:
 		goto out_unlock;
 	}
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 4f52e2c..e7b2d4f 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -183,7 +183,7 @@ static void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 		break;
 	case NDISC_REDIRECT:
 		sctp_icmp_redirect(sk, transport, skb);
-		break;
+		goto out_unlock;
 	default:
 		break;
 	}
-- 
1.7.11.7

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

* Re: [PATCH net] net: sctp: rfc4443: do not report ICMP redirects to user space
  2013-09-16 10:36 [PATCH net] net: sctp: rfc4443: do not report ICMP redirects to user space Daniel Borkmann
@ 2013-09-17  1:40 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-09-17  1:40 UTC (permalink / raw)
  To: dborkman; +Cc: netdev, linux-sctp, hannes

From: Daniel Borkmann <dborkman@redhat.com>
Date: Mon, 16 Sep 2013 12:36:02 +0200

> Adapt the same behaviour for SCTP as present in TCP for ICMP redirect
> messages. For IPv6, RFC4443, section 2.4. says:
> 
>   ...
>   (e) An ICMPv6 error message MUST NOT be originated as a result of
>       receiving the following:
>   ...
>        (e.2) An ICMPv6 redirect message [IPv6-DISC].
>   ...
> 
> Therefore, do not report an error to user space, just invoke dst's redirect
> callback and leave, same for IPv4 as done in TCP as well. The implication
> w/o having this patch could be that the reception of such packets would
> generate a poll notification and in worst case it could even tear down the
> whole connection. Therefore, stop updating sk_err on redirects.
> 
> Reported-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> Reported-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Suggested-by: Vlad Yasevich <vyasevich@gmail.com>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Applied and queued up for -stable, thanks Daniel.

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-16 10:36 [PATCH net] net: sctp: rfc4443: do not report ICMP redirects to user space Daniel Borkmann
2013-09-17  1:40 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).