Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdk4 build is failing on Fedora 40 due "channelhopper.c:48:26: error: initialization of ‘pthread_t’ {aka ‘long unsigned int’} and more..." #118

Open
0n1cOn3 opened this issue May 22, 2024 · 3 comments

Comments

@0n1cOn3
Copy link

0n1cOn3 commented May 22, 2024

Expected Behavior

Compiling mdk4 successful

Actual Behavior

make[1]: Leaving directory '/home/hx/Github/mdk4/src'
make: *** [Makefile:11: all] Error 2

Steps to Reproduce the Problem

  • OS: Fedora 40

    1. git clone mdk4
    2. Installing all deps if required
    3. make -j4

Specifications

  • Version: aircrack-ng-mdk4/Master-branch
  • Platform: Linux, Fedora 40
  • Subsystem: No Subsystem available

Terminal Output

make -C src clean
make[1]: Entering directory '/home/hx/Github/mdk4/src'
rm -f mdk4
rm -f debug.o helpers.o mac_addr.o linkedlist.o greylist.o dumpfile.o packet.o brute.o osdep.o channelhopper.o ghosting.o fragmenting.o
rm -f ../test *.o
make -C osdep clean
make[2]: Entering directory '/home/hx/Github/mdk4/src/osdep'
make -C radiotap clean
make[3]: Entering directory '/home/hx/Github/mdk4/src/osdep/radiotap'
rm -f *.o
make[3]: Leaving directory '/home/hx/Github/mdk4/src/osdep/radiotap'
rm -f libosdep.a  *.o .os.*
make[2]: Leaving directory '/home/hx/Github/mdk4/src/osdep'
make -C attacks clean
make[2]: Entering directory '/home/hx/Github/mdk4/src/attacks'
rm -f attacks.o auth_dos.o beacon_flood.o countermeasures.o deauth.o dummy.o eapol.o fuzzer.o ieee80211s.o poc.o probing.o wids.o *.o
make[2]: Leaving directory '/home/hx/Github/mdk4/src/attacks'
make[1]: Leaving directory '/home/hx/Github/mdk4/src'
make -C src
make[1]: Entering directory '/home/hx/Github/mdk4/src'
make -C osdep
make[2]: Entering directory '/home/hx/Github/mdk4/src/osdep'
Building for Linux
make[3]: Entering directory '/home/hx/Github/mdk4/src/osdep'
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fPIC -I..    -c -o osdep.o osdep.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fPIC -I..    -c -o network.o network.c
network.c: In function ‘net_send’:
network.c:61:39: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
   61 |         pktbuf = (char*)calloc(sizeof(char), pktlen);
      |                                       ^~~~
network.c:61:39: note: earlier argument should specify number of elements, later size of each element
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fPIC -I..    -c -o file.o file.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fPIC -I..    -c -o linux.o linux.c
linux.c: In function ‘is_ndiswrapper’:
linux.c:183:17: warning: variable ‘unused’ set but not used [-Wunused-but-set-variable]
  183 |     int n, pid, unused;
      |                 ^~~~~~
linux.c: In function ‘linux_set_rate’:
linux.c:457:22: warning: variable ‘unused’ set but not used [-Wunused-but-set-variable]
  457 |     int pid, status, unused;
      |                      ^~~~~~
linux.c: In function ‘linux_set_channel_nl80211’:
linux.c:950:22: warning: variable ‘unused’ set but not used [-Wunused-but-set-variable]
  950 |     int pid, status, unused;
      |                      ^~~~~~
linux.c: In function ‘linux_set_channel’:
linux.c:1052:22: warning: variable ‘unused’ set but not used [-Wunused-but-set-variable]
 1052 |     int pid, status, unused;
      |                      ^~~~~~
linux.c: In function ‘linux_set_freq’:
linux.c:1143:22: warning: variable ‘unused’ set but not used [-Wunused-but-set-variable]
 1143 |     int pid, status, unused;
      |                      ^~~~~~
