Hello community, here is the log from the commit of package libnftnl for openSUSE:Factory checked in at 2019-06-12 12:58:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libnftnl (Old) and /work/SRC/openSUSE:Factory/.libnftnl.new.4811 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libnftnl" Wed Jun 12 12:58:24 2019 rev:14 rq:705873 version:1.1.3 Changes: -------- --- /work/SRC/openSUSE:Factory/libnftnl/libnftnl.changes 2018-11-18 23:22:13.686206136 +0100 +++ /work/SRC/openSUSE:Factory/.libnftnl.new.4811/libnftnl.changes 2019-06-12 12:58:25.621339033 +0200 @@ -1,0 +2,8 @@ +Tue May 28 08:30:59 UTC 2019 - Jan Engelhardt <[email protected]> + +- Update to new upstream release 1.1.3 + * expr: osf: add version option support + * udata: add NFTNL_UDATA_* definitions + * chain: support per chain rules listing + +------------------------------------------------------------------- Old: ---- libnftnl-1.1.2.tar.bz2 libnftnl-1.1.2.tar.bz2.sig New: ---- libnftnl-1.1.3.tar.bz2 libnftnl-1.1.3.tar.bz2.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libnftnl.spec ++++++ --- /var/tmp/diff_new_pack.fLrm03/_old 2019-06-12 12:58:26.465338845 +0200 +++ /var/tmp/diff_new_pack.fLrm03/_new 2019-06-12 12:58:26.473338844 +0200 @@ -1,7 +1,7 @@ # # spec file for package libnftnl # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ Name: libnftnl %define lname libnftnl11 -Version: 1.1.2 +Version: 1.1.3 Release: 0 Summary: Userspace library to access the nftables Netlink interface License: GPL-2.0-or-later ++++++ libnftnl-1.1.2.tar.bz2 -> libnftnl-1.1.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/Make_global.am new/libnftnl-1.1.3/Make_global.am --- old/libnftnl-1.1.2/Make_global.am 2018-11-13 12:02:34.898977261 +0100 +++ new/libnftnl-1.1.3/Make_global.am 2019-05-27 13:52:31.656824522 +0200 @@ -18,7 +18,7 @@ # set age to 0. # </snippet> # -LIBVERSION=11:0:0 +LIBVERSION=12:0:1 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include ${LIBMNL_CFLAGS} ${LIBMXML_CFLAGS} AM_CFLAGS = ${regular_CFLAGS} ${GCC_FVISIBILITY_HIDDEN} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/Makefile.in new/libnftnl-1.1.3/Makefile.in --- old/libnftnl-1.1.2/Makefile.in 2018-11-13 12:02:42.618962979 +0100 +++ new/libnftnl-1.1.3/Makefile.in 2019-05-27 13:52:39.144815863 +0200 @@ -387,7 +387,7 @@ # set age to 0. # </snippet> # -LIBVERSION = 11:0:0 +LIBVERSION = 12:0:1 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include ${LIBMNL_CFLAGS} ${LIBMXML_CFLAGS} AM_CFLAGS = ${regular_CFLAGS} ${GCC_FVISIBILITY_HIDDEN} ACLOCAL_AMFLAGS = -I m4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/configure new/libnftnl-1.1.3/configure --- old/libnftnl-1.1.2/configure 2018-11-13 12:02:41.558964945 +0100 +++ new/libnftnl-1.1.3/configure 2019-05-27 13:52:38.072817104 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libnftnl 1.1.2. +# Generated by GNU Autoconf 2.69 for libnftnl 1.1.3. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='libnftnl' PACKAGE_TARNAME='libnftnl' -PACKAGE_VERSION='1.1.2' -PACKAGE_STRING='libnftnl 1.1.2' +PACKAGE_VERSION='1.1.3' +PACKAGE_STRING='libnftnl 1.1.3' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1333,7 +1333,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libnftnl 1.1.2 to adapt to many kinds of systems. +\`configure' configures libnftnl 1.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1404,7 +1404,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libnftnl 1.1.2:";; + short | recursive ) echo "Configuration of libnftnl 1.1.3:";; esac cat <<\_ACEOF @@ -1522,7 +1522,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libnftnl configure 1.1.2 +libnftnl configure 1.1.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1800,7 +1800,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libnftnl $as_me 1.1.2, which was +It was created by libnftnl $as_me 1.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3821,7 +3821,7 @@ # Define the identity of the package. PACKAGE='libnftnl' - VERSION='1.1.2' + VERSION='1.1.3' cat >>confdefs.h <<_ACEOF @@ -13580,7 +13580,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libnftnl $as_me 1.1.2, which was +This file was extended by libnftnl $as_me 1.1.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13646,7 +13646,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libnftnl config.status 1.1.2 +libnftnl config.status 1.1.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/configure.ac new/libnftnl-1.1.3/configure.ac --- old/libnftnl-1.1.2/configure.ac 2018-11-13 12:02:34.898977261 +0100 +++ new/libnftnl-1.1.3/configure.ac 2019-05-27 13:52:31.656824522 +0200 @@ -1,6 +1,6 @@ dnl Process this file with autoconf to create configure. -AC_INIT([libnftnl], [1.1.2]) +AC_INIT([libnftnl], [1.1.3]) AC_CONFIG_AUX_DIR([build-aux]) AC_CANONICAL_HOST AC_CONFIG_MACRO_DIR([m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/examples/Makefile.in new/libnftnl-1.1.3/examples/Makefile.in --- old/libnftnl-1.1.2/examples/Makefile.in 2018-11-13 12:02:42.686962852 +0100 +++ new/libnftnl-1.1.3/examples/Makefile.in 2019-05-27 13:52:39.216815780 +0200 @@ -481,7 +481,7 @@ # set age to 0. # </snippet> # -LIBVERSION = 11:0:0 +LIBVERSION = 12:0:1 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include ${LIBMNL_CFLAGS} ${LIBMXML_CFLAGS} AM_CFLAGS = ${regular_CFLAGS} ${GCC_FVISIBILITY_HIDDEN} nft_table_add_SOURCES = nft-table-add.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/Makefile.am new/libnftnl-1.1.3/include/Makefile.am --- old/libnftnl-1.1.2/include/Makefile.am 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/Makefile.am 2019-05-27 13:52:31.656824522 +0200 @@ -10,6 +10,7 @@ set.h \ common.h \ expr.h \ + rule.h \ set_elem.h \ udata.h \ utils.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/Makefile.in new/libnftnl-1.1.3/include/Makefile.in --- old/libnftnl-1.1.2/include/Makefile.in 2018-11-13 12:02:42.706962815 +0100 +++ new/libnftnl-1.1.3/include/Makefile.in 2019-05-27 13:52:39.240815752 +0200 @@ -320,6 +320,7 @@ set.h \ common.h \ expr.h \ + rule.h \ set_elem.h \ udata.h \ utils.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/internal.h new/libnftnl-1.1.3/include/internal.h --- old/libnftnl-1.1.2/include/internal.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/internal.h 2019-05-27 13:52:31.656824522 +0200 @@ -12,5 +12,6 @@ #include "expr.h" #include "expr_ops.h" #include "buffer.h" +#include "rule.h" #endif /* _LIBNFTNL_INTERNAL_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/libnftnl/chain.h new/libnftnl-1.1.3/include/libnftnl/chain.h --- old/libnftnl-1.1.2/include/libnftnl/chain.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/libnftnl/chain.h 2019-05-27 13:52:31.656824522 +0200 @@ -13,6 +13,7 @@ #endif struct nftnl_chain; +struct nftnl_rule; struct nftnl_chain *nftnl_chain_alloc(void); void nftnl_chain_free(const struct nftnl_chain *); @@ -54,6 +55,12 @@ int32_t nftnl_chain_get_s32(const struct nftnl_chain *c, uint16_t attr); uint64_t nftnl_chain_get_u64(const struct nftnl_chain *c, uint16_t attr); +void nftnl_chain_rule_add(struct nftnl_rule *rule, struct nftnl_chain *c); +void nftnl_chain_rule_del(struct nftnl_rule *rule); +void nftnl_chain_rule_add_tail(struct nftnl_rule *rule, struct nftnl_chain *c); +void nftnl_chain_rule_insert_at(struct nftnl_rule *rule, struct nftnl_rule *pos); +void nftnl_chain_rule_append_at(struct nftnl_rule *rule, struct nftnl_rule *pos); + struct nlmsghdr; void nftnl_chain_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_chain *t); @@ -68,12 +75,24 @@ #define nftnl_chain_nlmsg_build_hdr nftnl_nlmsg_build_hdr int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *t); +int nftnl_rule_foreach(struct nftnl_chain *c, + int (*cb)(struct nftnl_rule *r, void *data), + void *data); +struct nftnl_rule *nftnl_rule_lookup_byindex(struct nftnl_chain *c, uint32_t index); + +struct nftnl_rule_iter; + +struct nftnl_rule_iter *nftnl_rule_iter_create(const struct nftnl_chain *c); +struct nftnl_rule *nftnl_rule_iter_next(struct nftnl_rule_iter *iter); +void nftnl_rule_iter_destroy(struct nftnl_rule_iter *iter); + struct nftnl_chain_list; struct nftnl_chain_list *nftnl_chain_list_alloc(void); void nftnl_chain_list_free(struct nftnl_chain_list *list); int nftnl_chain_list_is_empty(const struct nftnl_chain_list *list); int nftnl_chain_list_foreach(struct nftnl_chain_list *chain_list, int (*cb)(struct nftnl_chain *t, void *data), void *data); +struct nftnl_chain *nftnl_chain_list_lookup_byname(struct nftnl_chain_list *chain_list, const char *chain); void nftnl_chain_list_add(struct nftnl_chain *r, struct nftnl_chain_list *list); void nftnl_chain_list_add_tail(struct nftnl_chain *r, struct nftnl_chain_list *list); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/libnftnl/expr.h new/libnftnl-1.1.3/include/libnftnl/expr.h --- old/libnftnl-1.1.2/include/libnftnl/expr.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/libnftnl/expr.h 2019-05-27 13:52:31.656824522 +0200 @@ -55,8 +55,8 @@ NFTNL_EXPR_NG_MODULUS, NFTNL_EXPR_NG_TYPE, NFTNL_EXPR_NG_OFFSET, - NFTNL_EXPR_NG_SET_NAME, - NFTNL_EXPR_NG_SET_ID, + NFTNL_EXPR_NG_SET_NAME, /* deprecated */ + NFTNL_EXPR_NG_SET_ID, /* deprecated */ }; enum { @@ -259,8 +259,8 @@ NFTNL_EXPR_HASH_SEED, NFTNL_EXPR_HASH_OFFSET, NFTNL_EXPR_HASH_TYPE, - NFTNL_EXPR_HASH_SET_NAME, - NFTNL_EXPR_HASH_SET_ID, + NFTNL_EXPR_HASH_SET_NAME, /* deprecated */ + NFTNL_EXPR_HASH_SET_ID, /* deprecated */ }; enum { @@ -280,6 +280,7 @@ enum { NFTNL_EXPR_OSF_DREG = NFTNL_EXPR_BASE, NFTNL_EXPR_OSF_TTL, + NFTNL_EXPR_OSF_FLAGS, }; enum { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/libnftnl/gen.h new/libnftnl-1.1.3/include/libnftnl/gen.h --- old/libnftnl-1.1.2/include/libnftnl/gen.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/libnftnl/gen.h 2019-05-27 13:52:31.660824518 +0200 @@ -42,7 +42,6 @@ int nftnl_gen_fprintf(FILE *fp, const struct nftnl_gen *gen, uint32_t type, uint32_t flags); #define nftnl_gen_nlmsg_build_hdr nftnl_nlmsg_build_hdr -int nftnl_gen_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_gen *gen); #ifdef __cplusplus } /* extern "C" */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/libnftnl/rule.h new/libnftnl-1.1.3/include/libnftnl/rule.h --- old/libnftnl-1.1.2/include/libnftnl/rule.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/libnftnl/rule.h 2019-05-27 13:52:31.660824518 +0200 @@ -28,6 +28,7 @@ NFTNL_RULE_POSITION, NFTNL_RULE_USERDATA, NFTNL_RULE_ID, + NFTNL_RULE_POSITION_ID, __NFTNL_RULE_MAX }; #define NFTNL_RULE_MAX (__NFTNL_RULE_MAX - 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/libnftnl/udata.h new/libnftnl-1.1.3/include/libnftnl/udata.h --- old/libnftnl-1.1.2/include/libnftnl/udata.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/libnftnl/udata.h 2019-05-27 13:52:31.660824518 +0200 @@ -9,6 +9,39 @@ extern "C" { #endif +enum nftnl_udata_rule_types { + NFTNL_UDATA_RULE_COMMENT, + NFTNL_UDATA_RULE_EBTABLES_POLICY, + __NFTNL_UDATA_RULE_MAX +}; +#define NFTNL_UDATA_RULE_MAX (__NFTNL_UDATA_RULE_MAX - 1) + +#define NFTNL_UDATA_COMMENT_MAXLEN 128 + +enum nftnl_udata_set_types { + NFTNL_UDATA_SET_KEYBYTEORDER, + NFTNL_UDATA_SET_DATABYTEORDER, + NFTNL_UDATA_SET_MERGE_ELEMENTS, + __NFTNL_UDATA_SET_MAX +}; +#define NFTNL_UDATA_SET_MAX (__NFTNL_UDATA_SET_MAX - 1) + +enum nftnl_udata_set_elem_types { + NFTNL_UDATA_SET_ELEM_COMMENT, + NFTNL_UDATA_SET_ELEM_FLAGS, + __NFTNL_UDATA_SET_ELEM_MAX +}; +#define NFTNL_UDATA_SET_ELEM_MAX (__NFTNL_UDATA_SET_ELEM_MAX - 1) + +/** + * enum nftnl_udata_set_elem_flags - meaning of bits in UDATA_SET_ELEM_FLAGS + * + * @SET_ELEM_F_INTERVAL_OPEN: set element denotes a half-open range + */ +enum nftnl_udata_set_elem_flags { + NFTNL_SET_ELEM_F_INTERVAL_OPEN = 0x1, +}; + /* * nftnl user data attributes API */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/linux/netfilter/nf_tables.h new/libnftnl-1.1.3/include/linux/netfilter/nf_tables.h --- old/libnftnl-1.1.2/include/linux/netfilter/nf_tables.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/linux/netfilter/nf_tables.h 2019-05-27 13:52:31.660824518 +0200 @@ -218,6 +218,7 @@ * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64) * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN) * @NFTA_RULE_ID: uniquely identifies a rule in a transaction (NLA_U32) + * @NFTA_RULE_POSITION_ID: transaction unique identifier of the previous rule (NLA_U32) */ enum nft_rule_attributes { NFTA_RULE_UNSPEC, @@ -230,6 +231,7 @@ NFTA_RULE_USERDATA, NFTA_RULE_PAD, NFTA_RULE_ID, + NFTA_RULE_POSITION_ID, __NFTA_RULE_MAX }; #define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1) @@ -870,8 +872,8 @@ NFTA_HASH_SEED, NFTA_HASH_OFFSET, NFTA_HASH_TYPE, - NFTA_HASH_SET_NAME, - NFTA_HASH_SET_ID, + NFTA_HASH_SET_NAME, /* deprecated */ + NFTA_HASH_SET_ID, /* deprecated */ __NFTA_HASH_MAX, }; #define NFTA_HASH_MAX (__NFTA_HASH_MAX - 1) @@ -938,11 +940,13 @@ * * @NFTA_OSF_DREG: destination register (NLA_U32) * @NFTA_OSF_TTL: Value of the TTL osf option (NLA_U8) + * @NFTA_OSF_FLAGS: flags (NLA_U32) */ enum nft_osf_attributes { NFTA_OSF_UNSPEC, NFTA_OSF_DREG, NFTA_OSF_TTL, + NFTA_OSF_FLAGS, __NFTA_OSF_MAX, }; #define NFTA_OSF_MAX (__NFTA_OSF_MAX - 1) @@ -1611,8 +1615,8 @@ NFTA_NG_MODULUS, NFTA_NG_TYPE, NFTA_NG_OFFSET, - NFTA_NG_SET_NAME, - NFTA_NG_SET_ID, + NFTA_NG_SET_NAME, /* deprecated */ + NFTA_NG_SET_ID, /* deprecated */ __NFTA_NG_MAX }; #define NFTA_NG_MAX (__NFTA_NG_MAX - 1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/rule.h new/libnftnl-1.1.3/include/rule.h --- old/libnftnl-1.1.2/include/rule.h 1970-01-01 01:00:00.000000000 +0100 +++ new/libnftnl-1.1.3/include/rule.h 2019-05-27 13:52:31.660824518 +0200 @@ -0,0 +1,27 @@ +#ifndef _LIBNFTNL_RULE_INTERNAL_H_ +#define _LIBNFTNL_RULE_INTERNAL_H_ + +struct nftnl_rule { + struct list_head head; + + uint32_t flags; + uint32_t family; + const char *table; + const char *chain; + uint64_t handle; + uint64_t position; + uint32_t id; + uint32_t position_id; + struct { + void *data; + uint32_t len; + } user; + struct { + uint32_t flags; + uint32_t proto; + } compat; + + struct list_head expr_list; +}; + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/include/set_elem.h new/libnftnl-1.1.3/include/set_elem.h --- old/libnftnl-1.1.2/include/set_elem.h 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/include/set_elem.h 2019-05-27 13:52:31.660824518 +0200 @@ -6,10 +6,10 @@ struct nftnl_set_elem { struct list_head head; uint32_t set_elem_flags; + uint32_t flags; union nftnl_data_reg key; union nftnl_data_reg data; struct nftnl_expr *expr; - uint32_t flags; uint64_t timeout; uint64_t expiration; const char *objref; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/Makefile.in new/libnftnl-1.1.3/src/Makefile.in --- old/libnftnl-1.1.2/src/Makefile.in 2018-11-13 12:02:42.806962630 +0100 +++ new/libnftnl-1.1.3/src/Makefile.in 2019-05-27 13:52:39.352815623 +0200 @@ -363,7 +363,7 @@ # set age to 0. # </snippet> # -LIBVERSION = 11:0:0 +LIBVERSION = 12:0:1 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include ${LIBMNL_CFLAGS} ${LIBMXML_CFLAGS} AM_CFLAGS = ${regular_CFLAGS} ${GCC_FVISIBILITY_HIDDEN} lib_LTLIBRARIES = libnftnl.la diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/chain.c new/libnftnl-1.1.3/src/chain.c --- old/libnftnl-1.1.2/src/chain.c 2018-11-13 12:02:34.902977253 +0100 +++ new/libnftnl-1.1.3/src/chain.c 2019-05-27 13:52:31.660824518 +0200 @@ -27,10 +27,12 @@ #include <linux/netfilter_arp.h> #include <libnftnl/chain.h> +#include <libnftnl/rule.h> #include <buffer.h> struct nftnl_chain { struct list_head head; + struct hlist_node hnode; const char *name; const char *type; @@ -45,6 +47,8 @@ uint64_t bytes; uint64_t handle; uint32_t flags; + + struct list_head rule_list; }; static const char *nftnl_hooknum2str(int family, int hooknum) @@ -90,12 +94,25 @@ EXPORT_SYMBOL(nftnl_chain_alloc); struct nftnl_chain *nftnl_chain_alloc(void) { - return calloc(1, sizeof(struct nftnl_chain)); + struct nftnl_chain *c; + + c = calloc(1, sizeof(struct nftnl_chain)); + if (c == NULL) + return NULL; + + INIT_LIST_HEAD(&c->rule_list); + + return c; } EXPORT_SYMBOL(nftnl_chain_free); void nftnl_chain_free(const struct nftnl_chain *c) { + struct nftnl_rule *r, *tmp; + + list_for_each_entry_safe(r, tmp, &c->rule_list, head) + nftnl_rule_free(r); + if (c->flags & (1 << NFTNL_CHAIN_NAME)) xfree(c->name); if (c->flags & (1 << NFTNL_CHAIN_TABLE)) @@ -406,6 +423,36 @@ mnl_attr_put_strz(nlh, NFTA_CHAIN_TYPE, c->type); } +EXPORT_SYMBOL(nftnl_chain_rule_add); +void nftnl_chain_rule_add(struct nftnl_rule *rule, struct nftnl_chain *c) +{ + list_add(&rule->head, &c->rule_list); +} + +EXPORT_SYMBOL(nftnl_chain_rule_del); +void nftnl_chain_rule_del(struct nftnl_rule *r) +{ + list_del(&r->head); +} + +EXPORT_SYMBOL(nftnl_chain_rule_add_tail); +void nftnl_chain_rule_add_tail(struct nftnl_rule *rule, struct nftnl_chain *c) +{ + list_add_tail(&rule->head, &c->rule_list); +} + +EXPORT_SYMBOL(nftnl_chain_rule_insert_at); +void nftnl_chain_rule_insert_at(struct nftnl_rule *rule, struct nftnl_rule *pos) +{ + list_add_tail(&rule->head, &pos->head); +} + +EXPORT_SYMBOL(nftnl_chain_rule_append_at); +void nftnl_chain_rule_append_at(struct nftnl_rule *rule, struct nftnl_rule *pos) +{ + list_add(&rule->head, &pos->head); +} + static int nftnl_chain_parse_attr_cb(const struct nlattr *attr, void *data) { const struct nlattr **tb = data; @@ -684,20 +731,109 @@ nftnl_chain_do_snprintf); } +EXPORT_SYMBOL(nftnl_rule_foreach); +int nftnl_rule_foreach(struct nftnl_chain *c, + int (*cb)(struct nftnl_rule *r, void *data), + void *data) +{ + struct nftnl_rule *cur, *tmp; + int ret; + + list_for_each_entry_safe(cur, tmp, &c->rule_list, head) { + ret = cb(cur, data); + if (ret < 0) + return ret; + } + return 0; +} + +EXPORT_SYMBOL(nftnl_rule_lookup_byindex); +struct nftnl_rule * +nftnl_rule_lookup_byindex(struct nftnl_chain *c, uint32_t index) +{ + struct nftnl_rule *r; + + list_for_each_entry(r, &c->rule_list, head) { + if (!index) + return r; + index--; + } + return NULL; +} + +struct nftnl_rule_iter { + const struct nftnl_chain *c; + struct nftnl_rule *cur; +}; + +static void nftnl_rule_iter_init(const struct nftnl_chain *c, + struct nftnl_rule_iter *iter) +{ + iter->c = c; + if (list_empty(&c->rule_list)) + iter->cur = NULL; + else + iter->cur = list_entry(c->rule_list.next, struct nftnl_rule, + head); +} + +EXPORT_SYMBOL(nftnl_rule_iter_create); +struct nftnl_rule_iter *nftnl_rule_iter_create(const struct nftnl_chain *c) +{ + struct nftnl_rule_iter *iter; + + iter = calloc(1, sizeof(struct nftnl_rule_iter)); + if (iter == NULL) + return NULL; + + nftnl_rule_iter_init(c, iter); + + return iter; +} + +EXPORT_SYMBOL(nftnl_rule_iter_next); +struct nftnl_rule *nftnl_rule_iter_next(struct nftnl_rule_iter *iter) +{ + struct nftnl_rule *rule = iter->cur; + + if (rule == NULL) + return NULL; + + /* get next rule, if any */ + iter->cur = list_entry(iter->cur->head.next, struct nftnl_rule, head); + if (&iter->cur->head == iter->c->rule_list.next) + return NULL; + + return rule; +} + +EXPORT_SYMBOL(nftnl_rule_iter_destroy); +void nftnl_rule_iter_destroy(struct nftnl_rule_iter *iter) +{ + xfree(iter); +} + +#define CHAIN_NAME_HSIZE 512 + struct nftnl_chain_list { + struct list_head list; + struct hlist_head name_hash[CHAIN_NAME_HSIZE]; }; EXPORT_SYMBOL(nftnl_chain_list_alloc); struct nftnl_chain_list *nftnl_chain_list_alloc(void) { struct nftnl_chain_list *list; + int i; list = calloc(1, sizeof(struct nftnl_chain_list)); if (list == NULL) return NULL; INIT_LIST_HEAD(&list->list); + for (i = 0; i < CHAIN_NAME_HSIZE; i++) + INIT_HLIST_HEAD(&list->name_hash[i]); return list; } @@ -709,6 +845,7 @@ list_for_each_entry_safe(r, tmp, &list->list, head) { list_del(&r->head); + hlist_del(&r->hnode); nftnl_chain_free(r); } xfree(list); @@ -720,15 +857,31 @@ return list_empty(&list->list); } +static uint32_t djb_hash(const char *key) +{ + uint32_t i, hash = 5381; + + for (i = 0; i < strlen(key); i++) + hash = ((hash << 5) + hash) + key[i]; + + return hash; +} + EXPORT_SYMBOL(nftnl_chain_list_add); void nftnl_chain_list_add(struct nftnl_chain *r, struct nftnl_chain_list *list) { + int key = djb_hash(r->name) % CHAIN_NAME_HSIZE; + + hlist_add_head(&r->hnode, &list->name_hash[key]); list_add(&r->head, &list->list); } EXPORT_SYMBOL(nftnl_chain_list_add_tail); void nftnl_chain_list_add_tail(struct nftnl_chain *r, struct nftnl_chain_list *list) { + int key = djb_hash(r->name) % CHAIN_NAME_HSIZE; + + hlist_add_head(&r->hnode, &list->name_hash[key]); list_add_tail(&r->head, &list->list); } @@ -736,6 +889,7 @@ void nftnl_chain_list_del(struct nftnl_chain *r) { list_del(&r->head); + hlist_del(&r->hnode); } EXPORT_SYMBOL(nftnl_chain_list_foreach); @@ -754,6 +908,22 @@ return 0; } +EXPORT_SYMBOL(nftnl_chain_list_lookup_byname); +struct nftnl_chain * +nftnl_chain_list_lookup_byname(struct nftnl_chain_list *chain_list, + const char *chain) +{ + int key = djb_hash(chain) % CHAIN_NAME_HSIZE; + struct nftnl_chain *c; + struct hlist_node *n; + + hlist_for_each_entry(c, n, &chain_list->name_hash[key], hnode) { + if (!strcmp(chain, c->name)) + return c; + } + return NULL; +} + struct nftnl_chain_list_iter { const struct nftnl_chain_list *list; struct nftnl_chain *cur; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/expr/hash.c new/libnftnl-1.1.3/src/expr/hash.c --- old/libnftnl-1.1.2/src/expr/hash.c 2018-11-13 12:02:34.906977245 +0100 +++ new/libnftnl-1.1.3/src/expr/hash.c 2019-05-27 13:52:31.660824518 +0200 @@ -28,10 +28,6 @@ unsigned int modulus; unsigned int seed; unsigned int offset; - struct { - const char *name; - uint32_t id; - } map; }; static int @@ -61,14 +57,6 @@ case NFTNL_EXPR_HASH_TYPE: memcpy(&hash->type, data, sizeof(hash->type)); break; - case NFTNL_EXPR_HASH_SET_NAME: - hash->map.name = strdup(data); - if (!hash->map.name) - return -1; - break; - case NFTNL_EXPR_HASH_SET_ID: - memcpy(&hash->map.id, data, sizeof(hash->map.id)); - break; default: return -1; } @@ -103,12 +91,6 @@ case NFTNL_EXPR_HASH_TYPE: *data_len = sizeof(hash->type); return &hash->type; - case NFTNL_EXPR_HASH_SET_NAME: - *data_len = strlen(hash->map.name) + 1; - return hash->map.name; - case NFTNL_EXPR_HASH_SET_ID: - *data_len = sizeof(hash->map.id); - return &hash->map.id; } return NULL; } @@ -129,14 +111,9 @@ case NFTA_HASH_SEED: case NFTA_HASH_OFFSET: case NFTA_HASH_TYPE: - case NFTA_HASH_SET_ID: if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) abi_breakage(); break; - case NFTA_HASH_SET_NAME: - if (mnl_attr_validate(attr, MNL_TYPE_STRING) < 0) - abi_breakage(); - break; } tb[type] = attr; @@ -162,10 +139,6 @@ mnl_attr_put_u32(nlh, NFTA_HASH_OFFSET, htonl(hash->offset)); if (e->flags & (1 << NFTNL_EXPR_HASH_TYPE)) mnl_attr_put_u32(nlh, NFTA_HASH_TYPE, htonl(hash->type)); - if (e->flags & (1 << NFTNL_EXPR_HASH_SET_NAME)) - mnl_attr_put_str(nlh, NFTA_HASH_SET_NAME, hash->map.name); - if (e->flags & (1 << NFTNL_EXPR_HASH_SET_ID)) - mnl_attr_put_u32(nlh, NFTA_HASH_SET_ID, htonl(hash->map.id)); } static int @@ -206,16 +179,6 @@ hash->type = ntohl(mnl_attr_get_u32(tb[NFTA_HASH_TYPE])); e->flags |= (1 << NFTNL_EXPR_HASH_TYPE); } - if (tb[NFTA_HASH_SET_NAME]) { - hash->map.name = - strdup(mnl_attr_get_str(tb[NFTA_HASH_SET_NAME])); - e->flags |= (1 << NFTNL_EXPR_HASH_SET_NAME); - } - if (tb[NFTA_HASH_SET_ID]) { - hash->map.id = - ntohl(mnl_attr_get_u32(tb[NFTA_HASH_SET_ID])); - e->flags |= (1 << NFTNL_EXPR_HASH_SET_ID); - } return ret; } @@ -252,12 +215,6 @@ SNPRINTF_BUFFER_SIZE(ret, remain, offset); } - if (hash->map.id) { - ret = snprintf(buf + offset, remain, "set %s id %u ", - hash->map.name, hash->map.id); - SNPRINTF_BUFFER_SIZE(ret, remain, offset); - } - return offset; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/expr/numgen.c new/libnftnl-1.1.3/src/expr/numgen.c --- old/libnftnl-1.1.2/src/expr/numgen.c 2018-11-13 12:02:34.906977245 +0100 +++ new/libnftnl-1.1.3/src/expr/numgen.c 2019-05-27 13:52:31.664824514 +0200 @@ -25,10 +25,6 @@ unsigned int modulus; enum nft_ng_types type; unsigned int offset; - struct { - const char *name; - uint32_t id; - } map; }; static int @@ -50,14 +46,6 @@ case NFTNL_EXPR_NG_OFFSET: memcpy(&ng->offset, data, sizeof(ng->offset)); break; - case NFTNL_EXPR_NG_SET_NAME: - ng->map.name = strdup(data); - if (!ng->map.name) - return -1; - break; - case NFTNL_EXPR_NG_SET_ID: - memcpy(&ng->map.id, data, sizeof(ng->map.id)); - break; default: return -1; } @@ -83,12 +71,6 @@ case NFTNL_EXPR_NG_OFFSET: *data_len = sizeof(ng->offset); return &ng->offset; - case NFTNL_EXPR_NG_SET_NAME: - *data_len = strlen(ng->map.name) + 1; - return ng->map.name; - case NFTNL_EXPR_NG_SET_ID: - *data_len = sizeof(ng->map.id); - return &ng->map.id; } return NULL; } @@ -106,14 +88,9 @@ case NFTA_NG_MODULUS: case NFTA_NG_TYPE: case NFTA_NG_OFFSET: - case NFTA_NG_SET_ID: if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) abi_breakage(); break; - case NFTA_NG_SET_NAME: - if (mnl_attr_validate(attr, MNL_TYPE_STRING) < 0) - abi_breakage(); - break; } tb[type] = attr; @@ -133,10 +110,6 @@ mnl_attr_put_u32(nlh, NFTA_NG_TYPE, htonl(ng->type)); if (e->flags & (1 << NFTNL_EXPR_NG_OFFSET)) mnl_attr_put_u32(nlh, NFTA_NG_OFFSET, htonl(ng->offset)); - if (e->flags & (1 << NFTNL_EXPR_NG_SET_NAME)) - mnl_attr_put_str(nlh, NFTA_NG_SET_NAME, ng->map.name); - if (e->flags & (1 << NFTNL_EXPR_NG_SET_ID)) - mnl_attr_put_u32(nlh, NFTA_NG_SET_ID, htonl(ng->map.id)); } static int @@ -165,16 +138,6 @@ ng->offset = ntohl(mnl_attr_get_u32(tb[NFTA_NG_OFFSET])); e->flags |= (1 << NFTNL_EXPR_NG_OFFSET); } - if (tb[NFTA_NG_SET_NAME]) { - ng->map.name = - strdup(mnl_attr_get_str(tb[NFTA_NG_SET_NAME])); - e->flags |= (1 << NFTNL_EXPR_NG_SET_NAME); - } - if (tb[NFTA_NG_SET_ID]) { - ng->map.id = - ntohl(mnl_attr_get_u32(tb[NFTA_NG_SET_ID])); - e->flags |= (1 << NFTNL_EXPR_NG_SET_ID); - } return ret; } @@ -206,12 +169,6 @@ SNPRINTF_BUFFER_SIZE(ret, remain, offset); } - if (ng->map.id) { - ret = snprintf(buf + offset, remain, "set %s id %u ", - ng->map.name, ng->map.id); - SNPRINTF_BUFFER_SIZE(ret, remain, offset); - } - return offset; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/expr/osf.c new/libnftnl-1.1.3/src/expr/osf.c --- old/libnftnl-1.1.2/src/expr/osf.c 2018-11-13 12:02:34.906977245 +0100 +++ new/libnftnl-1.1.3/src/expr/osf.c 2019-05-27 13:52:31.664824514 +0200 @@ -15,6 +15,7 @@ struct nftnl_expr_osf { enum nft_registers dreg; uint8_t ttl; + uint32_t flags; }; static int nftnl_expr_osf_set(struct nftnl_expr *e, uint16_t type, @@ -29,6 +30,9 @@ case NFTNL_EXPR_OSF_TTL: memcpy(&osf->ttl, data, sizeof(osf->ttl)); break; + case NFTNL_EXPR_OSF_FLAGS: + memcpy(&osf->flags, data, sizeof(osf->flags)); + break; } return 0; } @@ -46,6 +50,9 @@ case NFTNL_EXPR_OSF_TTL: *data_len = sizeof(osf->ttl); return &osf->ttl; + case NFTNL_EXPR_OSF_FLAGS: + *data_len = sizeof(osf->flags); + return &osf->flags; } return NULL; } @@ -60,6 +67,7 @@ switch(type) { case NFTNL_EXPR_OSF_DREG: + case NFTNL_EXPR_OSF_FLAGS: if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) abi_breakage(); break; @@ -68,6 +76,7 @@ if (mnl_attr_validate(attr, MNL_TYPE_U8) < 0) abi_breakage(); break; + } tb[type] = attr; @@ -83,6 +92,9 @@ mnl_attr_put_u32(nlh, NFTNL_EXPR_OSF_DREG, htonl(osf->dreg)); if (e->flags & (1 << NFTNL_EXPR_OSF_TTL)) mnl_attr_put_u8(nlh, NFTNL_EXPR_OSF_TTL, osf->ttl); + if (e->flags & (1 << NFTNL_EXPR_OSF_FLAGS)) + if (osf->flags) + mnl_attr_put_u32(nlh, NFTNL_EXPR_OSF_FLAGS, htonl(osf->flags)); } static int @@ -104,6 +116,11 @@ e->flags |= (1 << NFTNL_EXPR_OSF_TTL); } + if (tb[NFTA_OSF_FLAGS]) { + osf->flags = ntohl(mnl_attr_get_u32(tb[NFTA_OSF_FLAGS])); + e->flags |= (1 << NFTNL_EXPR_OSF_FLAGS); + } + return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/flowtable.c new/libnftnl-1.1.3/src/flowtable.c --- old/libnftnl-1.1.2/src/flowtable.c 2018-11-13 12:02:34.910977239 +0100 +++ new/libnftnl-1.1.3/src/flowtable.c 2019-05-27 13:52:31.664824514 +0200 @@ -85,10 +85,9 @@ case NFTNL_FLOWTABLE_FLAGS: break; case NFTNL_FLOWTABLE_DEVICES: - for (i = 0; i < c->dev_array_len; i++) { + for (i = 0; i < c->dev_array_len; i++) xfree(c->dev_array[i]); - xfree(c->dev_array); - } + xfree(c->dev_array); break; default: return; @@ -146,10 +145,9 @@ len++; if (c->flags & (1 << NFTNL_FLOWTABLE_DEVICES)) { - for (i = 0; i < c->dev_array_len; i++) { + for (i = 0; i < c->dev_array_len; i++) xfree(c->dev_array[i]); - xfree(c->dev_array); - } + xfree(c->dev_array); } c->dev_array = calloc(len + 1, sizeof(char *)); @@ -163,6 +161,7 @@ break; case NFTNL_FLOWTABLE_SIZE: memcpy(&c->size, data, sizeof(c->size)); + break; case NFTNL_FLOWTABLE_FLAGS: memcpy(&c->ft_flags, data, sizeof(c->ft_flags)); break; @@ -246,7 +245,7 @@ uint32_t nftnl_flowtable_get_u32(const struct nftnl_flowtable *c, uint16_t attr) { - uint32_t data_len; + uint32_t data_len = 0; const uint32_t *val = nftnl_flowtable_get_data(c, attr, &data_len); nftnl_assert(val, attr, data_len == sizeof(uint32_t)); @@ -257,7 +256,7 @@ int32_t nftnl_flowtable_get_s32(const struct nftnl_flowtable *c, uint16_t attr) { - uint32_t data_len; + uint32_t data_len = 0; const int32_t *val = nftnl_flowtable_get_data(c, attr, &data_len); nftnl_assert(val, attr, data_len == sizeof(int32_t)); @@ -365,7 +364,7 @@ mnl_attr_for_each_nested(attr, nest) { if (mnl_attr_get_type(attr) != NFTA_DEVICE_NAME) - return -1; + goto err; dev_array[len++] = strdup(mnl_attr_get_str(attr)); if (len >= 8) break; @@ -376,14 +375,18 @@ c->dev_array = calloc(len + 1, sizeof(char *)); if (!c->dev_array) - return -1; + goto err; c->dev_array_len = len; for (i = 0; i < len; i++) - c->dev_array[i] = strdup(dev_array[i]); + c->dev_array[i] = dev_array[i]; return 0; +err: + while (len--) + xfree(dev_array[len]); + return -1; } static int nftnl_flowtable_parse_hook(struct nlattr *attr, struct nftnl_flowtable *c) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/libnftnl.map new/libnftnl-1.1.3/src/libnftnl.map --- old/libnftnl-1.1.2/src/libnftnl.map 2018-11-13 12:02:34.910977239 +0100 +++ new/libnftnl-1.1.3/src/libnftnl.map 2019-05-27 13:52:31.664824514 +0200 @@ -214,14 +214,14 @@ nftnl_gen_alloc; nftnl_gen_free; - nftnl_gen_attr_is_set; - nftnl_gen_attr_unset; - nftnl_gen_attr_set_data; - nftnl_gen_attr_set; - nftnl_gen_attr_set_u32; - nftnl_gen_attr_get_data; - nftnl_gen_attr_get; - nftnl_gen_attr_get_u32; + nftnl_gen_is_set; + nftnl_gen_unset; + nftnl_gen_set_data; + nftnl_gen_set; + nftnl_gen_set_u32; + nftnl_gen_get_data; + nftnl_gen_get; + nftnl_gen_get_u32; nftnl_gen_nlmsg_parse; nftnl_gen_snprintf; nftnl_gen_fprintf; @@ -336,3 +336,18 @@ local: *; }; + +LIBNFTNL_12 { + nftnl_chain_rule_add; + nftnl_chain_rule_add_tail; + nftnl_chain_rule_del; + nftnl_chain_rule_insert_at; + nftnl_chain_rule_append_at; + nftnl_rule_foreach; + nftnl_rule_iter_create; + nftnl_rule_iter_next; + nftnl_rule_iter_destroy; + + nftnl_chain_list_lookup_byname; + nftnl_rule_lookup_byindex; +} LIBNFTNL_11; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/object.c new/libnftnl-1.1.3/src/object.c --- old/libnftnl-1.1.2/src/object.c 2018-11-13 12:02:34.910977239 +0100 +++ new/libnftnl-1.1.3/src/object.c 2019-05-27 13:52:31.664824514 +0200 @@ -25,7 +25,7 @@ #include <buffer.h> #include "obj.h" -static struct obj_ops *obj_ops[] = { +static struct obj_ops *obj_ops[__NFT_OBJECT_MAX] = { [NFT_OBJECT_COUNTER] = &obj_ops_counter, [NFT_OBJECT_QUOTA] = &obj_ops_quota, [NFT_OBJECT_CT_HELPER] = &obj_ops_ct_helper, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/src/rule.c new/libnftnl-1.1.3/src/rule.c --- old/libnftnl-1.1.2/src/rule.c 2018-11-13 12:02:34.910977239 +0100 +++ new/libnftnl-1.1.3/src/rule.c 2019-05-27 13:52:31.664824514 +0200 @@ -30,28 +30,6 @@ #include <libnftnl/set.h> #include <libnftnl/expr.h> -struct nftnl_rule { - struct list_head head; - - uint32_t flags; - uint32_t family; - const char *table; - const char *chain; - uint64_t handle; - uint64_t position; - uint32_t id; - struct { - void *data; - uint32_t len; - } user; - struct { - uint32_t flags; - uint32_t proto; - } compat; - - struct list_head expr_list; -}; - EXPORT_SYMBOL(nftnl_rule_alloc); struct nftnl_rule *nftnl_rule_alloc(void) { @@ -109,6 +87,7 @@ case NFTNL_RULE_POSITION: case NFTNL_RULE_FAMILY: case NFTNL_RULE_ID: + case NFTNL_RULE_POSITION_ID: break; case NFTNL_RULE_USERDATA: xfree(r->user.data); @@ -125,6 +104,7 @@ [NFTNL_RULE_FAMILY] = sizeof(uint32_t), [NFTNL_RULE_POSITION] = sizeof(uint64_t), [NFTNL_RULE_ID] = sizeof(uint32_t), + [NFTNL_RULE_POSITION_ID] = sizeof(uint32_t), }; EXPORT_SYMBOL(nftnl_rule_set_data); @@ -180,6 +160,9 @@ case NFTNL_RULE_ID: memcpy(&r->id, data, sizeof(r->id)); break; + case NFTNL_RULE_POSITION_ID: + memcpy(&r->position_id, data, sizeof(r->position_id)); + break; } r->flags |= (1 << attr); return 0; @@ -244,6 +227,9 @@ case NFTNL_RULE_ID: *data_len = sizeof(uint32_t); return &r->id; + case NFTNL_RULE_POSITION_ID: + *data_len = sizeof(uint32_t); + return &r->position_id; } return NULL; } @@ -335,6 +321,8 @@ } if (r->flags & (1 << NFTNL_RULE_ID)) mnl_attr_put_u32(nlh, NFTA_RULE_ID, htonl(r->id)); + if (r->flags & (1 << NFTNL_RULE_POSITION_ID)) + mnl_attr_put_u32(nlh, NFTA_RULE_POSITION_ID, htonl(r->position_id)); } EXPORT_SYMBOL(nftnl_rule_add_expr); @@ -374,6 +362,7 @@ abi_breakage(); break; case NFTA_RULE_ID: + case NFTA_RULE_POSITION_ID: if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) abi_breakage(); break; @@ -505,6 +494,10 @@ r->id = ntohl(mnl_attr_get_u32(tb[NFTA_RULE_ID])); r->flags |= (1 << NFTNL_RULE_ID); } + if (tb[NFTA_RULE_POSITION_ID]) { + r->position_id = ntohl(mnl_attr_get_u32(tb[NFTA_RULE_POSITION_ID])); + r->flags |= (1 << NFTNL_RULE_POSITION_ID); + } r->family = nfg->nfgen_family; r->flags |= (1 << NFTNL_RULE_FAMILY); @@ -588,6 +581,11 @@ SNPRINTF_BUFFER_SIZE(ret, remain, offset); } + if (r->flags & (1 << NFTNL_RULE_POSITION_ID)) { + ret = snprintf(buf + offset, remain, "%u ", r->position_id); + SNPRINTF_BUFFER_SIZE(ret, remain, offset); + } + ret = snprintf(buf + offset, remain, "\n"); SNPRINTF_BUFFER_SIZE(ret, remain, offset); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libnftnl-1.1.2/tests/Makefile.in new/libnftnl-1.1.3/tests/Makefile.in --- old/libnftnl-1.1.2/tests/Makefile.in 2018-11-13 12:02:42.898962460 +0100 +++ new/libnftnl-1.1.3/tests/Makefile.in 2019-05-27 13:52:39.444815516 +0200 @@ -700,7 +700,7 @@ # set age to 0. # </snippet> # -LIBVERSION = 11:0:0 +LIBVERSION = 12:0:1 AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include ${LIBMNL_CFLAGS} ${LIBMXML_CFLAGS} AM_CFLAGS = ${regular_CFLAGS} ${GCC_FVISIBILITY_HIDDEN} TESTS = $(check_PROGRAMS)
