netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Netfilter Development Mailinglist <netfilter-devel@vger.kernel.org>
Subject: netfilter: ipset: add missing break statemtns in ip_set_get_ip_port()
Date: Wed, 02 Feb 2011 09:35:08 +0100	[thread overview]
Message-ID: <4D49173C.6080703@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

Add missing break statements.

I assume the second switch statement which handles only TCP and UDP
is intended to indicate whether a real port number instead of ICMP
port and code were parsed? Otherwise we should add IPPROTO_ICMP and
IPPROTO_ICMPV6 there too.


[-- Attachment #2: 04.diff --]
[-- Type: text/x-patch, Size: 940 bytes --]

commit 316ed388802533bcfd3dffb38d2ba29ac5428456
Author: Patrick McHardy <kaber@trash.net>
Date:   Wed Feb 2 09:31:37 2011 +0100

    netfilter: ipset: add missing break statemtns in ip_set_get_ip_port()
    
    Don't fall through in the switch statement, otherwise IPv4 headers
    are incorrectly parsed again as IPv6 and the return value will always
    be 'false'.
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/net/netfilter/ipset/ip_set_getport.c b/net/netfilter/ipset/ip_set_getport.c
index 76737bb..4dd2785 100644
--- a/net/netfilter/ipset/ip_set_getport.c
+++ b/net/netfilter/ipset/ip_set_getport.c
@@ -118,8 +118,10 @@ ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port)
 	switch (pf) {
 	case AF_INET:
 		ret = ip_set_get_ip4_port(skb, src, port, &proto);
+		break;
 	case AF_INET6:
 		ret = ip_set_get_ip6_port(skb, src, port, &proto);
+		break;
 	default:
 		return false;
 	}

             reply	other threads:[~2011-02-02  8:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02  8:35 Patrick McHardy [this message]
2011-02-02 19:49 ` netfilter: ipset: add missing break statemtns in ip_set_get_ip_port() Jozsef Kadlecsik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D49173C.6080703@trash.net \
    --to=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).