netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* netfilter: ipset: add missing break statemtns in ip_set_get_ip_port()
@ 2011-02-02  8:35 Patrick McHardy
  2011-02-02 19:49 ` Jozsef Kadlecsik
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick McHardy @ 2011-02-02  8:35 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: Netfilter Development Mailinglist

[-- 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;
 	}

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

* Re: netfilter: ipset: add missing break statemtns in ip_set_get_ip_port()
  2011-02-02  8:35 netfilter: ipset: add missing break statemtns in ip_set_get_ip_port() Patrick McHardy
@ 2011-02-02 19:49 ` Jozsef Kadlecsik
  0 siblings, 0 replies; 2+ messages in thread
From: Jozsef Kadlecsik @ 2011-02-02 19:49 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Netfilter Development Mailinglist

On Wed, 2 Feb 2011, Patrick McHardy wrote:

> Add missing break statements.

Thanks! It's a clear bugfix, I applied your patch.
 
> 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.

Yes, excatly. The function is called from the bitmap:port type which 
can handle TCP/UDP ports only.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlec@mail.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
          H-1525 Budapest 114, POB. 49, Hungary

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

end of thread, other threads:[~2011-02-02 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-02  8:35 netfilter: ipset: add missing break statemtns in ip_set_get_ip_port() Patrick McHardy
2011-02-02 19:49 ` Jozsef Kadlecsik

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).