1

Those files are databases which contain IP protocol number, alias and service mappings. As a user I don't usually interact with those in any direct way, but the need to create special Linux/GNU distribution arose and I have noted that perl test-suite fails due to inability to fetch required numbers from the /etc/protocols database because it doesn't exists in my custom system.

For example from my desktop distro of choice(SMP Debian 4.17.17-1 (2018-08-18) x86_64 GNU/Linux):

/etc/protocols claims to be created from IANA list.

# Internet (IP) protocols
#
# Updated from http://www.iana.org/assignments/protocol-numbers and other
# sources.
# New protocols will be added on request if they have been officially
# assigned by IANA and are not historical.
# If you need a huge list of used numbers please install the nmap package.

The same goes for /etc/services.

# Network services, Internet style
#
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, officially ports have two entries
# even if the protocol doesn't support UDP operations.
#
# Updated from http://www.iana.org/assignments/port-numbers and other
# sources like http://www.freebsd.org/cgi/cvsweb.cgi/src/etc/services .
# New ports will be added on request if they have been officially assigned
# by IANA and used in the real-world or are needed by a debian package.
# If you need a huge list of used numbers please install the nmap package.

Indeed, the data they provide looks to be from indicated sources(but not at full extent, those databases seem to be partial). That specificity made me completely confused.

There are posix function calls to access them - getprotoent(3) which are described by IEEE Std 1003.1-2008 as follows:

endprotoent, getprotobyname, getprotobynumber, getprotoent, setprotoent - network protocol database functions

These functions shall retrieve information about protocols. This information is considered to be stored in a database that can be accessed sequentially or randomly. The implementation of this database is unspecified.

Format is relatively simple, and it would be nice to provide those files, but I don't want to fill databases manually or copy others work without proper understanding: is there any sort of central source for those? Who is responsible for filling the database?

  • Library which exposes getprotoent(3) calls and therefore defines format(like, glibc)?
  • Is there a standard content image of those specified in current POSIX spec?
  • Distro maintainers to which it belongs?
  • Or someone/something else entirely?
1

Since you’re creating your own distribution, the responsibility for the contents of the /etc/protocols and /etc/services files you install rests with you.

The authority controlling the assignments of protocol and service numbers is the IANA, as documented in the file headers you quote; the corresponding lists are available on their web site, for protocol numbers and service names and port numbers. However, distribution maintainers commonly add entries which are used but haven’t been submitted to the IANA, or haven’t been approved, and remove entries which they consider to be obsolete. For Debian, the source of both files is in the netbase repository.

POSIX defines functions which can be used to retrieve protocol and service information, but it doesn’t specify how that data is stored or retrieved, as indicated in your quote:

The implementation of this database is unspecified.

The information contained in the database is also unspecified; POSIX only imposes requirements on the schema, effectively.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.