On Tue, 26 May 2015 00:41:22 +0200
David Lamparter <[email protected]> wrote:

> On Mon, May 25, 2015 at 07:04:28PM +0100, Paul Jakma wrote:
> > On Fri, 22 May 2015, Timo Teräs wrote:
> > 
> > > +  ifp->hw_type = stream_getl (s);
> > 
> > So what will/should this be on other platforms?
> 
> To my knowledge, no platforms on our support list except Linux support
> multipoint GRE, so at least for this specific instance the question is
> rather moot.

I'm not sure of how other platforms handle it. But yes, nhrp is
linux-only for the time being. It is also possible to implement
instantiation of point-to-point tunnels in nhrpd later on; that would
work with larger set of platforms.

> (It also seems like the hw_type field is save-and-forget so far, I
> couldn't find any other references to it throughout the sources.)

Yes it looks like that. It's curious that it was added to "struct
interface", but never used anywhere.

> > What information are we trying to capture here, and do we perhaps
> > need to add a Quagga platform abstraction?
> 
> NHRP needs to find out whether a device is a multipoint GRE tunnel, a
> question we can spare asking on non-Linux...  (and nhrpd opens a
> netlink socket too.)
> 
> If we come up with something better we can always change it later.

http://linux.die.net/man/7/netdevice :
"
SIOCGIFHWADDR, SIOCSIFHWADDR
    Get or set the hardware address of a device using ifr_hwaddr. The
hardware address is specified in a struct sockaddr. sa_family contains
the ARPHRD_* device type, sa_data the L2 hardware address starting from
byte 0. Setting the hardware address is a privileged operation. 
"
I'm not fully certain if *BSD do this too. But we could take the
sa_family in zebra/if_ioctl.c:if_get_hwaddr().

The other path is in zebra/kernel_socket.c:ifm_read(), and I believe
than then we can take struct sockaddr_dl.sdl_type. Though the other
fields are ARPHRD_*, and sdl_type seems to be IFT_*. So this might
require additional mapping if we want to have it always of same type.

Though in the above case it seems that struct interface contains
"struct sockaddr_dl sdl;" instead. Thus the IFT_* is passed around
implicitly already. Which reminds of the ugly ABI issue that zebra
protocol passess hw address differently depending on what ./configure
detects (HAVE_STRUCT_SOCKADDR_DL).

/Timo

_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to