linux.c: In function ‘set_monitor’:
linux.c:1273:22: warning: variable ‘unused’ set but not used [-Wunused-but-set-variable]
 1273 |     int pid, status, unused;
      |                      ^~~~~~
linux.c: In function ‘openraw’:
linux.c:1513:63: warning: comparison of constant ‘6’ with boolean expression is always false [-Wbool-compare]
 1513 |         if (set_monitor( dev, iface, fd ) && !dev->drivertype == DT_ORINOCO )
      |                                                               ^~
linux.c:1513:63: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
linux.c:1513:46: note: add parentheses around left hand side expression to silence this warning
 1513 |         if (set_monitor( dev, iface, fd ) && !dev->drivertype == DT_ORINOCO )
      |                                              ^~~~~~~~~~~~~~~~
      |                                              (               )
linux.c:1523:67: warning: comparison of constant ‘6’ with boolean expression is always false [-Wbool-compare]
 1523 |             if (set_monitor( dev, iface, fd ) && !dev->drivertype == DT_ORINOCO )
      |                                                                   ^~
linux.c:1523:67: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
linux.c:1523:50: note: add parentheses around left hand side expression to silence this warning
 1523 |             if (set_monitor( dev, iface, fd ) && !dev->drivertype == DT_ORINOCO )
      |                                                  ^~~~~~~~~~~~~~~~
      |                                                  (               )
linux.c: In function ‘do_linux_open’:
linux.c:1620:12: warning: variable ‘unused_str’ set but not used [-Wunused-but-set-variable]
 1620 |     char * unused_str;
      |            ^~~~~~~~~~
linux.c:1606:15: warning: variable ‘unused’ set but not used [-Wunused-but-set-variable]
 1606 |     int kver, unused;
      |               ^~~~~~
linux.c: In function ‘get_battery_state’:
linux.c:2273:35: warning: variable ‘current’ set but not used [-Wunused-but-set-variable]
 2273 |         int rate = 1, remain = 0, current = 0;
      |                                   ^~~~~~~
linux.c: At top level:
linux.c:2057:13: warning: ‘linux_close’ defined but not used [-Wunused-function]
 2057 | static void linux_close(struct wif *wi)
      |             ^~~~~~~~~~~
linux.c:946:12: warning: ‘linux_set_channel_nl80211’ defined but not used [-Wunused-function]
  946 | static int linux_set_channel_nl80211(struct wif *wi, int channel)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~
linux.c:314:12: warning: ‘linux_nl80211_init’ defined but not used [-Wunused-function]
  314 | static int linux_nl80211_init(struct nl80211_state *state)
      |            ^~~~~~~~~~~~~~~~~~
linux.c: In function ‘do_linux_open.constprop’:
linux.c:1906:9: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
 1906 |         strncpy(dev->main_if, iface, strlen(iface));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux.c:1906:9: note: length computed here
 1906 |         strncpy(dev->main_if, iface, strlen(iface));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux.c:1911:9: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-truncation]
 1911 |         strncpy(iface, buf, strlen(buf));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux.c:1911:9: note: length computed here
 1911 |         strncpy(iface, buf, strlen(buf));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux.c:1937:37: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 113 [-Wformat-truncation=]
 1937 |                     "/sys/class/net/%s/device/rtap_iface", this_iface->d_name);
      |                                     ^~
linux.c:1936:17: note: ‘snprintf’ output between 34 and 289 bytes into a destination of size 128
 1936 |                 snprintf(r_file, sizeof(r_file),
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1937 |                     "/sys/class/net/%s/device/rtap_iface", this_iface->d_name);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux.c: In function ‘get_battery_state’:
linux.c:2310:13: warning: argument 1 null where non-null expected [-Wnonnull]
 2310 |             closedir(batteries);
      |             ^~~~~~~~~~~~~~~~~~~
