]> git.proxmox.com Git - ovs.git/commitdiff
gre: Remove dead ipgre code
authorGreg Rose <gvrose8192@gmail.com>
Tue, 6 Nov 2018 22:24:25 +0000 (14:24 -0800)
committerBen Pfaff <blp@ovn.org>
Fri, 9 Nov 2018 17:30:07 +0000 (09:30 -0800)
Open vSwitch uses gretap, not ipgre for gre tunneling.  Remove dead
code for ipgre type tunnels.

Acked-by: William Tu <u9012063@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
datapath/linux/compat/ip_gre.c

index 6ac2dd9614069dc1841644bb2d06e991e93010ab..0faf8ab1c55a801cd56a28333ef5e8389ef727fb 100644 (file)
 #include "vport-netdev.h"
 
 static int gre_tap_net_id __read_mostly;
-static int ipgre_net_id __read_mostly;
 static unsigned int erspan_net_id __read_mostly;
 static void erspan_build_header(struct sk_buff *skb,
                                __be32 id, u32 index,
                                bool truncate, bool is_ipv4);
 
-static struct rtnl_link_ops ipgre_link_ops __read_mostly;
 static bool ip_gre_loaded = false;
 
 #define ip_gre_calc_hlen rpl_ip_gre_calc_hlen
@@ -316,16 +314,10 @@ static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
                 tpi->proto == htons(ETH_P_ERSPAN2))
                itn = net_generic(net, erspan_net_id);
        else
-               itn = net_generic(net, ipgre_net_id);
+               return PACKET_RCVD;
 
        res = __ipgre_rcv(skb, tpi, itn, hdr_len, false);
-       if (res == PACKET_NEXT && tpi->proto == htons(ETH_P_TEB)) {
-               /* ipgre tunnels in collect metadata mode should receive
-                * also ETH_P_TEB traffic.
-                */
-               itn = net_generic(net, ipgre_net_id);
-               res = __ipgre_rcv(skb, tpi, itn, hdr_len, true);
-       }
+
        return res;
 }
 
@@ -727,25 +719,6 @@ static const struct gre_protocol ipgre_protocol = {
        .err_handler = __gre_err,
 };
 
-static int __net_init ipgre_init_net(struct net *net)
-{
-       return ip_tunnel_init_net(net, ipgre_net_id, &ipgre_link_ops, NULL);
-}
-
-static void __net_exit ipgre_exit_net(struct net *net)
-{
-       struct ip_tunnel_net *itn = net_generic(net, ipgre_net_id);
-
-       ip_tunnel_delete_net(itn, &ipgre_link_ops);
-}
-
-static struct pernet_operations ipgre_net_ops = {
-       .init = ipgre_init_net,
-       .exit = ipgre_exit_net,
-       .id   = &ipgre_net_id,
-       .size = sizeof(struct ip_tunnel_net),
-};
-
 #ifdef HAVE_EXT_ACK_IN_RTNL_LINKOPS
 static int ipgre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[],
                                 struct netlink_ext_ack *extack)
@@ -1205,13 +1178,6 @@ static const struct net_device_ops erspan_netdev_ops = {
 #endif
 };
 
-static void ipgre_tunnel_setup(struct net_device *dev)
-{
-       dev->netdev_ops         = &ipgre_netdev_ops;
-       dev->type               = ARPHRD_IPGRE;
-       ip_tunnel_setup(dev, ipgre_net_id);
-}
-
 static void ipgre_tap_setup(struct net_device *dev)
 {
        ether_setup(dev);
@@ -1352,22 +1318,6 @@ static const struct nla_policy ipgre_policy[RPL_IFLA_GRE_MAX + 1] = {
        [IFLA_GRE_ERSPAN_HWID]  = { .type = NLA_U16 },
 };
 
-static struct rtnl_link_ops ipgre_link_ops __read_mostly = {
-       .kind           = "gre",
-       .maxtype        = RPL_IFLA_GRE_MAX,
-       .policy         = ipgre_policy,
-       .priv_size      = sizeof(struct ip_tunnel),
-       .setup          = ipgre_tunnel_setup,
-       .validate       = ipgre_tunnel_validate,
-       .newlink        = ipgre_newlink,
-       .dellink        = ip_tunnel_dellink,
-       .get_size       = ipgre_get_size,
-       .fill_info      = ipgre_fill_info,
-#ifdef HAVE_GET_LINK_NET
-       .get_link_net   = ip_tunnel_get_link_net,
-#endif
-};
-
 static struct rtnl_link_ops ipgre_tap_ops __read_mostly = {
        .kind           = "ovs_gretap",
        .maxtype        = RPL_IFLA_GRE_MAX,
@@ -1655,14 +1605,6 @@ int rpl_ipgre_init(void)
                        goto pnet_erspan_failed;
        }
 
-       err = register_pernet_device(&ipgre_net_ops);
-       if (err < 0) {
-               if (err == -EEXIST)
-                       goto ip_gre_loaded;
-               else
-                       goto pnet_ipgre_failed;
-       }
-
        err = gre_add_protocol(&ipgre_protocol, GREPROTO_CISCO);
        if (err < 0) {
                pr_info("%s: can't add protocol\n", __func__);
@@ -1696,8 +1638,6 @@ ip_gre_loaded:
        return 0;
 
 add_proto_failed:
-       unregister_pernet_device(&ipgre_net_ops);
-pnet_ipgre_failed:
        unregister_pernet_device(&erspan_net_ops);
 pnet_erspan_failed:
        unregister_pernet_device(&ipgre_tap_net_ops);
@@ -1713,7 +1653,6 @@ void rpl_ipgre_fini(void)
 
        if (!ip_gre_loaded) {
                gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO);
-               unregister_pernet_device(&ipgre_net_ops);
                unregister_pernet_device(&erspan_net_ops);
                unregister_pernet_device(&ipgre_tap_net_ops);
        }