int                     (*gso_send_check)(struct sk_buff *skb);
        struct sk_buff         *(*gso_segment)(struct sk_buff *skb,
                                               int features);
-       int                     no_policy;
+       unsigned int            no_policy:1,
+                               netns_ok:1;
 };
 
 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
 
 
 static int ip_local_deliver_finish(struct sk_buff *skb)
 {
+       struct net *net = skb->dev->nd_net;
+
        __skb_pull(skb, ip_hdrlen(skb));
 
        /* Point into the IP datagram, just past the header. */
                raw = raw_local_deliver(skb, protocol);
 
                hash = protocol & (MAX_INET_PROTOS - 1);
-               if ((ipprot = rcu_dereference(inet_protos[hash])) != NULL) {
+               ipprot = rcu_dereference(inet_protos[hash]);
+               if (ipprot != NULL && (net == &init_net || ipprot->netns_ok)) {
                        int ret;
 
                        if (!ipprot->no_policy) {
        struct iphdr *iph;
        u32 len;
 
-       if (dev->nd_net != &init_net)
-               goto drop;
-
        /* When the interface is in promisc. mode, drop all the crap
         * that it receives, do not try to analyse it.
         */