On 7/27/2018 2:22 AM, William Tu wrote:
On Thu, Jul 26, 2018 at 9:11 AM, Greg Rose <[email protected]
<mailto:[email protected]>> wrote:
When for some reason the built-in kernel ip6_gre module is loaded that
would prevent the openvswitch kernel driver from loading. Even when
the built-in kernel ip6_gre module is loaded we can still perform
port mirroring via Tx. Adjust the error handling and detect when
the ip6_gre kernel module is loaded and in that case still enable
IPv6 GRE/ERSPAN Tx.
Signed-off-by: Greg Rose <[email protected]
<mailto:[email protected]>>
---
datapath/linux/compat/ip6_gre.c | 39
+++++++++++++++++++++++++++++++++------
datapath/vport.c | 17 +++++++++++++++--
2 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/datapath/linux/compat/ip6_gre.c
b/datapath/linux/compat/ip6_gre.c
index 0c88547..f532f21 100644
--- a/datapath/linux/compat/ip6_gre.c
+++ b/datapath/linux/compat/ip6_gre.c
@@ -65,6 +65,7 @@
#define IP6_GRE_HASH_SIZE (1 << IP6_GRE_HASH_SIZE_SHIFT)
static unsigned int ip6gre_net_id __read_mostly;
+static bool ip6_gre_loaded = false;
struct ip6gre_net {
struct ip6_tnl __rcu *tunnels[4][IP6_GRE_HASH_SIZE];
@@ -2792,19 +2793,43 @@ int rpl_ip6gre_init(void)
int err;
err = register_pernet_device(&ip6gre_net_ops);
- if (err < 0)
- return err;
+ if (err < 0) {
+ if (err == -EEXIST)
+ goto ip6_gre_loaded;
+ else
+ goto out;
+ }
err = inet6_add_protocol(&ip6gre_protocol, IPPROTO_GRE);
if (err < 0) {
pr_info("%s: can't add protocol\n", __func__);
- goto add_proto_failed;
+ if (err == -EBUSY) {
inet6_add_protocol returns -1 when there already a protocol registered.
Good catch - in practical terms it never got there anyway if ip6_gre was
loaded but we obviously can't
always count on that!
+ goto ip6_gre_loaded;
+ } else {
+ goto add_proto_failed;
+ }
}
pr_info("GRE over IPv6 tunneling driver\n");
ovs_vport_ops_register(&ovs_ip6gre_vport_ops);
ovs_vport_ops_register(&ovs_erspan6_vport_ops);
- return 0;
+ return err;
+
+ip6_gre_loaded:
+ /* Since GRE only allows single receiver to be registerd,
+ * we skip here so only gre transmit works, see:
+ *
+ * commit 9f57c67c379d88a10e8ad676426fee5ae7341b14
This commit is for ipv4 gre.
IPv6 gre is commit f9242b6b28d61
(David S. Miller 2012-06-19 18:56:21 -0700 34) return
!cmpxchg((const struct inet6_protocol
OK, I'll fix that up.
**)&inet6_protos[protocol],
+ * Author: Pravin B Shelar <[email protected]
<mailto:[email protected]>>
+ * Date: Fri Aug 7 23:51:52 2015 -0700
+ * gre: Remove support for sharing GRE protocol hook
+ *
+ * OVS GRE receive part is disabled.
+ */
Others look good to me!
Thanks for the patch
V2 will be out in a bit.
Thanks for the review!
- Greg
William
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev