Re: [PATCH linux-next v2] mpls: don't build sysctl related code when sysctl is disabled

From: Matteo Croce
Date: Fri Jun 07 2019 - 14:25:36 EST


On Fri, Jun 7, 2019 at 7:14 PM David Ahern <dsahern@xxxxxxxxx> wrote:
>
> On 6/6/19 6:36 PM, Matteo Croce wrote:
> > Some sysctl related code and data structures is never referenced
> > when CONFIG_SYSCTL is not set.
> > While this is usually harmless, it produces a build failure since sysctl
> > shared variables exists, due to missing sysctl_vals symbol:
> >
> > ld: net/mpls/af_mpls.o: in function `mpls_platform_labels':
> > af_mpls.c:(.text+0x162a): undefined reference to `sysctl_vals'
> > ld: net/mpls/af_mpls.o:(.rodata+0x830): undefined reference to `sysctl_vals'
> > ld: net/mpls/af_mpls.o:(.rodata+0x838): undefined reference to `sysctl_vals'
> > ld: net/mpls/af_mpls.o:(.rodata+0x870): undefined reference to `sysctl_vals'
> >
> > Fix this by moving all sysctl related code under #ifdef CONFIG_SYSCTL
> >
> > Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> > Signed-off-by: Matteo Croce <mcroce@xxxxxxxxxx>
> > ---
> >
> > v1 -> v2: fix a crash on netns destroy
> >
> > net/mpls/af_mpls.c | 393 ++++++++++++++++++++++++---------------------
> > 1 file changed, 207 insertions(+), 186 deletions(-)
> >
>
> As I recall you need to set platform_labels for the mpls code to even
> work, so building mpls_router without sysctl is pointless.

This would explain why so much code went under the #ifdef.
Should we select or depend on sysctl maybe?

Regards,
--
Matteo Croce
per aspera ad upstream