Skip to content

netmon.cc doesn't compile on FreeBSD - netinet differences #16

Description

@nreilly

Compilation fails on FreeBSD in netmon.cc

[1/2] Compiling C++ object simplomon.p/netmon.cc.o
FAILED: simplomon.p/netmon.cc.o 
ccache c++ -Isimplomon.p -I. -I.. -Isubprojects/cpp-httplib-0.13.1 -I../subprojects/cpp-httplib-0.13.1 -Isubprojects/simplesockets -I../subprojects/simplesockets -I/usr/local/include -I/usr/local/include/lua53 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++20 -O0 -g -pthread -DCPPHTTPLIB_OPENSSL_SUPPORT -DCPPHTTPLIB_ZLIB_SUPPORT -DCPPHTTPLIB_BROTLI_SUPPORT -MD -MQ simplomon.p/netmon.cc.o -MF simplomon.p/netmon.cc.o.d -o simplomon.p/netmon.cc.o -c ../netmon.cc
In file included from ../netmon.cc:6:
In file included from ../simplomon.hh:6:
In file included from ../notifiers.hh:3:
../sol/sol.hpp:14541:32: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
                               ^
../sol/sol.hpp:17294:32: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
                               ^
In file included from ../netmon.cc:10:
/usr/include/netinet/ip_icmp.h:110:14: error: field has incomplete type 'struct ip'
                        struct ip idi_ip;
                                  ^
/usr/include/netinet/ip_icmp.h:110:11: note: forward declaration of 'ip'
                        struct ip idi_ip;
                               ^
../netmon.cc:220:11: error: no member named 'type' in 'icmphdr'
    p.hdr.type = ICMP_ECHO;
    ~~~~~ ^
../netmon.cc:221:11: error: no member named 'un' in 'icmphdr'
    p.hdr.un.echo.id = id;
    ~~~~~ ^
../netmon.cc:222:11: error: no member named 'un' in 'icmphdr'
    p.hdr.un.echo.sequence = seq;
    ~~~~~ ^
../netmon.cc:229:11: error: no member named 'checksum' in 'icmphdr'
    p.hdr.checksum = 0;
    ~~~~~ ^
../netmon.cc:230:11: error: no member named 'checksum' in 'icmphdr'
    p.hdr.checksum = internetchecksum(&p, sizeof(p));
    ~~~~~ ^
../netmon.cc:251:73: error: member access into incomplete type 'struct iphdr'
    struct icmphdr* icmp = (struct icmphdr*) ((char*)packet.c_str() + ip->ihl*4);
                                                                        ^
../netmon.cc:250:12: note: forward declaration of 'iphdr'
    struct iphdr *ip = (iphdr*)packet.c_str();
           ^
../netmon.cc:253:16: error: no member named 'un' in 'icmphdr'
    id = icmp->un.echo.id;
         ~~~~  ^
../netmon.cc:254:17: error: no member named 'un' in 'icmphdr'
    seq = icmp->un.echo.sequence;
          ~~~~  ^
../netmon.cc:256:31: error: member access into incomplete type 'struct iphdr'
    payload = packet.substr(ip->ihl*4 + sizeof(icmp));
                              ^
../netmon.cc:250:12: note: forward declaration of 'iphdr'
    struct iphdr *ip = (iphdr*)packet.c_str();
           ^
2 warnings and 10 errors generated.
ninja: build stopped: subcommand failed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions