[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZlWsWDFWDCcEa4r9@hog>
Date: Tue, 28 May 2024 12:05:12 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Vasiliy Kovalev <kovalev@...linux.org>,
Guillaume Nault <gnault@...hat.com>,
Simon Horman <horms@...nel.org>,
David Lebrun <david.lebrun@...ouvain.be>
Subject: Re: [PATCH net-next] ipv6: sr: restruct ifdefines
Hi Hangbin,
2024-05-28, 11:25:30 +0800, Hangbin Liu wrote:
> There are too many ifdef in IPv6 segment routing code that may cause logic
> problems. like commit 160e9d275218 ("ipv6: sr: fix invalid unregister error
> path"). To avoid this, the init functions are redefined for both cases. The
> code could be more clear after all fidefs are removed.
>
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
I think this was suggested by Simon?
> @@ -520,7 +514,6 @@ int __init seg6_init(void)
> if (err)
> goto out_unregister_pernet;
>
(With a bit more context around this:)
> -#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
> err = seg6_iptunnel_init();
> if (err)
> goto out_unregister_genl;
>
> err = seg6_local_init();
> if (err) {
> seg6_iptunnel_exit();
With those changes, we don't need this weird partial uninit anymore,
we can just create a new label above the other seg6_iptunnel_exit()
call and jump there directly.
> goto out_unregister_genl;
> }
> -#endif
>
> -#ifdef CONFIG_IPV6_SEG6_HMAC
> err = seg6_hmac_init();
> if (err)
> goto out_unregister_iptun;
> -#endif
>
> pr_info("Segment Routing with IPv6\n");
>
> out:
> return err;
> -#ifdef CONFIG_IPV6_SEG6_HMAC
> out_unregister_iptun:
> -#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
> seg6_local_exit();
[jump here]
> seg6_iptunnel_exit();
> -#endif
> -#endif
> -#ifdef CONFIG_IPV6_SEG6_LWTUNNEL
> out_unregister_genl:
> -#endif
> -#if IS_ENABLED(CONFIG_IPV6_SEG6_LWTUNNEL) || IS_ENABLED(CONFIG_IPV6_SEG6_HMAC)
> genl_unregister_family(&seg6_genl_family);
> -#endif
> out_unregister_pernet:
> unregister_pernet_subsys(&ip6_segments_ops);
> goto out;
--
Sabrina
Powered by blists - more mailing lists