Skip to contentSkip to conversation

iptables doubt

DISCUSSION varun 3 participants 9 messages Apr 12, 2006 – Apr 14, 2006 2 messages not in the archive netfilter

lore
Share & tools
lore

varun

author
#0 lore raw

Hi all,

Iam new to netfilters and iam trying to play around to
understand a few things. By default when no policies are specified then it allows all traffic to go out and in to the n/w. I want to change this to default as deny.
That is when there is no policy all should be default deny.

So in order to achieve that i tried to change the code a little.
In the file iptable_filter.c there is a variable called
static int forward = NF_ACCEPT
I changed this to NF_DROP and when i compiled and used it
sure i was not able to send any or recv any packets
but even after i give a policy like iptables -t filter -A
INPUT -j ACCEPT
Nothing changes. So achieve what i want what should i do?
And where do i change?

Another thing is that in normally when i put a policy like
iptables -t filter -A OUTPUT -j REJECT
Even my own self IP doesnt ping? Why should this happen?
Isint it ok to ping local ip and loopback ip?
If i want such implementation where i should be able to
ping to self and local but not any other ip?
Is it possible?
I dont want to add policies rather is it possible just
by changing the iptables kernel code?

Please help me on this?

Varun

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 16 lines · varun

Hi Sebastien,

Thanx for the reply. Actually i did figure
out some things. It seems to work fine but iam not sure if may lead to any problem. This is what i have done.
Instead of adding static routes what i have done is added this small code in the function ipt_do_table.

                             if(in == NULL)
                  goto jump;
         if(memcmp(in->name,"lo",2) == 0)
             {
                  verdict = NF_ACCEPT;
                  return verdict;
             }
Quoted 8 lines

jump:
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

It seems "good" modulo these changes to be more concise ...

if (in != NULL && memcmp(in->name, "lo", 2) == 0)
return NF_ACCEPT;
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

Note that you have done a shortcut that does not test the outgoing interface. It means that you can receive packets from another interface and going to the loopback address ...

Quoted 4 lines

With this every time a packet comes with IN dev as lo i would simply accept. It seems ok and works well but is there any problem with it if i do so?

