getnetent(3) return values for incorrect IPv4 network addresses

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Fri Oct 26 08:34:45 UTC 2012


There is one feature of getnetent(3) that is not documented and is not
checked by applications that use getnetent(3) or similar functions.

If an IPv4 network address is specified incorrectly in the networks(5)
database, then the n_net field from the struct netent{} is set to INADDR_NONE.
This is done by the inet_network(3) function that is used for network address
translation.

Should this property of getnetent(3) be documented in its manual page
to make such behaviour of getnetent(3) official?

Example:

% grep abc /etc/networks
abc             1.
% getent networks abc
abc               255.255.255.255


More information about the freebsd-net mailing list