sipcapture / captagent

100% Open-Source Packet Capture Agent for HEP
https://sipcapture.org
GNU Affero General Public License v3.0
167 stars 75 forks source link

Centos7 compile error #262

Closed leoapd19 closed 1 year ago

leoapd19 commented 1 year ago

socket_pcap.c:511:81: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]); ^ socket_pcap.c:511:101: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]);

lmangani commented 1 year ago

Hello @leoapd19 please provide full context to your build execution

leoapd19 commented 1 year ago

hi @lmangani

[root@localhost captagent]# make Making all in src make[1]: Entering directory /home/homer/captagent/src' make all-recursive make[2]: Entering directory/home/homer/captagent/src' Making all in . make[3]: Entering directory /home/homer/captagent/src' make[3]: Leaving directory/home/homer/captagent/src' Making all in modules/socket/pcap make[3]: Entering directory /home/homer/captagent/src/modules/socket/pcap' Making all in . make[4]: Entering directory/home/homer/captagent/src/modules/socket/pcap' CC socket_pcap_la-socket_pcap.lo socket_pcap.c: In function 'callback_proto': socket_pcap.c:470:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] if (ntohs((uint16_t)(&ethaddr)) == VLAN) { ^ socket_pcap.c:471:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] if (ntohs((uint16_t)(&mplsaddr)) == MPLS_UNI) { ^ socket_pcap.c:511:81: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]); ^ socket_pcap.c:511:101: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]); ^ socket_pcap.c:511:121: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]); ^ socket_pcap.c:511:141: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]); ^ socket_pcap.c:511:161: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]); ^ socket_pcap.c:511:181: error: dereferencing pointer to incomplete type snprintf(mac_src, sizeof(mac_src), "%.2X-%.2X-%.2X-%.2X-%.2X-%.2X", sll2->sll2_addr[0], sll2->sll2_addr[1], sll2->sll2_addr[2], sll2->sll2_addr[3], sll2->sll2_addr[4], sll2->sll2_addr[5]); ^ socket_pcap.c:514:33: error: dereferencing pointer to incomplete type type_ip = ntohs(sll2->sll2_protocol); ^ socket_pcap.c:312:26: warning: unused variable 'ip6_pkt' [-Wunused-variable] struct ip6_hdr ip6_pkt = NULL; ^ socket_pcap.c: In function 'websocket_pre_decode': socket_pcap.c:1029:13: warning: pointer targets in passing argument 2 of 'websocket_decode' differ in signedness [-Wpointer-sign] websocket_decode((char)decoded, p_websock, skip, mask_key); ^ socket_pcap.c:275:13: note: expected 'const char ' but argument is of type 'uint8_t ' static void websocket_decode(char dst, const char src, size_t len, const char mask[4]) ^ socket_pcap.c:1029:13: warning: pointer targets in passing argument 4 of 'websocket_decode' differ in signedness [-Wpointer-sign] websocket_decode((char)decoded, p_websock, skip, mask_key); ^ socket_pcap.c:275:13: note: expected 'const char ' but argument is of type 'uint8_t ' static void websocket_decode(char dst, const char src, size_t len, const char mask[4]) ^ socket_pcap.c:1040:13: warning: pointer targets in passing argument 2 of 'websocket_decode' differ in signedness [-Wpointer-sign] websocket_decode((char)decoded, p_websock, skip, mask_key); ^ socket_pcap.c:275:13: note: expected 'const char ' but argument is of type 'uint8_t ' static void websocket_decode(char dst, const char src, size_t len, const char mask[4]) ^ socket_pcap.c:1040:13: warning: pointer targets in passing argument 4 of 'websocket_decode' differ in signedness [-Wpointer-sign] websocket_decode((char)decoded, p_websock, skip, mask_key); ^ socket_pcap.c:275:13: note: expected 'const char ' but argument is of type 'uint8_t ' static void websocket_decode(char dst, const char src, size_t len, const char mask[4]) ^ socket_pcap.c: In function 'load_module': socket_pcap.c:1621:9: warning: passing argument 3 of 'pthread_create' from incompatible pointer type [enabled by default] pthread_create(&stat_thread, NULL, stat_collect, i); ^ In file included from socket_pcap.c:42:0: /usr/include/pthread.h:235:12: note: expected 'void ()(void )' but argument is of type 'void ()(void )' extern int pthread_create (pthread_t restrict newthread, ^ socket_pcap.c:1621:9: warning: passing argument 4 of 'pthread_create' makes pointer from integer without a cast [enabled by default] pthread_create(&stat_thread, NULL, stat_collect, i); ^ In file included from socket_pcap.c:42:0: /usr/include/pthread.h:235:12: note: expected 'void restrict' but argument is of type 'unsigned int' extern int pthread_create (pthread_t restrict newthread, ^ socket_pcap.c: At top level: socket_pcap.c:193:12: warning: 'check_port_filter' defined but not used [-Wunused-function] static int check_port_filter(char filter, int port_arg1, int port_arg2) { ^ socket_pcap.c:258:12: warning: 'strip_fcs_end' defined but not used [-Wunused-function] static int strip_fcs_end(unsigned char *data, int len) { ^ make[4]: [socket_pcap_la-socket_pcap.lo] Error 1 make[4]: Leaving directory `/home/homer/captagent/src/modules/socket/pcap' make[3]: [all-recursive] Error 1 make[3]: Leaving directory /home/homer/captagent/src/modules/socket/pcap' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory/home/homer/captagent/src' make[1]: [all] Error 2 make[1]: Leaving directory `/home/homer/captagent/src' make: [all-recursive] Error 1 [root@localhost captagent]#

kYroL01 commented 1 year ago

Hi @leoapd19 seems different OS has different libpcap version. Could you please tell me your libpcap version ? Thank you, I will investigate

btriller commented 1 year ago

Probably < 1.10 [1]

[1] https://centos.pkgs.org/7/centos-x86_64/libpcap-devel-1.5.3-12.el7.x86_64.rpm.html

kYroL01 commented 1 year ago

Please @leoapd19 retest again after the fix we merged. Let me know. Thanks

leoapd19 commented 1 year ago

Thanks , @kYroL01 its working now .

leoapd19 commented 1 year ago

Thanks , @kYroL01 its working now .

kYroL01 commented 1 year ago

Thank you as well @btriller for reporting it. Don't forget to star this project if you like it :)