IMHO, there is no pblm doing this way except that :
1) you have hardcoded the "rule" (half-hardcoded see remark here above)
2) there is no more option to change the behavior of the "rule" you
just added (i.e. we can't reject anymore a packet going through the loopback interface)

Quoted 73 lines

Varun

Sebastien Tandel wrote:

Hi,

Quoted 8 lines · varun
Quoted 8 lines
Quoted 8 lines

Hi all,

Iam new to netfilters and iam trying to play around to
understand a few things. By default when no policies are specified then it allows all traffic to go out and in to the n/w. I want to change this to default as deny.
That is when there is no policy all should be default deny.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

So in order to achieve that i tried to change the code a
little.
In the file iptable_filter.c there is a variable called
static int forward = NF_ACCEPT
I changed this to NF_DROP and when i compiled and used it
sure i was not able to send any or recv any packets

I think you made the right change in your code in order to have a DROP policy by default in your netfilter. the problem is just after ...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

but even after i give a policy like iptables -t filter -A
INPUT -j ACCEPT
Nothing changes. So achieve what i want what should i do?
And where do i change?

It is quiet normal as you told netfilter to accept incoming packets but you did not configure netfilter to accept *outgoing* packets ... iptables -t filter -A OUTPUT -j ACCEPT

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Another thing is that in normally when i put a policy like
iptables -t filter -A OUTPUT -j REJECT
Even my own self IP doesnt ping? Why should this happen?
Isint it ok to ping local ip and loopback ip?
If i want such implementation where i should be able to
ping to self and local but not any other ip?
Is it possible?

lo is the interface allotted to your local interface (i.e. your host)! You must therefore create two rules in order to let netfilter accept outgoing and incoming packets from and arriving to your local interface. iptables -A INPOUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I dont want to add policies rather is it possible just by
changing the iptables kernel code?

Quoted 7 lines

You have to initialize netfilter by adding two static rules implementing the ones described here above.

sta

Quoted 3 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEPkLmw76McB8jGxkRAsN0AJ4jZP6mhN2vk+/L93qy5uhC8WSJVwCfQpun Fc4d8NMUJo6M64QBMPTO/dg=
=c7ol
-----END PGP SIGNATURE-----

author
#4 lore raw

Hi Sebastien,

Thanx again. Yeah i cannot set a rule for lo.
Though it is not necessary in my case i would like have that option. So is static rule only the way?
Another thing is i want to implement rule
priority.
That is after the rules are set when a
packet arrives it needs to search the rule chain. I want that to searched with respect to priority. So even the user can change the priority of already set rule as he likes. Is it already implemented in iptables or is it needed to be implemented?

I also want to maintain unique rule id.
That is say i declair unsigned int i;
So for any rule be it nat or anything this
is global rule id that is assigned to any policy added.
By this say if a user added a rule whose id
i give as 15. And then he deletes it then after adding another policy he will get policy id of 16 and not 15. rule no 15 will be given only after full size of unsigned int is completed, i mean one full circle (i = 0 to i=4294967295). So to do it how should i go about it? Any suggestions?

Varun

Quoted 172 lines · Sebastien Tandel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 16 lines · varun

Hi Sebastien,

Thanx for the reply. Actually i did figure
out some things. It seems to work fine but iam not sure if may lead to any problem. This is what i have done.
Instead of adding static routes what i have done is added this small code in the function ipt_do_table.

                            if(in == NULL)
                 goto jump;
        if(memcmp(in->name,"lo",2) == 0)
            {
                 verdict = NF_ACCEPT;
                 return verdict;
            }
Quoted 10 lines

jump:
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

It seems "good" modulo these changes to be more concise ...

if (in != NULL && memcmp(in->name, "lo", 2) == 0)
return NF_ACCEPT;
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

Note that you have done a shortcut that does not test the outgoing interface. It means that you can receive packets from another interface and going to the loopback address ...

Quoted 6 lines

With this every time a packet comes with IN dev as lo i would simply accept. It seems ok and works well but is there any problem with it if i do so?

IMHO, there is no pblm doing this way except that :
1) you have hardcoded the "rule" (half-hardcoded see remark here above)
2) there is no more option to change the behavior of the "rule" you
just added (i.e. we can't reject anymore a packet going through the loopback interface)

Quoted 82 lines

Varun

Sebastien Tandel wrote:

Hi,

Quoted 8 lines · varun
Quoted 8 lines
Quoted 8 lines

Hi all,

Iam new to netfilters and iam trying to play around to
understand a few things. By default when no policies are specified then it allows all traffic to go out and in to the n/w. I want to change this to default as deny.
That is when there is no policy all should be default deny.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

So in order to achieve that i tried to change the code a
little.
In the file iptable_filter.c there is a variable called
static int forward = NF_ACCEPT
I changed this to NF_DROP and when i compiled and used it
sure i was not able to send any or recv any packets

I think you made the right change in your code in order to have a DROP policy by default in your netfilter. the problem is just after ...

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

but even after i give a policy like iptables -t filter -A
INPUT -j ACCEPT
Nothing changes. So achieve what i want what should i do?
And where do i change?

It is quiet normal as you told netfilter to accept incoming packets but you did not configure netfilter to accept *outgoing* packets ... iptables -t filter -A OUTPUT -j ACCEPT

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Another thing is that in normally when i put a policy like
iptables -t filter -A OUTPUT -j REJECT
Even my own self IP doesnt ping? Why should this happen?
Isint it ok to ping local ip and loopback ip?
If i want such implementation where i should be able to
ping to self and local but not any other ip?
Is it possible?

lo is the interface allotted to your local interface (i.e. your host)! You must therefore create two rules in order to let netfilter accept outgoing and incoming packets from and arriving to your local interface. iptables -A INPOUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I dont want to add policies rather is it possible just by
changing the iptables kernel code?

Quoted 6 lines

You have to initialize netfilter by adding two static rules implementing the ones described here above.

sta

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEPkLmw76McB8jGxkRAsN0AJ4jZP6mhN2vk+/L93qy5uhC8WSJVwCfQpun Fc4d8NMUJo6M64QBMPTO/dg=
=c7ol
-----END PGP SIGNATURE-----

#5 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 5 lines · varun

Hi Sebastien,

Thanx again. Yeah i cannot set a rule for lo.
Though it is not necessary in my case i would like have that option. So is static rule only the way?

I think so ...

Why do you want to code it directly in netfilter instead of using the init.d scripts?

Quoted 18 lines

Another thing is i want to implement rule
priority.
That is after the rules are set when a packet
arrives it needs to search the rule chain. I want that to searched with respect to priority. So even the user can change the priority of already set rule as he likes. Is it already implemented in iptables or is it needed to be implemented?

I also want to maintain unique rule id. That
is say i declair unsigned int i;
So for any rule be it nat or anything this
is global rule id that is assigned to any policy added.
By this say if a user added a rule whose id i
give as 15. And then he deletes it then after adding another policy he will get policy id of 16 and not 15. rule no 15 will be given only after full size of unsigned int is completed, i mean one full circle (i = 0 to i=4294967295). So to do it how should i go about it? Any suggestions?

Quoted 1 line

Varun

It is clearly not implemented and I haven't any clue for you on this matter but ... What will be the benefit of it?

Quoted 58 lines

Sebastien Tandel wrote:

Quoted 16 lines · varun
Quoted 16 lines
Quoted 16 lines

Hi Sebastien,

Thanx for the reply. Actually i did figure
out some things. It seems to work fine but iam not sure if may lead to any problem. This is what i have done.
Instead of adding static routes what i have done is added this small code in the function ipt_do_table.

                            if(in == NULL)
                 goto jump;
        if(memcmp(in->name,"lo",2) == 0)
            {
                 verdict = NF_ACCEPT;
                 return verdict;
            }
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

jump:
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

It seems "good" modulo these changes to be more concise ...

if (in != NULL && memcmp(in->name, "lo", 2) == 0)
return NF_ACCEPT;
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

Note that you have done a shortcut that does not test the outgoing interface. It means that you can receive packets from another interface and going to the loopback address ...

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

With this every time a packet comes with IN dev as lo i would simply accept. It seems ok and works well but is there any problem with it if i do so?

Quoted 109 lines

IMHO, there is no pblm doing this way except that :
1) you have hardcoded the "rule" (half-hardcoded see remark here
above)
2) there is no more option to change the behavior of the "rule" you
just added (i.e. we can't reject anymore a packet going through the loopback interface)

Quoted 99 lines
Quoted 90 lines
Quoted 90 lines

Varun

Sebastien Tandel wrote:

Hi,

Quoted 10 lines · varun
Quoted 10 lines
Quoted 10 lines

Hi all,

Iam new to netfilters and iam trying to play around to
understand a few things. By default when no policies are specified then
it allows all traffic to go out and in to the n/w. I want to change this
to default as deny.
That is when there is no policy all should be default deny.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

So in order to achieve that i tried to change the code a
little.
In the file iptable_filter.c there is a variable called
static int forward = NF_ACCEPT
I changed this to NF_DROP and when i compiled and used it
sure i was not able to send any or recv any packets

I think you made the right change in your code in order to have a DROP policy by default in your netfilter. the problem is just after ...

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

but even after i give a policy like iptables -t filter -A
INPUT -j ACCEPT
Nothing changes. So achieve what i want what should i do?
And where do i change?

It is quiet normal as you told netfilter to accept incoming packets but you did not configure netfilter to accept *outgoing* packets ... iptables -t filter -A OUTPUT -j ACCEPT

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Another thing is that in normally when i put a policy like
iptables -t filter -A OUTPUT -j REJECT
Even my own self IP doesnt ping? Why should this happen?
Isint it ok to ping local ip and loopback ip?
If i want such implementation where i should be able to
ping to self and local but not any other ip?
Is it possible?

lo is the interface allotted to your local interface (i.e. your host)! You must therefore create two rules in order to let netfilter accept outgoing and incoming packets from and arriving to your local interface. iptables -A INPOUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

I dont want to add policies rather is it possible
just by
changing the iptables kernel code?

You have to initialize netfilter by adding two static rules implementing the ones described here above.

sta

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEPk80w76McB8jGxkRAjzkAJ9v7l94tGG8mRCSq6MM5Fxf+K0zlQCglRX3 B3HeNfHiKBlHbUxNwgnqBzM=
=9D0f
-----END PGP SIGNATURE-----

author
#6 lore raw

Hi Sebastien,

Well i do not want to use policy from user
space because , the very need for me to do this activity is to play around and get to understand netfilter iptables.

The features i want to implement like that
priority for policy is that imagine a scenario where user added some policies and then for some reason wants one policy to be checked before checking others then he would have to add the policy again and delete the old policy isint it?
By the thanx for the help man and can you
suggest me some good mailing list which deal with iptables development where newbies like me could get some help. This mailing list does not seem to help newbies much.

Varun

Quoted 248 lines · Sebastien Tandel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · varun

Hi Sebastien,

Thanx again. Yeah i cannot set a rule for lo.
Though it is not necessary in my case i would like have that option. So is static rule only the way?

I think so ...

Why do you want to code it directly in netfilter instead of using the init.d scripts?

Quoted 18 lines

Another thing is i want to implement rule
priority.
That is after the rules are set when a packet
arrives it needs to search the rule chain. I want that to searched with respect to priority. So even the user can change the priority of already set rule as he likes. Is it already implemented in iptables or is it needed to be implemented?

I also want to maintain unique rule id. That
is say i declair unsigned int i;
So for any rule be it nat or anything this
is global rule id that is assigned to any policy added.
By this say if a user added a rule whose id i
give as 15. And then he deletes it then after adding another policy he will get policy id of 16 and not 15. rule no 15 will be given only after full size of unsigned int is completed, i mean one full circle (i = 0 to i=4294967295). So to do it how should i go about it? Any suggestions?

Quoted 3 lines

Varun

It is clearly not implemented and I haven't any clue for you on this matter but ... What will be the benefit of it?

Quoted 62 lines

Sebastien Tandel wrote:

Quoted 16 lines · varun
Quoted 16 lines
Quoted 16 lines

Hi Sebastien,

Thanx for the reply. Actually i did figure
out some things. It seems to work fine but iam not sure if may lead to any problem. This is what i have done.
Instead of adding static routes what i have done is added this small code in the function ipt_do_table.

                           if(in == NULL)
                goto jump;
       if(memcmp(in->name,"lo",2) == 0)
           {
                verdict = NF_ACCEPT;
                return verdict;
           }
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

jump:
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

It seems "good" modulo these changes to be more concise ...

if (in != NULL && memcmp(in->name, "lo", 2) == 0)
return NF_ACCEPT;
* We handle fragments by dealing with the first fragment as
* if it was a normal packet. All other fragments are treated
* normally, except that they will NEVER match rules that ask
* things we don't know, ie. tcp syn flag or ports). If the
* rule is also a fragment-specific rule, non-fragments won't
* match it. */
offset = ntohs(ip->frag_off) & IP_OFFSET;

Note that you have done a shortcut that does not test the outgoing interface. It means that you can receive packets from another interface and going to the loopback address ...

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

With this every time a packet comes with IN dev as lo i would simply accept. It seems ok and works well but is there any problem with it if i do so?

Quoted 122 lines

IMHO, there is no pblm doing this way except that :
1) you have hardcoded the "rule" (half-hardcoded see remark here
above)
2) there is no more option to change the behavior of the "rule" you
just added (i.e. we can't reject anymore a packet going through the loopback interface)

Quoted 104 lines
Quoted 104 lines
Quoted 104 lines

Varun

Sebastien Tandel wrote:

Hi,

Quoted 10 lines · varun
Quoted 10 lines
Quoted 10 lines

Hi all,

Iam new to netfilters and iam trying to play around to
understand a few things. By default when no policies are specified then
it allows all traffic to go out and in to the n/w. I want to change this
to default as deny.
That is when there is no policy all should be default deny.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

So in order to achieve that i tried to change the code a
little.
In the file iptable_filter.c there is a variable called
static int forward = NF_ACCEPT
I changed this to NF_DROP and when i compiled and used it
sure i was not able to send any or recv any packets

I think you made the right change in your code in order to have a DROP policy by default in your netfilter. the problem is just after ...

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

but even after i give a policy like iptables -t filter -A
INPUT -j ACCEPT
Nothing changes. So achieve what i want what should i do?
And where do i change?

It is quiet normal as you told netfilter to accept incoming packets but you did not configure netfilter to accept *outgoing* packets ... iptables -t filter -A OUTPUT -j ACCEPT

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Another thing is that in normally when i put a policy like
iptables -t filter -A OUTPUT -j REJECT
Even my own self IP doesnt ping? Why should this happen?
Isint it ok to ping local ip and loopback ip?
If i want such implementation where i should be able to
ping to self and local but not any other ip?
Is it possible?

lo is the interface allotted to your local interface (i.e. your host)! You must therefore create two rules in order to let netfilter accept outgoing and incoming packets from and arriving to your local interface. iptables -A INPOUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I dont want to add policies rather is it possible
just by
changing the iptables kernel code?

You have to initialize netfilter by adding two static rules implementing the ones described here above.

sta

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEPk80w76McB8jGxkRAjzkAJ9v7l94tGG8mRCSq6MM5Fxf+K0zlQCglRX3 B3HeNfHiKBlHbUxNwgnqBzM=
=9D0f
-----END PGP SIGNATURE-----

#7 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Quoted 5 lines · varun

Hi Sebastien,

Well i do not want to use policy from user space
because , the very need for me to do this activity is to play around and get to understand netfilter iptables.

ok ... that's the point :)

Quoted 6 lines

The features i want to implement like that
priority for policy is that imagine a scenario where user added some policies and then for some reason wants one policy to be checked before checking others then he would have to add the policy again and delete the old policy isint it?

Yes it is correct ... even if this may seem curious I think it is not the worth to add such a mechanism to netfilter. IMHO, a switch option '-M' (MOVE) would be sufficient but not with all these unique-id's ... I fear that with the time this number list would be completely fragmented and human-unreadable
I don't know wether it had already been discussed on this mailing-list. IMHO, it is not a strong requirement for iptables/netfilter and this situation may be handled in a semi-automatic way with a user script (with the danger, however, of having a race condition with another user script changing netfilter too).
Of course, if it is another exercise to play with netfilter do it and have fun ;)

Quoted 4 lines

By the thanx for the help man and can you
suggest me some good mailing list which deal with iptables development where newbies like me could get some help. This mailing list does not seem to help newbies much.

Unfortunately, I don't know any other mailing list devoted to netfilter. :-/

sta
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEPl07w76McB8jGxkRAi5cAJ0TPTCHg3ENQtf/7OMS8NQvlfqglgCfUkJp GMvcI8Bety73ooSHNMQM/3I=
=ztZe
-----END PGP SIGNATURE-----

author
#8 lore raw

Hi,

By the way can you tell me which is the structure that holds
the rule ie when i give iptables -t filter -A FORWARD -j REJECT
Which struct in kernel which holds the rule and which is the
function that adds the rule from user space to the list in kernel?
I assume that we are maintaing stack implementation for holding
rules on one table am i right?

Varun

Quoted 64 lines · Sebastien Tandel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Quoted 7 lines · varun

Hi Sebastien,

Well i do not want to use policy from user space
because , the very need for me to do this activity is to play around and get to understand netfilter iptables.

ok ... that's the point :)

Quoted 7 lines

The features i want to implement like that
priority for policy is that imagine a scenario where user added some policies and then for some reason wants one policy to be checked before checking others then he would have to add the policy again and delete the old policy isint it?

