Skip to contentSkip to conversation

ipset: SCTP, UDPLITE support added to the bitmap:port type

PATCH New Quan Tian 1 participant 1 message Dec 30, 2021

Subsystems (2)
lore
Share & tools
lore

Quan Tian

author
#0 lore raw

PATCH 1/1 ipset: SCTP, UDPLITE support added to the bitmap:port type

Currently hash:*port* types support SCTP and UDPLITE while bitmap:port doesn't.

ip_set_get_ip4_port() and ip_set_get_ip6_port() can get SCTP and TCPLITE port. This patch adds SCTP and UDPLITE support to bitmap:port type by making ip_set_get_ip_port() return true for the two protocols.

---
 .../net/netfilter/ipset/ip_set_bitmap_port.c  |  5 +-
 lib/ipset_bitmap_port.c                       | 74 +++++++++++++++++++
 src/ipset.8                                   |  2 +-
 3 files changed, 79 insertions(+), 2 deletions(-)
kernel/net/netfilter/ipset/ip_set_bitmap_port.c +4 -1
index 2a570d8..5a43d9c 100644
@@ -20,7 +20,8 @@
 #define IPSET_TYPE_REV_MIN	0
 /*				1	   Counter support added */
 /*				2	   Comment support added */
-#define IPSET_TYPE_REV_MAX	3	/* skbinfo support added */
+/*				3	   skbinfo support added */
+#define IPSET_TYPE_REV_MAX	4	/* SCTP and UDPLITE support added */
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jozsef Kadlecsik <[email protected]>");
@@ -119,7 +120,9 @@ ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src, __be16 *port)
 		return ret;
 	switch (proto) {
 	case IPPROTO_TCP:
+	case IPPROTO_SCTP:
 	case IPPROTO_UDP:
+	case IPPROTO_UDPLITE:
 		return true;
 	default:
 		return false;
lib/ipset_bitmap_port.c +74 -0

84 lines not on this page · raw message

src/ipset.8 +1 -1
index 269b9b5..5fa4577 100644
@@ -504,7 +504,7 @@ Mandatory options to use when creating a \fBbitmap:port\fR type of set:
 Create the set from the specified inclusive port range.
 .PP
 The \fBset\fR match and \fBSET\fR target netfilter kernel modules interpret
-the stored numbers as TCP or UDP port numbers.
+the stored numbers as TCP, SCTP, UDP or UDPLITE port numbers.
 .PP
 \fBproto\fR only needs to be specified if a service name is used
 and that name does not exist as a TCP service. The protocol is never stored
Signature · 1 line
2.21.1 (Apple Git-122.3)