Subject: Re: [PATCH net-next] ipv6: sr: restruct ifdefines

From: Hangbin Liu <[email-masked]>
Date: Tue, 28 May 2024 21:00:13 +0800

On Tue, May 28, 2024 at 12:05:12PM +0200, Sabrina Dubroca wrote:
> 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 <[email-masked]>
> 
> I think this was suggested by Simon?

Yes, and David Ahern also suggested this. And I thought you also mentioned it?
I was afraid there are too many suggested-by tags here :) I can add them
in next version patch.

> 
> 
> > @@ -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.

Yes.

Thanks
Hangbin