Skip to contentSkip to conversation

HElp with script execution!!

DISCUSSION Visham Ramsurrun 5 participants 8 messages Jul 27, 2005 – Aug 1, 2005 netfilter

lore
Share & tools
lore
#0 lore raw

Hi to all,

I wanted to ask if it is possible to get a signal (i don't know from where, maybe a function in the kernel or from the NIC) just before every packet is sent out the NIC. The signal then causes a script to execute. I basically want to execute a script on a per-packet basis. But I don't know how to go about it. I thought about the QUEUE target but i'm not sure. What things I should be looking at?

Thx in advance..

Warm regards,
Visham

#1 lore raw

You can definitely do this with the QUEUE target. You're going to need (to write) a userspace application that retrieves the packets using libipq. See "man libipq" for an example on how to do this.

Regards,
Christian Theil Have.

Quoted 15 lines · Visham Ramsurrun

Hi to all,

I wanted to ask if it is possible to get a signal (i don't know from where, maybe a function in the kernel or from the NIC) just before every packet is sent out the NIC. The signal then causes a script to execute. I basically want to execute a script on a per-packet basis. But I don't know how to go about it. I thought about the QUEUE target but i'm not sure. What things I should be looking at?

Thx in advance..

Warm regards,
Visham

#2 lore raw

Bug Report: IPtables 1.2.* segfaulted by iptables 1.3.*

In reply to Visham Ramsurrun

Hi all,
I've been mixing iptables 1.2.8/1.2.11 and 1.3.1/2 tools and unlike I would expect I know that the tables created by 1.3.x tools will segfault any 1.2.x based tool that's later runon the table.

It appears that this is because iptables 1.3.x no longer sorts the hooked chains to the begining of the table. The kernel has no problem with this but old versions of iptables do.

Is there any reason iptables-1.3 couldn't be changed so it doesn't crash version 1.2.x, I assume by putting the sort order back as it was ?

Signature · 2 lines
Rob.                          (Robert de Bath <robert$ @ debath.co.uk>)
                                             <http://www.debath.co.uk/>
#3 lore raw

Re: Bug Report: IPtables 1.2.* segfaulted by iptables 1.3.*

Quoted 4 lines · Robert de Bath

Hi all,
I've been mixing iptables 1.2.8/1.2.11 and 1.3.1/2 tools and unlike I would expect I know that the tables created by 1.3.x tools will segfault any 1.2.x based tool that's later runon the table.

mh, mixing multiple versions of the tools is a bad idea anyway. We have other issues with this as well (one has been added to INCOMPATIBILITIES recently).

Quoted 2 lines

Is there any reason iptables-1.3 couldn't be changed so it doesn't crash version 1.2.x, I assume by putting the sort order back as it was ?

If the fix is non-intrusive and doesn't reaquire a lot of additional computational complexity, I would accept such a patch. Otherwise I don't really think it's worth supporting such a setup. Usually you have one version of iptables installed, not multiple.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#4 lore raw

Re: Bug Report: IPtables 1.2.* segfaulted by iptables 1.3.* [PATCH]

Quoted 6 lines · Harald Welte
Quoted 2 lines · Robert de Bath

Hi all,
I've been mixing iptables 1.2.8/1.2.11 and 1.3.1/2 tools and unlike I would

other issues with this as well (one has been added to INCOMPATIBILITIES recently).

Yup, spotted that but nfcache is per entry so it doesn't break _this_.

Quoted 4 lines

If the fix is non-intrusive and doesn't reaquire a lot of additional computational complexity, I would accept such a patch. Otherwise I don't really think it's worth supporting such a setup. Usually you have one version of iptables installed, not multiple.

<grin> The change was a _lot_ easier than I thought, looks like it's a real bug too. [attached]

Signature · 2 lines
Rob.                          (Robert de Bath <robert$ @ debath.co.uk>)
                                             <http://www.debath.co.uk/>
libiptc.c renamed from libiptc.c.orig +1 -1
@@ -399,7 +399,7 @@
 	/* sort only user defined chains */
 	if (!c->hooknum) {
 		list_for_each_entry(tmp, &h->chains, list) {
-			if (strcmp(c->name, tmp->name) <= 0) {
+			if (!tmp->hooknum && strcmp(c->name, tmp->name) <= 0) {
 				list_add(&c->list, tmp->list.prev);
 				return;
 			}
#5 lore raw

Re: Bug Report: IPtables 1.2.* segfaulted by iptables 1.3.* [PATCH]

Quoted 7 lines · Robert de Bath
Quoted 4 lines

If the fix is non-intrusive and doesn't reaquire a lot of additional computational complexity, I would accept such a patch. Otherwise I don't really think it's worth supporting such a setup. Usually you have one version of iptables installed, not multiple.

<grin> The change was a _lot_ easier than I thought, looks like it's a real bug too. [attached]

thanks,
Committed revision 4207.

Unfortunately too late for 1.3.3 :(
I don't think it's serious enough to justify an early 1.3.4 release.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#6 lore raw

Re: Bug Report: IPtables 1.2.* segfaulted by iptables 1.3.*

In reply to Harald Welte
Quoted 2 lines

mh, mixing multiple versions of the tools is a bad idea anyway. We have

There are .version members in the info struct of both userspace and kernelspace modules - if they are different, why did not iptables catch this?

Jan Engelhardt

#7 lore raw

Re: Bug Report: IPtables 1.2.* segfaulted by iptables 1.3.*

Quoted 5 lines · Jan Engelhardt
Quoted 2 lines

mh, mixing multiple versions of the tools is a bad idea anyway. We have

There are .version members in the info struct of both userspace and kernelspace modules - if they are different, why did not iptables catch this?

sorry, this is for different layout of the 'per match' or 'per target' data structures.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie