tcp: send packets with a socket timestamp
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / protocol.c
index 0f9d09f54bd9d781bb74d577185c571fe632b270..ce848461acbb07f6b758dc900225c7aff16ac690 100644 (file)
@@ -37,6 +37,12 @@ const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly;
 
 int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
 {
+       if (!prot->netns_ok) {
+               pr_err("Protocol %u is not namespace aware, cannot register.\n",
+                       protocol);
+               return -EINVAL;
+       }
+
        return !cmpxchg((const struct net_protocol **)&inet_protos[protocol],
                        NULL, prot) ? 0 : -1;
 }