netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ebtables: Allow RETURN target rules in user defined chains
@ 2015-10-22 14:41 Alin Nastac
  2015-10-28  1:01 ` Florian Westphal
  0 siblings, 1 reply; 5+ messages in thread
From: Alin Nastac @ 2015-10-22 14:41 UTC (permalink / raw)
  To: netfilter-devel

ebtables has a bug that prevents creation of rules with RETURN target, any attempt will result in an
    RETURN not allowed on base chain
error even if the chain where you want to create the rule is a user defined chain.

Reproduction scenario:
    root@OpenWrt:~# ebtables -N foo
    root@OpenWrt:~# ebtables -A OUTPUT -j foo
    root@OpenWrt:~# ebtables -A foo -j mark --mark-or 3 --mark-target RETURN
    --mark-target RETURN not allowed on base chain.

My email client will probably replace tabs in the patch below, but it is a one-liner patch after all, easy to spot the actual 
change.

diff --git a/libebtc.c b/libebtc.c
--- a/libebtc.c
+++ b/libebtc.c
@@ -1102,7 +1102,7 @@ void ebt_check_for_loops(struct ebt_u_replace *replace)
                         /* check if we've dealt with this chain already */
                         if (entries2->hook_mask & (1<<i))
                                 goto letscontinue;
-                       entries2->hook_mask |= entries->hook_mask;
+                       entries2->hook_mask |= entries->hook_mask & ~(1 << NF_BR_NUMHOOKS);
                         /* Jump to the chain, make sure we know how to get back */
                         stack[sp].chain_nr = chain_nr;
                         stack[sp].n = j;


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

end of thread, other threads:[~2015-10-28 13:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 14:41 [PATCH] ebtables: Allow RETURN target rules in user defined chains Alin Nastac
2015-10-28  1:01 ` Florian Westphal
2015-10-28  2:46   ` Pablo Neira Ayuso
2015-10-28  2:46     ` Pablo Neira Ayuso
2015-10-28 13:31       ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).