tech-net archive

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

Re: tap interface address



On Mon, 11 Aug 2008, Iain Hibbert wrote:

> Interestingly, using socket(PF_INET, SOCK_STREAM, 0) gives EADDRNOTAVAIL
> as does (PF_INET, SOCK_DGRAM, 0) but (PF_INET, SOCK_SEQPACKET, 0) is
> EOPNOTSUPP.
>
> I thought that the 'i' ioctls were diverted to the network stack?

and they are, when passed through a socket.

> I wonder if I need to prepare the sockaddr somehow?

to answer my own question, no

If SIOCGIFADDR is called on a socket, it will get routed to the
PRU_CONTROL code of the socket rather than the ioctl code of the device.
In this case, because there is no INET address associated with the tap
(its just been made) I get an error.

There are no L2CAP ioctl's, so the protocol code returns EPASSTHROUGH
which is translated to ENOTTY.

So, how do I get to the ethernet address? (technically, it does not have
any address family protocol code :)

I'm supposing that SIOCGLIFPHYADDR would be the one (matches the
SIOCSLIFPHYADDR that is used to set the same) -- this is implemented in
gif(4) and gre(4) but I don't see any documentation about it.

iain


Home | Main Index | Thread Index | Old Index