In file included from linux.c:40:
/usr/include/dirent.h:134:12: note: in a call to function ‘closedir’ declared ‘nonnull’
  134 | extern int closedir (DIR *__dirp) __nonnull ((1));
      |            ^~~~~~~~
linux.c:2318:78: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 109 [-Wformat-truncation=]
 2318 |             snprintf(battery_info, sizeof(battery_info), "/proc/acpi/battery/%s/info", this_battery->d_name);
      |                                                                              ^~
linux.c:2318:13: note: ‘snprintf’ output between 25 and 280 bytes into a destination of size 128
 2318 |             snprintf(battery_info, sizeof(battery_info), "/proc/acpi/battery/%s/info", this_battery->d_name);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux.c:2330:37: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 109 [-Wformat-truncation=]
 2330 |                 "/proc/acpi/battery/%s/state", this_battery->d_name);
      |                                     ^~
linux.c:2329:13: note: ‘snprintf’ output between 26 and 281 bytes into a destination of size 128
 2329 |             snprintf(battery_state, sizeof(battery_state),
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2330 |                 "/proc/acpi/battery/%s/state", this_battery->d_name);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
linux.c:2289:40: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 106 [-Wformat-truncation=]
 2289 |                 "/proc/acpi/ac_adapter/%s/state", this_adapter->d_name);
      |                                        ^~
linux.c:2288:13: note: ‘snprintf’ output between 29 and 284 bytes into a destination of size 128
 2288 |             snprintf(battery_state, sizeof(battery_state),
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2289 |                 "/proc/acpi/ac_adapter/%s/state", this_adapter->d_name);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fPIC -I..    -c -o linux_tap.o linux_tap.c
In function ‘ti_do_open_linux’,
    inlined from ‘ti_open_linux’ at linux_tap.c:192:7,
    inlined from ‘ti_open’ at linux_tap.c:207:9:
linux_tap.c:72:5: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 63 [-Wstringop-truncation]
   72 |     strncpy(priv->tl_ifr.ifr_name, priv->tl_name,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |             sizeof(priv->tl_ifr.ifr_name) - 1);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fPIC -I..    -c -o radiotap/radiotap.o radiotap/radiotap.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3 -fPIC -I..    -c -o common.o common.c
ar cru libosdep.a  osdep.o network.o file.o linux.o linux_tap.o radiotap/radiotap.o common.o
ranlib libosdep.a 
touch .os.Linux
make[3]: Leaving directory '/home/hx/Github/mdk4/src/osdep'
make[2]: Leaving directory '/home/hx/Github/mdk4/src/osdep'
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o debug.o debug.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o helpers.o helpers.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o mac_addr.o mac_addr.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o linkedlist.o linkedlist.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o greylist.o greylist.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o dumpfile.o dumpfile.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o packet.o packet.c
packet.c: In function ‘create_ieee_hdr’:
packet.c:13:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   13 |   if (!fragment) seqno++; seqno %= 0x1000;
      |   ^~
packet.c:13:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   13 |   if (!fragment) seqno++; seqno %= 0x1000;
      |                           ^~~~~
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o brute.o brute.c
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o osdep.o osdep.c
osdep.c: In function ‘osdep_init_txpowers’:
osdep.c:165:36: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
  165 |       printf("D'oh, open interface %s first, idiot...\n", osdep_iface_out);
      |                                    ^~
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=mdk4-v2 -DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3   -c -o channelhopper.o channelhopper.c
channelhopper.c:48:26: error: initialization of ‘pthread_t’ {aka ‘long unsigned int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
   48 | pthread_t chan_sniffer = NULL;
      |                          ^~~~
channelhopper.c: In function ‘error_handler’:
channelhopper.c:155:46: warning: unused parameter ‘nla’ [-Wunused-parameter]
  155 | static int error_handler(struct sockaddr_nl *nla, struct nlmsgerr *err,
      |                          ~~~~~~~~~~~~~~~~~~~~^~~
channelhopper.c: In function ‘finish_handler’:
channelhopper.c:163:42: warning: unused parameter ‘msg’ [-Wunused-parameter]
  163 | static int finish_handler(struct nl_msg *msg, void *arg)
      |                           ~~~~~~~~~~~~~~~^~~
channelhopper.c: In function ‘ack_handler’:
channelhopper.c:170:39: warning: unused parameter ‘msg’ [-Wunused-parameter]
  170 | static int ack_handler(struct nl_msg *msg, void *arg)
      |                        ~~~~~~~~~~~~~~~^~~
channelhopper.c: In function ‘valid_handler’:
channelhopper.c:186:45: warning: unused parameter ‘arg’ [-Wunused-parameter]
  186 | int valid_handler(struct nl_msg *msg, void *arg)
      |                                       ~~~~~~^~~
channelhopper.c: In function ‘handle_channels’:
channelhopper.c:328:50: warning: unused parameter ‘state’ [-Wunused-parameter]
  328 | static int handle_channels(struct nl80211_state *state, struct nl_msg *msg)
      |                            ~~~~~~~~~~~~~~~~~~~~~~^~~~~
channelhopper.c: At top level:
channelhopper.c:240:14: warning: ‘dfs_state_name’ defined but not used [-Wunused-function]
  240 | static char *dfs_state_name(enum nl80211_dfs_state state)
      |              ^~~~~~~~~~~~~~
make[1]: *** [<builtin>: channelhopper.o] Error 1
make[1]: Leaving directory '/home/hx/Github/mdk4/src'
make: *** [Makefile:11: all] Error 2

@Tauriccc
Copy link

Tauriccc commented Jun 11, 2024

I have the same issue on Fedora 40

tried:
pthread_t chan_sniffer = 0;

but this yields more errors

poc.c:156:30: error: implicit declaration of function ‘get_file_lines’ [-Wimplicit-function-declaration] 156 | file_lines = get_file_lines(file_name); | ^~~~~~~~~~~~~~ poc.c:168:38: warning: pointer targets in passing argument 1 of ‘fgets’ differ in signedness [-Wpointer-sign] 168 | if(fgets(buf, sizeof(buf), fp1)) | ^~~ | | | unsigned char * In file included from poc.c:1: /usr/include/stdio.h:654:38: note: expected ‘char * restrict’ but argument is of type ‘unsigned char *’ 654 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) | ~~~~~~~~~~~~~~~~~^~~ poc.c:173:59: error: implicit declaration of function ‘str_to_hex’ [-Wimplicit-function-declaration] 173 | poc_pkts[i].pkts[j].len = str_to_hex(buf, poc_pkts[i].pkts[j].data, sizeof(poc_pkts[i].pkts[j].data)); | ^~~~~~~~~~ poc.c: In function ‘get_target’: poc.c:207:14: warning: unused variable ‘recv_seq_ctrl’ [-Wunused-variable] 207 | uint16_t recv_seq_ctrl; | ^~~~~~~~~~~~~ poc.c: In function ‘get_file_lines’: poc.c:489:8: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 489 | if(fp = fopen(filename, "r")) | ^~ poc.c:494:22: warning: pointer targets in passing argument 1 of ‘fgets’ differ in signedness [-Wpointer-sign] 494 | if(fgets(buf, sizeof(buf), fp)) | ^~~ | | | unsigned char * /usr/include/stdio.h:654:38: note: expected ‘char * restrict’ but argument is of type ‘unsigned char *’ 654 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream) | ~~~~~~~~~~~~~~~~~^~~ poc.c: In function ‘str_to_hex’: poc.c:516:17: error: ‘return’ with no value, in function returning non-void [-Wreturn-mismatch] 516 | return; | ^~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@0n1cOn3 @Tauriccc and others