From: Sabrina Dubroca <sd@queasysnail.net>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Vasiliy Kovalev <kovalev@altlinux.org>,
Guillaume Nault <gnault@redhat.com>,
Simon Horman <horms@kernel.org>,
David Lebrun <david.lebrun@uclouvain.be>
Subject: Re: [PATCH net-next] ipv6: sr: restruct ifdefines
Date: Tue, 28 May 2024 12:05:12 +0200 [thread overview]
Message-ID: <ZlWsWDFWDCcEa4r9@hog> (raw)
In-Reply-To: <20240528032530.2182346-1-liuhangbin@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2024-05-28 10:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 3:25 [PATCH net-next] ipv6: sr: restruct ifdefines Hangbin Liu
2024-05-28 10:05 ` Sabrina Dubroca [this message]
2024-05-28 13:00 ` Hangbin Liu
2024-05-28 15:29 ` Sabrina Dubroca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZlWsWDFWDCcEa4r9@hog \
--to=sd@queasysnail.net \
--cc=davem@davemloft.net \
--cc=david.lebrun@uclouvain.be \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gnault@redhat.com \
--cc=horms@kernel.org \
--cc=kovalev@altlinux.org \
--cc=kuba@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.