netfilter: deprecate NF_STOP
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 3 Nov 2016 09:56:17 +0000 (10:56 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 3 Nov 2016 09:56:17 +0000 (10:56 +0100)
NF_STOP is only used by br_netfilter these days, and it can be emulated
with a combination of NF_STOLEN plus explicit call to the ->okfn()
function as Florian suggests.

To retain binary compatibility with userspace nf_queue application, we
have to keep NF_STOP around, so libnetfilter_queue userspace userspace
applications still work if they use NF_STOP for some exotic reason.

Out of tree modules using NF_STOP would break, but we don't care about
those.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/uapi/linux/netfilter.h
net/bridge/br_netfilter_hooks.c
net/netfilter/core.c

index d93f949d1d9aad326231829f70ba57b7b9cf10ee..7550e9176a54ea839ec792d13f223ac0be82f1a1 100644 (file)
@@ -13,7 +13,7 @@
 #define NF_STOLEN 2
 #define NF_QUEUE 3
 #define NF_REPEAT 4
-#define NF_STOP 5
+#define NF_STOP 5      /* Deprecated, for userspace nf_queue compatibility. */
 #define NF_MAX_VERDICT NF_STOP
 
 /* we overload the higher bits for encoding auxiliary data such as the queue
index d0d66faebe904f1c0078f1a9e2d740bf3d74d86f..7e3645fa6339db43fc2e0a6e99bada3de8b76c14 100644 (file)
@@ -845,8 +845,10 @@ static unsigned int ip_sabotage_in(void *priv,
                                   struct sk_buff *skb,
                                   const struct nf_hook_state *state)
 {
-       if (skb->nf_bridge && !skb->nf_bridge->in_prerouting)
-               return NF_STOP;
+       if (skb->nf_bridge && !skb->nf_bridge->in_prerouting) {
+               state->okfn(state->net, state->sk, skb);
+               return NF_STOLEN;
+       }
 
        return NF_ACCEPT;
 }
index cb0232c11bc8b5dff4c2a0d43c56552330406938..14f97b624f9817c7bbcf86e8136d6886f9dce270 100644 (file)
@@ -333,7 +333,7 @@ int nf_hook_slow(struct sk_buff *skb, struct nf_hook_state *state)
        entry = rcu_dereference(state->hook_entries);
 next_hook:
        verdict = nf_iterate(skb, state, &entry);
-       if (verdict == NF_ACCEPT || verdict == NF_STOP) {
+       if (verdict == NF_ACCEPT) {
                ret = 1;
        } else if ((verdict & NF_VERDICT_MASK) == NF_DROP) {
                kfree_skb(skb);