]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libiptc: Returns the position the entry was inserted
authorJonh Wendell <jonh.wendell@vexcorp.com>
Wed, 4 Jan 2012 17:44:01 +0000 (15:44 -0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 29 Feb 2012 12:48:00 +0000 (13:48 +0100)
Jan Engelhardt showed no objections to this patch.

include/libiptc/libiptc.h
libiptc/libiptc.c

index 24cdbdb79fddc6fe2dc1b5c78db6e15b6cd48e7f..b9a42c9612b86a966a9811355cc8a49e632615e8 100644 (file)
@@ -74,7 +74,8 @@ int iptc_replace_entry(const xt_chainlabel chain,
                       struct xtc_handle *handle);
 
 /* Append entry `e' to chain `chain'.  Equivalent to insert with
-   rulenum = length of chain. */
+   rulenum = length of chain. Returns the position the entry was
+   inserted or 0 if an error occurs */
 int iptc_append_entry(const xt_chainlabel chain,
                      const struct ipt_entry *e,
                      struct xtc_handle *handle);
index 63fcfc2afc1c21931a775619852ac7ed10820db8..ddaee128509630e2a263063783890a17b0aac055 100644 (file)
@@ -1836,7 +1836,8 @@ TC_REPLACE_ENTRY(const IPT_CHAINLABEL chain,
 }
 
 /* Append entry `fw' to chain `chain'.  Equivalent to insert with
-   rulenum = length of chain. */
+   rulenum = length of chain. Returns the position the entry was
+   inserted or 0 if an error occurs */
 int
 TC_APPEND_ENTRY(const IPT_CHAINLABEL chain,
                const STRUCT_ENTRY *e,
@@ -1872,7 +1873,7 @@ TC_APPEND_ENTRY(const IPT_CHAINLABEL chain,
 
        set_changed(handle);
 
-       return 1;
+       return c->num_rules;
 }
 
 static inline int