diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-03-18 17:24:50 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-03-18 17:24:50 +0100 |
commit | f284b0d07b5d99e745312cbcc0fd95a6a4a7f5b4 (patch) | |
tree | 8dc08a86b3c9cc78456aaff8995db2f6f4fca9c6 /lib | |
parent | 6b88433a9334f3f0fc44ee52867326ce20c4af15 (diff) |
SCTP, UDPLITE support added
SCTP and UDPLITE port support added to the hash:*port* types.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/parse.c | 5 | ||||
-rw-r--r-- | lib/print.c | 2 | ||||
-rw-r--r-- | lib/types.c | 28 |
3 files changed, 18 insertions, 17 deletions
diff --git a/lib/parse.c b/lib/parse.c index cd1ad32..0c15231 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -500,10 +500,9 @@ ipset_parse_proto_port(struct ipset_session *session, p = *(const uint8_t *) ipset_data_get(data, IPSET_OPT_PROTO); switch (p) { case IPPROTO_TCP: - proto = tmp; - tmp = a; - goto parse_port; + case IPPROTO_SCTP: case IPPROTO_UDP: + case IPPROTO_UDPLITE: proto = tmp; tmp = a; goto parse_port; diff --git a/lib/print.c b/lib/print.c index 5284b0a..66b9c1a 100644 --- a/lib/print.c +++ b/lib/print.c @@ -585,7 +585,9 @@ ipset_print_proto_port(char *buf, unsigned int len, switch (proto) { case IPPROTO_TCP: + case IPPROTO_SCTP: case IPPROTO_UDP: + case IPPROTO_UDPLITE: break; case IPPROTO_ICMP: return ipset_print_icmp(buf + offset, len, data, diff --git a/lib/types.c b/lib/types.c index 5eb53c4..f0dbbc9 100644 --- a/lib/types.c +++ b/lib/types.c @@ -198,7 +198,7 @@ create_type_get(struct ipset_session *session) struct ipset_data *data; const char *typename; uint8_t family, tmin = 0, tmax = 0; - const uint8_t *kmin, *kmax; + uint8_t kmin, kmax; int ret; data = ipset_session_data(session); @@ -240,32 +240,32 @@ create_type_get(struct ipset_session *session) if (ret != 0) return NULL; - kmax = ipset_data_get(data, IPSET_OPT_REVISION); + kmax = *(const uint8_t *)ipset_data_get(data, IPSET_OPT_REVISION); if (ipset_data_test(data, IPSET_OPT_REVISION_MIN)) - kmin = ipset_data_get(data, IPSET_OPT_REVISION_MIN); + kmin = *(const uint8_t *)ipset_data_get(data, IPSET_OPT_REVISION_MIN); else kmin = kmax; - if (MAX(tmin, *kmin) > MIN(tmax, *kmax)) { - if (*kmin > tmax) + if (MAX(tmin, kmin) > MIN(tmax, kmax)) { + if (kmin > tmax) return ipset_errptr(session, - "Kernel supports %s type with family %s " - "in minimal revision %u while ipset library " - "in maximal revision %u. " - "You need to upgrade your ipset library.", + "Kernel supports %s type, family %s " + "with minimal revision %u while ipset program " + "with maximal revision %u.\n" + "You need to upgrade your ipset program.", typename, family == AF_INET ? "INET" : family == AF_INET6 ? "INET6" : "UNSPEC", - *kmin, tmax); + kmin, tmax); else return ipset_errptr(session, - "Kernel supports %s type with family %s " - "in maximal revision %u while ipset library " - "in minimal revision %u. " + "Kernel supports %s type, family %s " + "with maximal revision %u while ipset program " + "with minimal revision %u.\n" "You need to upgrade your kernel.", typename, family == AF_INET ? "INET" : family == AF_INET6 ? "INET6" : "UNSPEC", - *kmax, tmin); + kmax, tmin); } match->kernel_check = IPSET_KERNEL_OK; |