[Devel] [PATCH vz9] Fix GRE

Nikolay Borisov nikolay.borisov at virtuozzo.com
Tue Jan 24 10:46:01 MSK 2023


Fix GRE support in container by disabling erspan, this is needed as the newly
added erspan support isn't enabled for per-container operation. Furthermore
this is a cisco-specific protocol supported on some catalyst switched, used for
traffic mirroring.

https://jira.sw.ru/browse/PSBM-144221

Signed-off-by: Nikolay Borisov <nikolay.borisov at virtuozzo.com>
---
 net/ipv4/ip_gre.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 9fd0b3ee51dd..f4876f93c73f 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1753,9 +1753,11 @@ static int __init ipgre_init(void)
 	if (err < 0)
 		goto pnet_tap_failed;

+#ifndef CONFIG_VE
 	err = register_pernet_device(&erspan_net_ops);
 	if (err < 0)
 		goto pnet_erspan_failed;
+#endif

 	err = gre_add_protocol(&ipgre_protocol, GREPROTO_CISCO);
 	if (err < 0) {
@@ -1770,23 +1772,28 @@ static int __init ipgre_init(void)
 	err = rtnl_link_register(&ipgre_tap_ops);
 	if (err < 0)
 		goto tap_ops_failed;
-
+#ifndef CONFIG_VE
 	err = rtnl_link_register(&erspan_link_ops);
 	if (err < 0)
 		goto erspan_link_failed;
+#endif

 	return 0;

+#ifndef CONFIG_VE
 erspan_link_failed:
 	rtnl_link_unregister(&ipgre_tap_ops);
+#endif
 tap_ops_failed:
 	rtnl_link_unregister(&ipgre_link_ops);
 rtnl_link_failed:
 	gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO);
 add_proto_failed:
 	unregister_pernet_device(&erspan_net_ops);
+#ifndef CONFIG_VE
 pnet_erspan_failed:
 	unregister_pernet_device(&ipgre_tap_net_ops);
+#endif
 pnet_tap_failed:
 	unregister_pernet_device(&ipgre_net_ops);
 	return err;
@@ -1796,11 +1803,15 @@ static void __exit ipgre_fini(void)
 {
 	rtnl_link_unregister(&ipgre_tap_ops);
 	rtnl_link_unregister(&ipgre_link_ops);
+#ifndef CONFIG_VE
 	rtnl_link_unregister(&erspan_link_ops);
+#endif
 	gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO);
 	unregister_pernet_device(&ipgre_tap_net_ops);
 	unregister_pernet_device(&ipgre_net_ops);
+#ifndef CONFIG_VE
 	unregister_pernet_device(&erspan_net_ops);
+#endif
 }

 module_init(ipgre_init);
@@ -1808,7 +1819,9 @@ module_exit(ipgre_fini);
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_RTNL_LINK("gre");
 MODULE_ALIAS_RTNL_LINK("gretap");
+#ifndef CONFIG_VE
 MODULE_ALIAS_RTNL_LINK("erspan");
+MODULE_ALIAS_NETDEV("erspan0");
+#endif
 MODULE_ALIAS_NETDEV("gre0");
 MODULE_ALIAS_NETDEV("gretap0");
-MODULE_ALIAS_NETDEV("erspan0");
--
2.31.1



More information about the Devel mailing list