]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
Use libmnl nest functions and fix size differences in iptree*.t
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 15 Jun 2010 13:08:55 +0000 (15:08 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 15 Jun 2010 13:08:55 +0000 (15:08 +0200)
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.

lib/session.c
tests/iptree.t
tests/iptreemap.t

index 2c85468de07dda91e1445b1f537050b4bcb25f27..64d5c4ae4680f94a598f739ec810b070ffefb731 100644 (file)
@@ -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;
 }
 
index b1e36786fb084bc1377d2961b1cbfbd28b70a2ef..b61c0c937c195bd2a37e8518e23d987125e0a605 100644 (file)
@@ -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
index 0c36c3afb4c8cee4bbaf7ce6916f15506453850e..aa8ed1e95f612da27530bf7324aef1393f93d1ca 100644 (file)
@@ -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