Yes it is correct ... even if this may seem curious I think it is not the worth to add such a mechanism to netfilter. IMHO, a switch option '-M' (MOVE) would be sufficient but not with all these unique-id's ... I fear that with the time this number list would be completely fragmented and human-unreadable
I don't know wether it had already been discussed on this mailing-list. IMHO, it is not a strong requirement for iptables/netfilter and this situation may be handled in a semi-automatic way with a user script (with the danger, however, of having a race condition with another user script changing netfilter too).
Of course, if it is another exercise to play with netfilter do it and have fun ;)

Quoted 6 lines

By the thanx for the help man and can you
suggest me some good mailing list which deal with iptables development where newbies like me could get some help. This mailing list does not seem to help newbies much.

Unfortunately, I don't know any other mailing list devoted to netfilter. :-/

sta
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEPl07w76McB8jGxkRAi5cAJ0TPTCHg3ENQtf/7OMS8NQvlfqglgCfUkJp GMvcI8Bety73ooSHNMQM/3I=
=ztZe
-----END PGP SIGNATURE-----

#9 lore raw
In reply to varun
Quoted 2 lines · varun

The features i want to implement like that priority
for policy is that imagine a scenario where user added some policies and then for some reason wants one policy to be checked before checking others then he would have to add the policy again and delete the old policy isint it?

Every iptables rule change is loading the whole ruleset into userspace, modifying it, and copying the result back into kernelspace.

So you should be able to fetch the rules (f.e. with iptables-save), modify them as you like, and push them back (iptables-restore).

c'ya
sven

Signature · 2 lines
The Internet treats censorship as a routing problem, and routes around it.
(John Gilmore on http://www.cygnus.com/~gnu/)
author
#10 lore raw

Yeah it is true but this can done only after safe but not dynamically? Is there a way to do dynamically?

Varun

Quoted 13 lines · Sven-Haegar Koch
Quoted 2 lines · varun

The features i want to implement like that
priority for policy is that imagine a scenario where user added some policies and then for some reason wants one policy to be checked before checking others then he would have to add the policy again and delete the old policy isint it?

Every iptables rule change is loading the whole ruleset into userspace, modifying it, and copying the result back into kernelspace.

So you should be able to fetch the rules (f.e. with iptables-save), modify them as you like, and push them back (iptables-restore).

c'ya
sven