[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Issues found by inetutils-ifconfig.



Thursday den 16 July 2015 klockan 13:01 skrev Justus Winter detta:
> 
> >   * The hardware type of an adaper is encoded in the member
> >     `ifr_hwaddr.sa_family' of `struct ifreq'. An ethernet
> >     adapter will correctly state ARPHRD_ETHER (= 1), while
> >     the loopback adapter `lo' will be in error with a value 4.
> >     The correct value is ARPHRD_LOOPBACK (= 772), which is
> >     in use by GNU/Linux. See the header <net/if_arp.h>.
> >     The value 4 is ARPHRD_PRONET, the PROnet token ring!
> 
> That is surprising indeed.  A superficial look revealed that it should
> indeed be set to ARPHRD_LOOPBACK:
> 
> % grep ARPHRD_LOOPBACK
> pfinet/linux-src/include/linux/if_arp.h:#define ARPHRD_LOOPBACK   772             /* Loopback device              */
> [...]
> pfinet/loopback.c:        dev->type               = ARPHRD_LOOPBACK;

A possibly relevant observation: The obtained value 4 is
identical to ARPHRD_LOOPBACK & 0x00ff. Is 'dev->type'
of length 16 bits, i.e., a short integer like 'sa_family'?

Best regards,
  Mats Erik Andersson, on behalf of GNU Inetutils


Reply to: