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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180826135006.157d1bc2@xeon-e3>
Date:   Sun, 26 Aug 2018 13:50:06 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     "Robert P. J. Day" <rpjday@...shcourse.ca>
Cc:     Linux kernel netdev mailing list <netdev@...r.kernel.org>
Subject: Re: followup: what's responsible for setting netdev->operstate to
 IF_OPER_DOWN?

On Sun, 26 Aug 2018 11:14:33 -0400 (EDT)
"Robert P. J. Day" <rpjday@...shcourse.ca> wrote:

>   apologies for the constant pleas for assistance, but i think i'm
> zeroing in on the problem that started all this. recap: custom
> FPGA-based linux box with multiple ports, where the current symptom is
> that there is no userspace notification when someone simply unplugs
> one of the ports ("ifconfig" shows that interface still RUNNING).
> 
>   as i read it, an active ethernet interface should be both UP (the
> administrative state) and RUNNING (the RFC 2863-defined operational
> state). if i unplug, i've verified on a standard net port on my laptop
> that the interface is still UP, but no longer RUNNING, which makes
> perfect sense. i plug back in, interface starts RUNNING again. so
> where's the problem?
> 
>   i can see that whether ifconfig shows an interface RUNNING is
> defined in net/core/dev.c:
> 
>   unsigned int dev_get_flags(const struct net_device *dev)
>   {
>         unsigned int flags;
> 
>         flags = (dev->flags & ~(IFF_PROMISC |
>                                 IFF_ALLMULTI |
>                                 IFF_RUNNING |
>                                 IFF_LOWER_UP |
>                                 IFF_DORMANT)) |
>                 (dev->gflags & (IFF_PROMISC |
>                                 IFF_ALLMULTI));
> 
>         if (netif_running(dev)) {
>                 if (netif_oper_up(dev))
>                         flags |= IFF_RUNNING;  <---- THERE
>                 if (netif_carrier_ok(dev))
>                         flags |= IFF_LOWER_UP;
>                 if (netif_dormant(dev))
>                         flags |= IFF_DORMANT;
>         }
> 
>         return flags;
>   }
> 
> where netif_oper_up() is defined as:
> 
>   static inline bool netif_oper_up(const struct net_device *dev)
>   {
>         return (dev->operstate == IF_OPER_UP ||
>                 dev->operstate == IF_OPER_UNKNOWN /* backward compat */);
>   }
> 
> so i am simply assuming that the underlying problem is that,
> somewhere down below, the unplugging of a port is somehow not setting
> dev->operstate to its proper value of IF_OPER_DOWN.
> 
>   that would clearly explain everything, and i'm about to dig even
> further to see where the event of unplugging a port *should* be
> recognized, but does this sound like a reasonable diagnosis? there
> have been other problems with the programming of the FPGA, so it would
> surprise absolutely no one to learn that this aspect was
> misprogrammed.
> 
> rday
> 

There is no reason drivers should ever muck with flags directly.
You probably are looking for netif_detach

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