Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1335622

Re: [PATCH] net: igmp: use IS_ENABLED(CONFIG_IP_MULTICAST) instead of ifdef

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH] net: igmp: use IS_ENABLED(CONFIG_IP_MULTICAST) instead of ifdef
Date 2016-02-16 17:40 +0100
Message-ID <r2QPp-1Uv-37@gated-at.bofh.it> (permalink)
References <r2Qmn-1Is-27@gated-at.bofh.it> <r2Qw2-1LV-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tuesday 16 February 2016 18:10:52 Nikolay Borisov wrote:
> On 02/16/2016 05:59 PM, Arnd Bergmann wrote:
> > @@ -1821,17 +1807,15 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
> >  		if (!err && rv < 0)
> >  			err = rv;
> >  	}
> > -	if (pmc->sfmode == MCAST_EXCLUDE &&
> > +	if (IS_ENABLED(CONFIG_IP_MULTICAST) &&
> > +	    pmc->sfmode == MCAST_EXCLUDE &&
> >  	    pmc->sfcount[MCAST_EXCLUDE] == 0 &&
> >  	    pmc->sfcount[MCAST_INCLUDE]) {
> > -#ifdef CONFIG_IP_MULTICAST
> >  		struct ip_sf_list *psf;
> >  		struct net *net = dev_net(in_dev->dev);
> > -#endif
> >  
> >  		/* filter mode change */
> >  		pmc->sfmode = MCAST_INCLUDE;
> 
> The above line was always executed, whereas now it wouldn't execute
> unless IS_ENABLED passes.

This was not intentional, I've sent a v2 patch to fix it up now, and
tried to simplify it a little further, making the logic the
same for  ip_mc_del_src and ip_mc_add_src.

> >  /*
> >   * Add multicast source filter list to the interface list
> > @@ -1977,9 +1961,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
> >  	spin_lock_bh(&pmc->lock);
> >  	rcu_read_unlock();
> >  
> > -#ifdef CONFIG_IP_MULTICAST
> >  	sf_markstate(pmc);
> > -#endif
> 
> This would be executed unconditionally, which is contrary to the
> original intention. Dunno if it makes a difference though.

This was intentional, I have changed sf_markstate() to do nothing when
IP_MULTICAST is disabled. However, there was another caller where
I should have done the same thing rather than adding an if().

> Reviewed-by: Nikolay Borisov <kernel@kyup.com>

Thanks!

	Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] net: igmp: use IS_ENABLED(CONFIG_IP_MULTICAST) instead of ifdef Arnd Bergmann <arnd@arndb.de> - 2016-02-16 17:10 +0100
  Re: [PATCH] net: igmp: use IS_ENABLED(CONFIG_IP_MULTICAST) instead of  ifdef Nikolay Borisov <kernel@kyup.com> - 2016-02-16 17:20 +0100
    Re: [PATCH] net: igmp: use IS_ENABLED(CONFIG_IP_MULTICAST) instead of ifdef Arnd Bergmann <arnd@arndb.de> - 2016-02-16 17:40 +0100

csiph-web