lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220210083612.4mszzwgcrvmn67rn@soft-dev3-1.localhost>
Date:   Thu, 10 Feb 2022 09:36:12 +0100
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     Jakub Kicinski <kuba@...nel.org>
CC:     Andrew Lunn <andrew@...n.ch>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>,
        <davem@...emloft.net>, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH net-next] net: lan966x: Fix when CONFIG_IPV6 is not set

The 02/09/2022 18:06, Jakub Kicinski wrote:

Hi Andrew, Jakub
> 
> On Wed, 9 Feb 2022 14:54:23 +0100 Andrew Lunn wrote:
> > On Wed, Feb 09, 2022 at 11:18:23AM +0100, Horatiu Vultur wrote:
> > > When CONFIG_IPV6 is not set, then the compilation of the lan966x driver
> 
> compilation or linking?

It is a linking error. I will fix in the next version

> 
> > > fails with the following error:
> > >
> > > drivers/net/ethernet/microchip/lan966x/lan966x_main.c:444: undefined
> > > reference to `ipv6_mc_check_mld'
> > >
> > > The fix consists in adding #ifdef around this code.
> >
> > It might be better to add a stub function for when IPv6 is
> > disabled. We try to avoid #if in C code.

What do you think if I do something like this in the lan966x_main.h

---
#if IS_ENABLED(CONFIG_IPV6)
static inline bool lan966x_hw_offload_ipv6(struct sk_buff *skb)
{
	if (skb->protocol == htons(ETH_P_IPV6) &&
	    ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) &&
	    !ipv6_mc_check_mld(skb))
		return false;

	return true;
}
#else
static inline bool lan966x_hw_offload_ipv6(struct sk_buff *skb)
{
	return false;
}
#endif
---

And then in lan966x_main.c just call this function.

> 
> If it's linking we can do:
> 
>         if (IS_ENABLED(CONFIG_IPV6) &&
>             skb->protocol == htons(ETH_P_IPV6) &&
>             ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) &&
>             !ipv6_mc_check_mld(skb))
>                 return false;
> 
> But beware that IPV6 can be a module, you may need a Kconfig dependency.

I was also looking at other drivers on how they use 'ipv6_mc_check_mld'.
Then I have seen that drivers/net/amt.c and net/bridge/br_multicast.c
they wrap this function with #if.
But then there is net/batman-adv/multicast.c which doesn't do that and
it can compile and link without CONFIG_IPV6 and I just don't see how
that is working.

-- 
/Horatiu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