diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-04-13 07:51:38 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-04-13 07:51:38 -0400 |
commit | 91eb7c08c6cb3b8eeba1c61f5753c56dcb77f018 (patch) | |
tree | 4e3c461633b58a6cea44bb0230ee750e4bd98416 | |
parent | e3f6a652fd0e828de586a3a87b56c07f7a32259a (diff) |
netfilter: ipset: SCTP, UDPLITE support added
SCTP and UDPLITE port support added to the hash:*port* set types.
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | include/linux/netfilter/ipset/ip_set_getport.h | 2 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_getport.c | 16 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipport.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipportip.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_ipportnet.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipset/ip_set_hash_netport.c | 2 |
6 files changed, 21 insertions, 5 deletions
diff --git a/include/linux/netfilter/ipset/ip_set_getport.h b/include/linux/netfilter/ipset/ip_set_getport.h index 5aebd170f899..90d09300e954 100644 --- a/include/linux/netfilter/ipset/ip_set_getport.h +++ b/include/linux/netfilter/ipset/ip_set_getport.h | |||
@@ -22,7 +22,9 @@ static inline bool ip_set_proto_with_ports(u8 proto) | |||
22 | { | 22 | { |
23 | switch (proto) { | 23 | switch (proto) { |
24 | case IPPROTO_TCP: | 24 | case IPPROTO_TCP: |
25 | case IPPROTO_SCTP: | ||
25 | case IPPROTO_UDP: | 26 | case IPPROTO_UDP: |
27 | case IPPROTO_UDPLITE: | ||
26 | return true; | 28 | return true; |
27 | } | 29 | } |
28 | return false; | 30 | return false; |
diff --git a/net/netfilter/ipset/ip_set_getport.c b/net/netfilter/ipset/ip_set_getport.c index 8d5227212686..757143b2240a 100644 --- a/net/netfilter/ipset/ip_set_getport.c +++ b/net/netfilter/ipset/ip_set_getport.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/skbuff.h> | 11 | #include <linux/skbuff.h> |
12 | #include <linux/icmp.h> | 12 | #include <linux/icmp.h> |
13 | #include <linux/icmpv6.h> | 13 | #include <linux/icmpv6.h> |
14 | #include <linux/sctp.h> | ||
14 | #include <linux/netfilter_ipv6/ip6_tables.h> | 15 | #include <linux/netfilter_ipv6/ip6_tables.h> |
15 | #include <net/ip.h> | 16 | #include <net/ip.h> |
16 | #include <net/ipv6.h> | 17 | #include <net/ipv6.h> |
@@ -35,7 +36,20 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff, | |||
35 | *port = src ? th->source : th->dest; | 36 | *port = src ? th->source : th->dest; |
36 | break; | 37 | break; |
37 | } | 38 | } |
38 | case IPPROTO_UDP: { | 39 | case IPPROTO_SCTP: { |
40 | sctp_sctphdr_t _sh; | ||
41 | const sctp_sctphdr_t *sh; | ||
42 | |||
43 | sh = skb_header_pointer(skb, protooff, sizeof(_sh), &_sh); | ||
44 | if (sh == NULL) | ||
45 | /* No choice either */ | ||
46 | return false; | ||
47 | |||
48 | *port = src ? sh->source : sh->dest; | ||
49 | break; | ||
50 | } | ||
51 | case IPPROTO_UDP: | ||
52 | case IPPROTO_UDPLITE: { | ||
39 | struct udphdr _udph; | 53 | struct udphdr _udph; |
40 | const struct udphdr *uh; | 54 | const struct udphdr *uh; |
41 | 55 | ||
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c index b9214145d357..14281b6b8074 100644 --- a/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/net/netfilter/ipset/ip_set_hash_ipport.c | |||
@@ -491,7 +491,7 @@ static struct ip_set_type hash_ipport_type __read_mostly = { | |||
491 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, | 491 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, |
492 | .dimension = IPSET_DIM_TWO, | 492 | .dimension = IPSET_DIM_TWO, |
493 | .family = AF_UNSPEC, | 493 | .family = AF_UNSPEC, |
494 | .revision = 0, | 494 | .revision = 1, |
495 | .create = hash_ipport_create, | 495 | .create = hash_ipport_create, |
496 | .create_policy = { | 496 | .create_policy = { |
497 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, | 497 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c index 4642872df6e1..401c8a2531db 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/net/netfilter/ipset/ip_set_hash_ipportip.c | |||
@@ -509,7 +509,7 @@ static struct ip_set_type hash_ipportip_type __read_mostly = { | |||
509 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, | 509 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, |
510 | .dimension = IPSET_DIM_THREE, | 510 | .dimension = IPSET_DIM_THREE, |
511 | .family = AF_UNSPEC, | 511 | .family = AF_UNSPEC, |
512 | .revision = 0, | 512 | .revision = 1, |
513 | .create = hash_ipportip_create, | 513 | .create = hash_ipportip_create, |
514 | .create_policy = { | 514 | .create_policy = { |
515 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, | 515 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index 2cb84a54b7ad..4743e5402522 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
@@ -574,7 +574,7 @@ static struct ip_set_type hash_ipportnet_type __read_mostly = { | |||
574 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, | 574 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT | IPSET_TYPE_IP2, |
575 | .dimension = IPSET_DIM_THREE, | 575 | .dimension = IPSET_DIM_THREE, |
576 | .family = AF_UNSPEC, | 576 | .family = AF_UNSPEC, |
577 | .revision = 0, | 577 | .revision = 1, |
578 | .create = hash_ipportnet_create, | 578 | .create = hash_ipportnet_create, |
579 | .create_policy = { | 579 | .create_policy = { |
580 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, | 580 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, |
diff --git a/net/netfilter/ipset/ip_set_hash_netport.c b/net/netfilter/ipset/ip_set_hash_netport.c index 8598676f2a05..d2a40362dd3a 100644 --- a/net/netfilter/ipset/ip_set_hash_netport.c +++ b/net/netfilter/ipset/ip_set_hash_netport.c | |||
@@ -526,7 +526,7 @@ static struct ip_set_type hash_netport_type __read_mostly = { | |||
526 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, | 526 | .features = IPSET_TYPE_IP | IPSET_TYPE_PORT, |
527 | .dimension = IPSET_DIM_TWO, | 527 | .dimension = IPSET_DIM_TWO, |
528 | .family = AF_UNSPEC, | 528 | .family = AF_UNSPEC, |
529 | .revision = 0, | 529 | .revision = 1, |
530 | .create = hash_netport_create, | 530 | .create = hash_netport_create, |
531 | .create_policy = { | 531 | .create_policy = { |
532 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, | 532 | [IPSET_ATTR_HASHSIZE] = { .type = NLA_U32 }, |