Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0f417ce989f84cfd5418e3b316064bfbb2708196
Commit:     0f417ce989f84cfd5418e3b316064bfbb2708196
Parent:     13eae15a244bb29beaa47bf86a24fd29ca7f8a4c
Author:     Pablo Neira Ayuso <[EMAIL PROTECTED]>
AuthorDate: Mon Dec 17 22:28:19 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:58:51 2008 -0800

    [NETFILTER]: ctnetlink: add support for master tuple event notification and 
dumping
    
    This patch adds support for master tuple event notification and
    dumping.  Conntrackd needs this information to recover related
    connections appropriately.
    
    Signed-off-by: Pablo Neira Ayuso <[EMAIL PROTECTED]>
    Signed-off-by: Patrick McHardy <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/netfilter/nf_conntrack_netlink.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/net/netfilter/nf_conntrack_netlink.c 
b/net/netfilter/nf_conntrack_netlink.c
index d7da167..94027c8 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -254,6 +254,29 @@ nla_put_failure:
 #define ctnetlink_dump_mark(a, b) (0)
 #endif
 
+#define master_tuple(ct) &(ct->master->tuplehash[IP_CT_DIR_ORIGINAL].tuple)
+
+static inline int
+ctnetlink_dump_master(struct sk_buff *skb, const struct nf_conn *ct)
+{
+       struct nlattr *nest_parms;
+
+       if (!(ct->status & IPS_EXPECTED))
+               return 0;
+
+       nest_parms = nla_nest_start(skb, CTA_TUPLE_MASTER | NLA_F_NESTED);
+       if (!nest_parms)
+               goto nla_put_failure;
+       if (ctnetlink_dump_tuples(skb, master_tuple(ct)) < 0)
+               goto nla_put_failure;
+       nla_nest_end(skb, nest_parms);
+
+       return 0;
+
+nla_put_failure:
+       return -1;
+}
+
 #ifdef CONFIG_NF_NAT_NEEDED
 static inline int
 dump_nat_seq_adj(struct sk_buff *skb, const struct nf_nat_seq *natseq, int 
type)
@@ -371,6 +394,7 @@ ctnetlink_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
            ctnetlink_dump_mark(skb, ct) < 0 ||
            ctnetlink_dump_id(skb, ct) < 0 ||
            ctnetlink_dump_use(skb, ct) < 0 ||
+           ctnetlink_dump_master(skb, ct) < 0 ||
            ctnetlink_dump_nat_seq_adj(skb, ct) < 0)
                goto nla_put_failure;
 
@@ -475,6 +499,10 @@ static int ctnetlink_conntrack_event(struct notifier_block 
*this,
                     ctnetlink_dump_counters(skb, ct, IP_CT_DIR_REPLY) < 0))
                        goto nla_put_failure;
 
+               if (events & IPCT_RELATED &&
+                   ctnetlink_dump_master(skb, ct) < 0)
+                       goto nla_put_failure;
+
                if (events & IPCT_NATSEQADJ &&
                    ctnetlink_dump_nat_seq_adj(skb, ct) < 0)
                        goto nla_put_failure;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to