Skip to contentSkip to conversation

sequence numbering for ctnetlink events

RFC PATCH In review Pablo Neira Ayuso 2 participants 2 messages Jun 6, 2006 – Jun 19, 2006

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

RFC PATCH 1/1 sequence numbering for ctnetlink events

Hi,

This patch adds sequence numbering for event messages generated by ctnetlink, it is still imcomplete (nf_conntrack_netlink).

I'm having tons of problems these days, and this makes everything really hard: my laptop died, so my home pc did, my mail at eurodev was down... so I'm reading netfilter mail from the archives and I have to spend some time to set up again a git tree to test my patches, and... recent debian kernels are broken with UML... :(

BTW: people.netfilter.org seems to be down :(

[RFC,PATCH] sequence numbering for ctnetlink events

This patch adds sequence numbering to ctnetlink event messages send to userspace.

net/ipv4/netfilter/ip_conntrack_netlink.c +8 -2
Index: net-2.6.18.git/net/ipv4/netfilter/ip_conntrack_netlink.c
===================================================================
@@ -304,6 +304,8 @@
 }
 
 #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
+static atomic_t ip_conntrack_seq = ATOMIC_INIT(0);
+
 static int ctnetlink_conntrack_event(struct notifier_block *this,
                                      unsigned long events, void *ptr)
 {
@@ -349,7 +351,8 @@
 	b = skb->tail;
 
 	type |= NFNL_SUBSYS_CTNETLINK << 8;
-	nlh   = NLMSG_PUT(skb, 0, 0, type, sizeof(struct nfgenmsg));
+	nlh   = NLMSG_PUT(skb, 0, atomic_add_return(1, &ip_conntrack_seq), 
+			  type, sizeof(struct nfgenmsg));
 	nfmsg = NLMSG_DATA(nlh);
 
 	nlh->nlmsg_flags    = flags;
@@ -1239,6 +1242,8 @@
 }
 
 #ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
+static atomic_t ip_conntrack_exp_seq = ATOMIC_INIT(0);
+
 static int ctnetlink_expect_event(struct notifier_block *this,
 				  unsigned long events, void *ptr)
 {
@@ -1263,7 +1268,8 @@
 	b = skb->tail;
 
 	type |= NFNL_SUBSYS_CTNETLINK_EXP << 8;
-	nlh   = NLMSG_PUT(skb, 0, 0, type, sizeof(struct nfgenmsg));
+	nlh   = NLMSG_PUT(skb, 0, atomic_add_return(1, &ip_conntrack_exp_seq),
+			  type, sizeof(struct nfgenmsg));
 	nfmsg = NLMSG_DATA(nlh);
 
 	nlh->nlmsg_flags    = flags;
#1 lore raw
Quoted 10 lines · Pablo Neira Ayuso

Hi,

This patch adds sequence numbering for event messages generated by ctnetlink, it is still imcomplete (nf_conntrack_netlink).

I'm having tons of problems these days, and this makes everything really
hard: my laptop died, so my home pc did, my mail at eurodev was down... so I'm reading netfilter mail from the archives and I have to spend some time to set up again a git tree to test my patches, and... recent debian kernels are broken with UML... :(

UML works once every two month for me, but then randomly, without changing anything, stops working again. I've mostly given up on it, the time to figure out the problem du jour is just not worth it.

Quoted 4 lines

[RFC,PATCH] sequence numbering for ctnetlink events

This patch adds sequence numbering to ctnetlink event messages send to userspace.

As we discussed in the ctnetlink benchmark thread, sequence numbers should only be sent for responses to queries to allow userspace to associate them with each other. Care to cook up another patch? Otherwise I'll take care of it.