kismetwireless / kismet

Github mirror of official Kismet repository
Other
1.62k stars 307 forks source link

`make suidinstall` fails on Alpine Linux #538

Closed gresskar closed 1 week ago

gresskar commented 1 month ago

System information

OS Name: Alpine Linux edge OS Version: 3.21.0_alpha20240923 Kernel: Linux host 6.6.52-0-lts # 1-Alpine SMP PREEMPT_DYNAMIC 2024-09-19 07:41:43 x86_64 Linux CPU: 12th Gen Intel(R) Core(TM) i5-1235U Clang version 18.1.8

Error information

Compilation went fine, but when running doas make suidinstall I got the errors:

capture_antsdr_droneid.c:256:25: error: call to undeclared function 'gethostbyname'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  256 |     if ((connect_host = gethostbyname(localdrone->host)) == NULL) {
      |                         ^
capture_antsdr_droneid.c:256:25: note: did you mean 'gethostname'?
/usr/include/unistd.h:124:5: note: 'gethostname' declared here
  124 | int gethostname(char *, size_t);
      |     ^
capture_antsdr_droneid.c:256:23: error: incompatible integer to pointer conversion assigning to 'struct hostent *' from 'int' [-Wint-conversion]
  256 |     if ((connect_host = gethostbyname(localdrone->host)) == NULL) {
      |                       ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
capture_antsdr_droneid.c:263:42: error: incomplete definition of type 'struct hostent'
  263 |     client_sock.sin_family = connect_host->h_addrtype;
      |                              ~~~~~~~~~~~~^
capture_antsdr_droneid.c:185:12: note: forward declaration of 'struct hostent'
  185 |     struct hostent *connect_host;
      |            ^
capture_antsdr_droneid.c:264:65: error: incomplete definition of type 'struct hostent'
  264 |     memcpy((char *) &(client_sock.sin_addr.s_addr), connect_host->h_addr_list[0],
      |                                                     ~~~~~~~~~~~~^
capture_antsdr_droneid.c:185:12: note: forward declaration of 'struct hostent'
  185 |     struct hostent *connect_host;
      |            ^
capture_antsdr_droneid.c:265:25: error: incomplete definition of type 'struct hostent'
  265 |             connect_host->h_length);
      |             ~~~~~~~~~~~~^
capture_antsdr_droneid.c:185:12: note: forward declaration of 'struct hostent'
  185 |     struct hostent *connect_host;
      |            ^
5 errors generated.
make[2]: *** [Makefile:19: capture_antsdr_droneid.c.o] Error 1
make[2]: Leaving directory '/home/user/.build/kismet/capture_antsdr_droneid'
make[1]: *** [Makefile:433: capture_antsdr_droneid/kismet_cap_antsdr_droneid] Error 2
make[1]: Leaving directory '/home/user/.build/kismet'
make: *** [Makefile:680: suidinstall] Error 2

How to fix

Simply append #include <netdb.h> to the capture_antsdr_droneid/capture_antsdr_droneid.c file

gresskar commented 1 month ago

The same thing happens on Arch Linux as well