Kacheong Poon writes:
> To me, those sockaddr_* structs are used to store socket
> address.  Generalizing them to be used to store things like
> single IP address seems not to be appropriate.

That ship sailed a long time ago.  'struct sockaddr' is used to store
individual IP addresses in routing socket RTA_* entries, the BSD
standard SIOC[GS]IF* ioctls using ifreq, the Sun proprietary
SIOC[SG]LIF* ioctls using lifreq, the BSD ifaddrlist interfaces, the
ARP ioctls using arpreq, and, well, a bunch of other places, including
entirely user-space pieces, such as the getaddrinfo(3SOCKET) family.

I see no general problem in using sockaddr (and ignoring sin_port) for
storing IP addresses alone.

These structures also have the distinct benefit of being self-
identifying by way of sa_family.

Though, yes, they're a little bulky, and you might be able to get away
with a union including just the sockaddr_* types you need.

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to