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?