traviscross / mtr

Official repository for mtr, a network diagnostic tool
http://www.bitwizard.nl/mtr/
GNU General Public License v2.0
2.64k stars 337 forks source link

probe_cygwin.c cygwin 32 cygport build fails as missing types with suffix 32 #305

Open BrianInglis opened 5 years ago

BrianInglis commented 5 years ago

Issues only with Cygwin 32 cygport build - Cygwin 64 builds, tests, and runs nicely. Missing types ICMP_ECHO_REPLY32 and IP_OPTION_INFORMATION32 found in w32api/ipexport.h:

/usr/include/w32api/ipexport.h:} IP_OPTION_INFORMATION,*PIP_OPTION_INFORMATION;
/usr/include/w32api/ipexport.h:} IP_OPTION_INFORMATION32,*PIP_OPTION_INFORMATION32;
/usr/include/w32api/ipexport.h:} ICMP_ECHO_REPLY,*PICMP_ECHO_REPLY;
/usr/include/w32api/ipexport.h:} ICMP_ECHO_REPLY32,*PICMP_ECHO_REPLY32;

Should probe_cygwin.c be including that file under Cygwin 32, perhaps with guards, or other?

Cygwin 32 cygport build error log:

In file included from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe.h:32:0,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe.c:19:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.h:63:9: error: unknown type name ‘ICMP_ECHO_REPLY32’
         ICMP_ECHO_REPLY32 *reply4;
         ^~~~~~~~~~~~~~~~~
In file included from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe.h:32:0,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:19:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.h:63:9: error: unknown type name ‘ICMP_ECHO_REPLY32’
         ICMP_ECHO_REPLY32 *reply4;
         ^~~~~~~~~~~~~~~~~
In file included from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe.h:32:0,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command.h:23,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/wait.h:22,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/packet.c:31:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.h:63:9: error: unknown type name ‘ICMP_ECHO_REPLY32’
         ICMP_ECHO_REPLY32 *reply4;
         ^~~~~~~~~~~~~~~~~
In file included from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe.h:32:0,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command.h:23,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command_cygwin.c:19:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.h:63:9: error: unknown type name ‘ICMP_ECHO_REPLY32’
         ICMP_ECHO_REPLY32 *reply4;
         ^~~~~~~~~~~~~~~~~
In file included from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe.h:32:0,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command.h:23,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command.c:19:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.h:63:9: error: unknown type name ‘ICMP_ECHO_REPLY32’
         ICMP_ECHO_REPLY32 *reply4;
         ^~~~~~~~~~~~~~~~~
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command_cygwin.c: In function ‘finish_read_command’:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command_cygwin.c:51:57: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘DWORD {aka long unsigned int}’ [-Wformat=]
         fprintf(stderr, "ReadFileEx completion failure %d\n", status);
                                                        ~^
                                                        %ld
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command_cygwin.c: In function ‘queue_empty_apc’:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command_cygwin.c:81:59: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘DWORD {aka long unsigned int}’ [-Wformat=]
         fprintf(stderr, "Unexpected QueueUserAPC failure %d\n",
                                                          ~^
                                                          %ld
                 GetLastError());
                 ~~~~~~~~~~~~~~
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command_cygwin.c: In function ‘start_read_command’:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/command_cygwin.c:119:61: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘DWORD {aka long unsigned int}’ [-Wformat=]
             fprintf(stderr, "Unexpected ReadFileEx failure %d\n",
                                                            ~^
                                                            %ld
                     GetLastError());
                     ~~~~~~~~~~~~~~
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c: In function ‘init_net_state’:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:44:48: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘DWORD {aka long unsigned int}’ [-Wformat=]
         fprintf(stderr, "Failure opening ICMP %d\n", GetLastError());
                                               ~^     ~~~~~~~~~~~~~~
                                               %ld
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c: In function ‘on_icmp_reply’:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:142:5: error: unknown type name ‘ICMP_ECHO_REPLY32’; did you mean ‘ICMP_ECHO_REPLY’?
     ICMP_ECHO_REPLY32 *reply4;
     ^~~~~~~~~~~~~~~~~
     ICMP_ECHO_REPLY
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:168:34: error: request for member ‘Status’ in something not a structure or union
             reply_status = reply4->Status;
                                  ^~
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:171:35: error: request for member ‘RoundTripTime’ in something not a structure or union
             round_trip_us = reply4->RoundTripTime * 1000;
                                   ^~
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:176:51: error: request for member ‘Address’ in something not a structure or union
             remote_addr4->sin_addr.s_addr = reply4->Address;
                                                   ^~
In file included from /usr/include/string.h:180:0,
                 from /usr/include/w32api/guiddef.h:148,
                 from /usr/include/w32api/winnt.h:628,
                 from /usr/include/w32api/minwindef.h:163,
                 from /usr/include/w32api/windef.h:8,
                 from /usr/include/w32api/windows.h:69,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.h:23,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe.h:32,
                 from /mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:19:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c: In function ‘icmp_send_probe’:
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:233:31: error: ‘IP_OPTION_INFORMATION32’ undeclared (first use in this function); did you mean ‘IP_OPTION_INFORMATION’?
     memset(&option, 0, sizeof(IP_OPTION_INFORMATION32));
                               ^
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:233:31: note: each undeclared identifier is reported only once for each function it appears in
/mnt/c/Users/bwi/src/cygwin/mtr/mtr-0.92-1.i686/src/mtr/packet/probe_cygwin.c:239:29: error: ‘ICMP_ECHO_REPLY32’ undeclared (first use in this function); did you mean ‘ICMP_ECHO_REPLY’?
         reply_size = sizeof(ICMP_ECHO_REPLY32) + payload_size;
                             ^~~~~~~~~~~~~~~~~
                             ICMP_ECHO_REPLY
make[1]: *** [Makefile:876: packet/packet.o] Error 1
...
BrianInglis commented 5 years ago

problem seems to be checking out release tag v0.92 sources for probe_config.[hc] still use ICMP_ECHO_REPLY32 and IP_OPTION_INFORMATION32, whereas on master branch the 32 suffixes have been removed.