Skip to contentSkip to conversation

IPT_RETURN is not worked in the kernel 2.6.10

DISCUSSION Vincent 2 participants 2 messages Sep 22, 2005 netfilter

lore
Share & tools
lore

Vincent

author
#0 lore raw

Sorry, after understanding the meaning of ipt_do_table function. I know currently the IPT_RETURN is only available in the standard target. But I wonder why don't we have the IPT_RETURN in the user defined target?
Can we create a IPT_RETURN in the user defined target. So that we can use the IPT_RETURN in our target to return to the upper chain.

What I mean is "can we port the IPT_RETURN to the user defined target in the ipt_do_table function?"

Vincent

Quoted 41 lines

-----Original Message-----
From: Vincent [mailto:[email protected]]
Sent: Tuesday, September 20, 2005 4:56 PM
To: '[email protected]'
Subject: IPT_RETURN is not worked in the kernel 2.6.10

Hello folks,

I am currently writing a iptables target. And I want to use the IPT_RETURN as the return value from target. But I found that IPT_RETURN will result as NF_ACCEPT does. What I mean is, while I use IPT_RETURN in my target module. It will not go back to the upper directory. Does anyone ever experience the same problem?

Enviroment:
linux kernel 2.6.10
Iptables 1.2.9

Vincent

The following code is part of the ipt_do_table in the ip_tables.c But I don’t know how to modify it to fix the bug? :(

            if (!t->u.kernel.target->target) {
                int v;

                v = ((struct ipt_standard_target *)t)->verdict;
                if (v < 0) {
                    /* Pop from stack? */
                    if (v != IPT_RETURN) {
                        verdict = (unsigned)(-v) - 1;
                        break;
                    }
                    e = back;
                    back = get_entry(table_base,
                             back->comefrom);
                    continue;
                }
#1 lore raw
Quoted 7 lines · Vincent

Sorry, after understanding the meaning of ipt_do_table function. I know currently the IPT_RETURN is only available in the standard target. But I wonder why don't we have the IPT_RETURN in the user defined target?

Can we create a IPT_RETURN in the user defined target. So that we can use the IPT_RETURN in our target to return to the upper chain.

I don't see that much of a problem with it. It should work if you copy the "if (v != IPT_RETURN)" block from the "if (!t->u.kernel.target->target)" block to the "else" section.

Please test and submit a proposed patch.

And please don't repost your messages thrice to this list, thanks.

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