All of lore.kernel.org
 help / color / mirror / Atom feed
* inner structure of iptables
@ 2004-03-16 15:12 Ozgur AKAN
  2004-03-17  7:25 ` Henrik Nordstrom
  0 siblings, 1 reply; 2+ messages in thread
From: Ozgur AKAN @ 2004-03-16 15:12 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]

I included some simple code to express myself clearly.

I have a problem with the 4th line. When we execute the code for the 
first time these happen (I wrote down)

In the 1st line we create the pointer to the structure of the table
In the 2nd and 3rd line we get the adress of first chain and print its 
name to screen.
In the 4th line "e = iptc_first_rule(chain, &h)" we get the adress of 
the first  rule of the first chain and by the loop it goes to next rule 
until there is no next rule. How does it know that it is the last rule 
of this chain? Why doesn`t it continue to read the first rule of next 
chain? (Because there is no chain information here -> e = 
iptc_next_rule(e, &h))

 1    h = iptc_init(tablename);
 2    for ( chain = iptc_first_chain(&h); chain; chain = 
iptc_next_chain(&h)) {
 3        printf("%s\n", chain);
 4        for ( e = iptc_first_rule(chain, &h); e; e = iptc_next_rule(e, 
&h)) {
 5            printf("n. -%u- i. -%u-\n", e->ip.invflags, e->ip.invflags 
& IPT_INV_SRCIP);
 6        }
 7    }

I hope my question is clear enough.

thanks,
Ozgur AKAN

[-- Attachment #2: Type: text/html, Size: 1678 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-03-17  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-16 15:12 inner structure of iptables Ozgur AKAN
2004-03-17  7:25 ` Henrik Nordstrom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.