From c1dd8442aac6cadb29110f763f23cafc63135a79 Mon Sep 17 00:00:00 2001 From: Anton Danilov Date: Thu, 28 Aug 2014 10:11:31 +0400 Subject: libipset: Add userspace code for the skbinfo extension support. Add userspace code to support of the skbinfo extension independly of set types. Defines constants, flag and function for print/parse/send/recieve of skbinfo parameters. Signed-off-by: Anton Danilov Signed-off-by: Jozsef Kadlecsik --- include/libipset/data.h | 12 ++++++++++-- include/libipset/linux_ip_set.h | 12 ++++++++++++ include/libipset/parse.h | 6 ++++++ include/libipset/print.h | 6 ++++++ 4 files changed, 34 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libipset/data.h b/include/libipset/data.h index 06ece1e..945df54 100644 --- a/include/libipset/data.h +++ b/include/libipset/data.h @@ -62,6 +62,10 @@ enum ipset_opt { IPSET_OPT_BYTES, IPSET_OPT_CREATE_COMMENT, IPSET_OPT_ADT_COMMENT, + IPSET_OPT_SKBINFO, + IPSET_OPT_SKBMARK, + IPSET_OPT_SKBPRIO, + IPSET_OPT_SKBQUEUE, /* Internal options */ IPSET_OPT_FLAGS = 48, /* IPSET_FLAG_EXIST| */ IPSET_OPT_CADT_FLAGS, /* IPSET_FLAG_BEFORE| */ @@ -96,7 +100,8 @@ enum ipset_opt { | IPSET_FLAG(IPSET_OPT_SIZE) \ | IPSET_FLAG(IPSET_OPT_COUNTERS)\ | IPSET_FLAG(IPSET_OPT_CREATE_COMMENT)\ - | IPSET_FLAG(IPSET_OPT_FORCEADD)) + | IPSET_FLAG(IPSET_OPT_FORCEADD)\ + | IPSET_FLAG(IPSET_OPT_SKBINFO)) #define IPSET_ADT_FLAGS \ (IPSET_FLAG(IPSET_OPT_IP) \ @@ -119,7 +124,10 @@ enum ipset_opt { | IPSET_FLAG(IPSET_OPT_NOMATCH) \ | IPSET_FLAG(IPSET_OPT_PACKETS) \ | IPSET_FLAG(IPSET_OPT_BYTES) \ - | IPSET_FLAG(IPSET_OPT_ADT_COMMENT)) + | IPSET_FLAG(IPSET_OPT_ADT_COMMENT)\ + | IPSET_FLAG(IPSET_OPT_SKBMARK) \ + | IPSET_FLAG(IPSET_OPT_SKBPRIO) \ + | IPSET_FLAG(IPSET_OPT_SKBQUEUE)) struct ipset_data; diff --git a/include/libipset/linux_ip_set.h b/include/libipset/linux_ip_set.h index 7272b2b..ae4127d 100644 --- a/include/libipset/linux_ip_set.h +++ b/include/libipset/linux_ip_set.h @@ -116,6 +116,9 @@ enum { IPSET_ATTR_BYTES, IPSET_ATTR_PACKETS, IPSET_ATTR_COMMENT, + IPSET_ATTR_SKBMARK, + IPSET_ATTR_SKBPRIO, + IPSET_ATTR_SKBQUEUE, __IPSET_ATTR_ADT_MAX, }; #define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) @@ -148,6 +151,7 @@ enum ipset_errno { IPSET_ERR_COUNTER, IPSET_ERR_COMMENT, IPSET_ERR_INVALID_MARKMASK, + IPSET_ERR_SKBINFO, /* Type specific error codes */ IPSET_ERR_TYPE_SPECIFIC = 4352, @@ -171,6 +175,12 @@ enum ipset_cmd_flags { IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), IPSET_FLAG_BIT_RETURN_NOMATCH = 7, IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), + IPSET_FLAG_BIT_MAP_SKBMARK = 8, + IPSET_FLAG_MAP_SKBMARK = (1 << IPSET_FLAG_BIT_MAP_SKBMARK), + IPSET_FLAG_BIT_MAP_SKBPRIO = 9, + IPSET_FLAG_MAP_SKBPRIO = (1 << IPSET_FLAG_BIT_MAP_SKBPRIO), + IPSET_FLAG_BIT_MAP_SKBQUEUE = 10, + IPSET_FLAG_MAP_SKBQUEUE = (1 << IPSET_FLAG_BIT_MAP_SKBQUEUE), IPSET_FLAG_CMD_MAX = 15, }; @@ -188,6 +198,8 @@ enum ipset_cadt_flags { IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), IPSET_FLAG_BIT_WITH_FORCEADD = 5, IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD), + IPSET_FLAG_BIT_WITH_SKBINFO = 6, + IPSET_FLAG_WITH_SKBINFO = (1 << IPSET_FLAG_BIT_WITH_SKBINFO), IPSET_FLAG_CADT_MAX = 15, }; diff --git a/include/libipset/parse.h b/include/libipset/parse.h index 55981f2..810ea28 100644 --- a/include/libipset/parse.h +++ b/include/libipset/parse.h @@ -82,6 +82,8 @@ extern int ipset_parse_uint64(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_uint32(struct ipset_session *session, enum ipset_opt opt, const char *str); +extern int ipset_parse_uint16(struct ipset_session *session, + enum ipset_opt opt, const char *str); extern int ipset_parse_uint8(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_netmask(struct ipset_session *session, @@ -94,6 +96,10 @@ extern int ipset_parse_iface(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_comment(struct ipset_session *session, enum ipset_opt opt, const char *str); +extern int ipset_parse_skbmark(struct ipset_session *session, + enum ipset_opt opt, const char *str); +extern int ipset_parse_skbprio(struct ipset_session *session, + enum ipset_opt opt, const char *str); extern int ipset_parse_output(struct ipset_session *session, int opt, const char *str); extern int ipset_parse_ignored(struct ipset_session *session, diff --git a/include/libipset/print.h b/include/libipset/print.h index b8fa709..8f672c3 100644 --- a/include/libipset/print.h +++ b/include/libipset/print.h @@ -46,6 +46,12 @@ extern int ipset_print_iface(char *buf, unsigned int len, extern int ipset_print_comment(char *buf, unsigned int len, const struct ipset_data *data, enum ipset_opt opt, uint8_t env); +extern int ipset_print_skbmark(char *buf, unsigned int len, + const struct ipset_data *data, + enum ipset_opt opt, uint8_t env); +extern int ipset_print_skbprio(char *buf, unsigned int len, + const struct ipset_data *data, + enum ipset_opt opt, uint8_t env); extern int ipset_print_proto(char *buf, unsigned int len, const struct ipset_data *data, enum ipset_opt opt, uint8_t env); -- cgit v1.2.3