Skip to content

tcpdump uses stub getservent() from musl libc #1298

Open
@infrastation

Description

@infrastation

musl libc in src/network/serv.c "implements" the function as follows:

struct servent *getservent(void)
{
        return 0;
}

This disables the TCP and UDP port number to name translation:

# GNU libc

$ ./tcpdump -nq -r tests/tcp_rst_data.pcap
reading from file tests/tcp_rst_data.pcap, link-type EN10MB (Ethernet), snapshot length 65535
22:03:19.190965 IP 199.204.31.89.80 > 172.16.133.41.52875: tcp 58

$ ./tcpdump -q -r tests/tcp_rst_data.pcap
reading from file tests/tcp_rst_data.pcap, link-type EN10MB (Ethernet), snapshot length 65535
22:03:19.190965 IP 199.204.31.89.http > 172.16.133.41.52875: tcp 58

# musl libc

$ ./tcpdump -nq -r tests/tcp_rst_data.pcap 
reading from file tests/tcp_rst_data.pcap, link-type EN10MB (Ethernet), snapshot length 65535
22:03:19.190965 IP 199.204.31.89.80 > 172.16.133.41.52875: tcp 58

$ ./tcpdump -q -r tests/tcp_rst_data.pcap 
reading from file tests/tcp_rst_data.pcap, link-type EN10MB (Ethernet), snapshot length 65535
22:03:19.190965 IP 199.204.31.89.80 > 172.16.133.41.52875: tcp 58

A possible solution could be forcing the substitute function from missing/getservent.c similarly to the-tcpdump-group/libpcap#1462.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions