diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-06-15 15:08:55 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2010-06-15 15:08:55 +0200 |
commit | 3566189cb6f01c4f2340734f432e20cb6ed1a999 (patch) | |
tree | a4114a80245cf51a1390baf14ff0537e8fbe2594 | |
parent | 3fd6b24ace319b139ec3c4e3031a5f05d21e304e (diff) |
Use libmnl nest functions and fix size differences in iptree*.t
Use the libmnl mnl_attr_nest_star/mnl_attr_nest_end functions instead of
the private ones. Ignore possible size differences in iptree*.t compatibility
tests.
-rw-r--r-- | lib/session.c | 24 | ||||
-rw-r--r-- | tests/iptree.t | 2 | ||||
-rw-r--r-- | tests/iptreemap.t | 2 |
3 files changed, 4 insertions, 24 deletions
diff --git a/lib/session.c b/lib/session.c index 2c85468..64d5c4a 100644 --- a/lib/session.c +++ b/lib/session.c @@ -1248,36 +1248,16 @@ callback_noop(const struct nlmsghdr *nlh UNUSED, void *data UNUSED) * Build and send messages */ -static inline struct nlattr * -nla_nest_start(struct nlmsghdr *nlh, int attr) -{ - struct nlattr *start = mnl_nlmsg_get_payload_tail(nlh); - - start->nla_type = attr | NLA_F_NESTED; - start->nla_len = MNL_ALIGN(sizeof(struct nlattr)); - - nlh->nlmsg_len += start->nla_len; - - return start; -} - -static inline void -nla_nest_end(struct nlmsghdr *nlh, struct nlattr *start) -{ - start->nla_len = (void *) mnl_nlmsg_get_payload_tail(nlh) - - (void *) start; -} - static inline void open_nested(struct ipset_session *session, struct nlmsghdr *nlh, int attr) { - session->nested[session->nestid++] = nla_nest_start(nlh, attr); + session->nested[session->nestid++] = mnl_attr_nest_start(nlh, attr); } static inline void close_nested(struct ipset_session *session, struct nlmsghdr *nlh) { - nla_nest_end(nlh, session->nested[session->nestid-1]); + mnl_attr_nest_end(nlh, session->nested[session->nestid-1]); session->nested[--session->nestid] = NULL; } diff --git a/tests/iptree.t b/tests/iptree.t index b1e3678..b61c0c9 100644 --- a/tests/iptree.t +++ b/tests/iptree.t @@ -15,7 +15,7 @@ # Static: List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Static: Check listing -0 diff .foo iptree.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo iptree.t.list0 && rm .foo # Static: Flush test set 0 ipset -F test # Static: Delete test set diff --git a/tests/iptreemap.t b/tests/iptreemap.t index 0c36c3a..aa8ed1e 100644 --- a/tests/iptreemap.t +++ b/tests/iptreemap.t @@ -51,7 +51,7 @@ # List set 0 ipset -L test > .foo0 && ./sort.sh .foo0 # Check listing -0 diff .foo iptreemap.t.list0 && rm .foo +0 diff -I 'Size in memory.*' .foo iptreemap.t.list0 && rm .foo # Flush test set 0 ipset -F test # Delete test set |