Re: Non-contiguous ifIndex problems with ifMib sysctl

From: Brooks Davis (brooks_at_one-eyed-alien.net)
Date: 10/22/03

  • Next message: Edwin Groothuis: "UDP connect: Can't assign requested address or "how to determine the outgoing IP address?""
    Date: Wed, 22 Oct 2003 11:09:28 -0700
    To: Gerrit Nagelhout <gnagelhout@sandvine.com>
    
    
    

    On Wed, Oct 22, 2003 at 01:41:57PM -0400, Gerrit Nagelhout wrote:
    > Hi,
    >
    > I am trying to debug a crash (null pointer access) in sysctl_ifdata (in
    > if_mib.c). What I have noticed is that if interfaces (in this case vlans)
    > are created and destroyed dynamically, it is possible to create "holes" in
    > the ifnet_addrs structure. For example, if I start with the following
    > interfaces:
    > 1 em0
    > 2 em1
    > 3 lo0
    >
    > and then do:
    > ifconfig vlan1 create
    > ifconfig vlan2 create
    > ifconfig vlan1 destroy
    >
    > I end up with:
    > 1 em0
    > 2 em1
    > 3 lo0
    > 4 0
    > 5 vlan2
    >
    > In this case, the net.link.generic.system.ifcount is set to 4. If an
    > application (like slurm) then calls sysctl on
    > net.link.generic.ifdata.<ifindex>, and loops from 1 to 5 for ifIndex, it
    > will crash when it gets to 4 because there are no checks for these holes,
    > and 4 is less than if_index.
    > I have also noticed that an snmpwalk to a system like this will have the
    > proper interface count, but will only show the interfaces before the hole.
    > It's easy enough to add the null check in sysctl_ifdata, and just return
    > ENOENT, but that won't fix the snmpwalk problem. How should applications
    > generally deal with this?

    This was fixed in current with ENOENT two years ago, but the author
    forgot to MFC the change. Given how long this has been broken (since we
    got removable devices), I'm inclined to wait until after 4.9 comes out
    to do the MFC rather then trying to get it in under the wire.

    I don't see the behavior you describe with ifcount. The ifcount sysctl
    is just an export if_index which is the last index, not the number of
    interfaces. This might be considered a bug in ifcount's implementation.

    -- Brooks

    -- 
    Any statement of the form "X is the one, true Y" is FALSE.
    PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4
    
    



  • Next message: Edwin Groothuis: "UDP connect: Can't assign requested address or "how to determine the outgoing IP address?""

    Relevant Pages

    • Non-contiguous ifIndex problems with ifMib sysctl
      ... I am trying to debug a crash in sysctl_ifdata (in ... What I have noticed is that if interfaces ... ifconfig vlan1 destroy ... will crash when it gets to 4 because there are no checks for these holes, ...
      (freebsd-net)
    • Re: Making MFC application to expose COM interfaces
      ... > So what you mean to say is that if the MFC application, ... > Server since it is going to expose interfaces, ... > I double click the MFC Server from explorer. ...
      (microsoft.public.vc.atl)
    • Re: Input on graphic libraires
      ... > MFC - I am very familiar with MFC and I know it advantages well. ... > wxWindows - I just discovered this. ... building - libglade, for example, allows you to write your interfaces as ... d dot neary at phenix dot fr ...
      (comp.programming)
    • Registering a CLSID in MFC application
      ... My project is a MFC multidoc application. ... interfaces so that the application can cater the needs of the clients ... Where I should and what code must i add to register it. ...
      (microsoft.public.vc.atl)
    • Registering a CLSID in MFC application
      ... My project is a MFC multidoc application. ... interfaces so that the application can cater the needs of the clients ... Where I should and what code must i add to register it. ...
      (microsoft.public.vc.mfc)