if_index in struct ifnet broken in recent CURRENT

From: Gleb Smirnoff <glebius_at_freebsd.org>
Date: Thu, 12 Aug 2004 11:59:28 +0400
  Hmm, some more information: actually if_index is broken
not only in in mbuf packet headers.

This code with different addresses:

        bzero((caddr_t)&ro, sizeof(ro));
        sin = (struct sockaddr_in *)&ro.ro_dst;
        sin->sin_len = sizeof(*sin);
        sin->sin_family = AF_INET;
        sin->sin_addr = \\some address\\;
        rtalloc_ign(&ro, RTF_CLONING);
        if (ro.ro_rt != NULL) {
                struct rtentry *rt = ro.ro_rt;

                printf("rt idx %d, name %s\n",
                        rt->rt_ifp->if_index,
                        rt->rt_ifp->if_xname);

produces 

rt idx 0, name fxp0
rt idx 0, name lo0

On Thu, Aug 12, 2004 at 11:50:53AM +0400, Gleb Smirnoff wrote:
T>   I can see this at least in fxp driver: if I capture packets using
T> ng_ether(4), and check interface name like this
T> 
T>                 printf("idx %d, name %s\n",
T>                         (*m)->m_pkthdr.rcvif->if_index,
T>                         (*m)->m_pkthdr.rcvif->if_xname);
T> I get on console:
T> 
T> idx 0, name fxp0
T> 
T> Really fxp's index is 1 (AFAIK if_index must be > 0), I have checked this
T> using if_nametoindex() from userland.

-- 
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE
Received on Thu Aug 12 2004 - 05:59:34 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:05 UTC