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

Re: Other uses for sockets



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 11 Feb 2003 01:59, Ivo Timmermans wrote:
> e2fsprogs.  It claimed that e2fsprogs had networking support, but not
> IPv6.
>
<snip>
> I downloaded the source to see why such a package would use sockets,
> and it appears that for its UUID generation it tries to find the MAC
> address for ethernet cards:-
>
>         sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
>         if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
>                 if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
>
> Are there any more possible operations on sockets like this?
>
Yup, lots.
You'll find a number of network related ioctl calls require a socket.
Heres a short list, but probably missing a few.
* Firewall code.
* Routing code
* Ethernet related code.

the ioctl_list(2) man page lists a whole heap of them, and all the ones under 
sockios.h require a socket to be passed. As in the case above, you don't even 
need to use the socket.
As for IPv6 compatibility, obviously MAC addresses don't have much to do with 
it, but a quick glance on the ioctl list shows that if code is getting an IP 
socket, the chances are they'll be using it for something that *could* be 
IPv4 dependant. So I think you'll find these false positives rare.

Hope that helps,

Nick

- -- 
Nick 'Zaf' Clifford <zaf@nrc.co.nz> GnuPG: 0x61C6A931
The only "intuitive" interface is the nipple. After that, it's all 
learned.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: public key: http://www.nrc.co.nz/Zaf/pubkey.txt

iD8DBQE+SAm863G2ImHGqTERAkdIAJ4+8sqF42LUPI91NP/NbDfbshINTwCdGqqB
Q+mYx6K2dtyF+fqbzQM2S6Q=
=Wzd7
-----END PGP SIGNATURE-----



Reply to: