net: Remove the member netns_ok
authorYejune Deng <yejune.deng@gmail.com>
Mon, 17 May 2021 12:22:05 +0000 (20:22 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 May 2021 22:29:35 +0000 (15:29 -0700)
Every protocol has the 'netns_ok' member and it is euqal to 1. The
'if (!prot->netns_ok)' always false in inet_add_protocol().

Signed-off-by: Yejune Deng <yejunedeng@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/protocol.h
net/dccp/ipv4.c
net/ipv4/af_inet.c
net/ipv4/gre_demux.c
net/ipv4/ipmr.c
net/ipv4/protocol.c
net/ipv4/tunnel4.c
net/ipv4/udplite.c
net/ipv4/xfrm4_protocol.c
net/l2tp/l2tp_ip.c
net/sctp/protocol.c

index 2b778e1d2d8f1365c969952b9aed939e28cb80d7..f51c06ae365f5b6cc114d737c2d8f2611b74560a 100644 (file)
@@ -43,7 +43,6 @@ struct net_protocol {
        int                     (*err_handler)(struct sk_buff *skb, u32 info);
 
        unsigned int            no_policy:1,
-                               netns_ok:1,
                                /* does the protocol do more stringent
                                 * icmp tag validation than simple
                                 * socket lookup?
index ffc601a3b329ada28d1ac449a80817d1113be6ed..f81c1df761d38b0c0677e03bfd10e0da5584998b 100644 (file)
@@ -977,7 +977,6 @@ static const struct net_protocol dccp_v4_protocol = {
        .handler        = dccp_v4_rcv,
        .err_handler    = dccp_v4_err,
        .no_policy      = 1,
-       .netns_ok       = 1,
        .icmp_strict_tag_validation = 1,
 };
 
index f17870ee558bbaa043c10dc5b8a61a3fa1304880..d9bccad65e2b4bc250d6b500f80b46bdd9e4a536 100644 (file)
@@ -1720,7 +1720,6 @@ EXPORT_SYMBOL_GPL(snmp_fold_field64);
 #ifdef CONFIG_IP_MULTICAST
 static const struct net_protocol igmp_protocol = {
        .handler =      igmp_rcv,
-       .netns_ok =     1,
 };
 #endif
 
@@ -1733,7 +1732,6 @@ static struct net_protocol tcp_protocol = {
        .handler        =       tcp_v4_rcv,
        .err_handler    =       tcp_v4_err,
        .no_policy      =       1,
-       .netns_ok       =       1,
        .icmp_strict_tag_validation = 1,
 };
 
@@ -1746,14 +1744,12 @@ static struct net_protocol udp_protocol = {
        .handler =      udp_rcv,
        .err_handler =  udp_err,
        .no_policy =    1,
-       .netns_ok =     1,
 };
 
 static const struct net_protocol icmp_protocol = {
        .handler =      icmp_rcv,
        .err_handler =  icmp_err,
        .no_policy =    1,
-       .netns_ok =     1,
 };
 
 static __net_init int ipv4_mib_init_net(struct net *net)
index 5d1e6fe9d8387be37fad18b7c6a7a65fd9c18d27..cbb2b4bb0dfac5656bcb81474fc470633f36122a 100644 (file)
@@ -195,7 +195,6 @@ static int gre_err(struct sk_buff *skb, u32 info)
 static const struct net_protocol net_gre_protocol = {
        .handler     = gre_rcv,
        .err_handler = gre_err,
-       .netns_ok    = 1,
 };
 
 static int __init gre_init(void)
index 939792a3881461275b9c7fae5b3a5e0881a59584..12b564b1ecb46bf97f6f43ccd40acf509bcf1363 100644 (file)
@@ -3007,7 +3007,6 @@ static const struct seq_operations ipmr_mfc_seq_ops = {
 #ifdef CONFIG_IP_PIMSM_V2
 static const struct net_protocol pim_protocol = {
        .handler        =       pim_rcv,
-       .netns_ok       =       1,
 };
 #endif
 
index 9a8c0892622b035acc2e34a7275dbb98350d2555..6913979948d738824cea3f4b4495b6ad59b3f385 100644 (file)
@@ -31,12 +31,6 @@ EXPORT_SYMBOL(inet_offloads);
 
 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;
 }
index e44aaf41a13832aa13bc2205095cad3d75f16951..5048c47c79b2848a1b42032dceb4884f43cd4748 100644 (file)
@@ -218,7 +218,6 @@ static const struct net_protocol tunnel4_protocol = {
        .handler        =       tunnel4_rcv,
        .err_handler    =       tunnel4_err,
        .no_policy      =       1,
-       .netns_ok       =       1,
 };
 
 #if IS_ENABLED(CONFIG_IPV6)
@@ -226,7 +225,6 @@ static const struct net_protocol tunnel64_protocol = {
        .handler        =       tunnel64_rcv,
        .err_handler    =       tunnel64_err,
        .no_policy      =       1,
-       .netns_ok       =       1,
 };
 #endif
 
@@ -235,7 +233,6 @@ static const struct net_protocol tunnelmpls4_protocol = {
        .handler        =       tunnelmpls4_rcv,
        .err_handler    =       tunnelmpls4_err,
        .no_policy      =       1,
-       .netns_ok       =       1,
 };
 #endif
 
index bd8773b49e72ed826c761f8190db32effdf15c8b..cd1cd68adeec88e4cfcc75c3f32b6243229df670 100644 (file)
@@ -31,7 +31,6 @@ static const struct net_protocol udplite_protocol = {
        .handler        = udplite_rcv,
        .err_handler    = udplite_err,
        .no_policy      = 1,
-       .netns_ok       = 1,
 };
 
 struct proto   udplite_prot = {
index ea595c8549c7776a6d6e2fdb2f95e03307e11556..2fe5860c21d6ecc616d09cfe98c48419ed506c51 100644 (file)
@@ -181,21 +181,18 @@ static const struct net_protocol esp4_protocol = {
        .handler        =       xfrm4_esp_rcv,
        .err_handler    =       xfrm4_esp_err,
        .no_policy      =       1,
-       .netns_ok       =       1,
 };
 
 static const struct net_protocol ah4_protocol = {
        .handler        =       xfrm4_ah_rcv,
        .err_handler    =       xfrm4_ah_err,
        .no_policy      =       1,
-       .netns_ok       =       1,
 };
 
 static const struct net_protocol ipcomp4_protocol = {
        .handler        =       xfrm4_ipcomp_rcv,
        .err_handler    =       xfrm4_ipcomp_err,
        .no_policy      =       1,
-       .netns_ok       =       1,
 };
 
 static const struct xfrm_input_afinfo xfrm4_input_afinfo = {
index 97ae1255fcb69076a5fd5918349d43312840eedd..536c30d4dd7d7d9e707c6657b92b108702ff6bd2 100644 (file)
@@ -635,7 +635,6 @@ static struct inet_protosw l2tp_ip_protosw = {
 
 static struct net_protocol l2tp_ip_protocol __read_mostly = {
        .handler        = l2tp_ip_recv,
-       .netns_ok       = 1,
 };
 
 static int __init l2tp_ip_init(void)
index 6f2bbfeec3a4c7e8386f70a470e83063204dc50e..baa4e770e4ba56b66dd57743444c4869c4f47f7f 100644 (file)
@@ -1171,7 +1171,6 @@ static const struct net_protocol sctp_protocol = {
        .handler     = sctp4_rcv,
        .err_handler = sctp_v4_err,
        .no_policy   = 1,
-       .netns_ok    = 1,
        .icmp_strict_tag_validation = 1,
 };