]> git.proxmox.com Git - ovs.git/commitdiff
datapath: Do not fail to load on gre protocol conflict
authorGreg Rose <gvrose8192@gmail.com>
Mon, 4 Jun 2018 20:14:38 +0000 (13:14 -0700)
committerBen Pfaff <blp@ovn.org>
Tue, 5 Jun 2018 17:38:06 +0000 (10:38 -0700)
The ERSPAN feature depends on the gre kernel module so on systems where
the ERSPAN feature isn't supported the openvswitch kernel module would
attempt to grab the ipv4 GRE protocol entry point and would fail to load
if it could not.

This patch modifies openvswitch to not fail to load when the gre kernel
module is loaded and instead it will print a warning message to the
kernel system log indicating that the ERSPAN feature may not be
available.

We need this patch because users are experiencing failures due to the
conflicts and high priority bugs are resulting.

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

index 7f2b545566c2323e3c726b1c166ebba623590d17..2b14c5ac0fe025e213b1a149cf697e1f6f20aef0 100644 (file)
@@ -127,7 +127,7 @@ int rpl_gre_init(void)
 
        if (inet_add_protocol(&net_gre_protocol, IPPROTO_GRE) < 0) {
                pr_err("can't add protocol\n");
-               return -EAGAIN;
+               return -EEXIST;
        }
        return 0;
 }
index 73dd7783c241fa02cee69662dc31684e2ae198f6..56096efc0f73b32325ad7720a089e3ad0bc83b20 100644 (file)
@@ -42,6 +42,7 @@
 #include "vport-internal_dev.h"
 
 static LIST_HEAD(vport_ops_list);
+static bool compat_gre_loaded = false;
 
 /* Protected by RCU read lock for reading, ovs_mutex for writing. */
 static struct hlist_head *dev_table;
@@ -64,9 +65,17 @@ int ovs_vport_init(void)
        err = lisp_init_module();
        if (err)
                goto err_lisp;
-       err = ipgre_init();
-       if (err)
-               goto err_ipgre;
+       err = gre_init();
+       if (err && err != -EEXIST)
+               goto err_gre;
+       else if (err == -EEXIST)
+               pr_warn("Cannot take GRE protocol entry - The ERSPAN feature may not be supported\n");
+       else {
+               err = ipgre_init();
+               if (err && err != -EEXIST) 
+                       goto err_ipgre;
+               compat_gre_loaded = true;
+       }
        err = ip6gre_init();
        if (err)
                goto err_ip6gre;
@@ -82,12 +91,8 @@ int ovs_vport_init(void)
        err = ovs_stt_init_module();
        if (err)
                goto err_stt;
-       err = gre_init();
-       if (err)
-               goto err_gre;
 
        return 0;
-err_gre:
        ovs_stt_cleanup_module();
 err_stt:
        vxlan_cleanup_module();
@@ -100,6 +105,8 @@ err_ip6_tunnel:
 err_ip6gre:
        ipgre_fini();
 err_ipgre:
+       gre_exit();
+err_gre:
        lisp_cleanup_module();
 err_lisp:
        kfree(dev_table);
@@ -113,13 +120,15 @@ err_lisp:
  */
 void ovs_vport_exit(void)
 {
-       gre_exit();
+       if (compat_gre_loaded) {
+               gre_exit();
+               ipgre_fini();
+       }
        ovs_stt_cleanup_module();
        vxlan_cleanup_module();
        geneve_cleanup_module();
        ip6_tunnel_cleanup();
        ip6gre_fini();
-       ipgre_fini();
        lisp_cleanup_module();
        kfree(dev_table);
 }