Re: AF_INET versus PF_INET question

Andi Kleen (
20 Apr 1999 08:17:37 +0200

In article <>,
Tuan Hoang <> writes:
> Hi,
> I can't seem to find info on why there's both a AF_INET and PF_INET.
> Or in general why there are address families and protocol families.
> Can anyone explain why we have both? Which is older/newer?
> Also, as good programming practice, should one be used instead of the
> other or mixed, etc..?

Historical reasons, inherited from BSD.

In practice you can expect them to be exchangeable
(at least near all existing sockets software depends on it, so it is
very unlikely to ever change for IPv4/IPv6)

AF_* is basically to stuff into the sockaddr_* addresses.
PF_* is to specify the protocol family, used for socket(2).

In theory it would be possible to have a protocol family with multiple
address types, or more than one protocol family sharing a single address
type, but I don't know of any.

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to