NICMx / Jool

SIIT and NAT64 for Linux
GNU General Public License v2.0
328 stars 66 forks source link

Graybox kernel module not compiling with kernel 4.4.0 #200

Closed crisdeleon closed 8 years ago

crisdeleon commented 8 years ago

The graybox module is not compiling on kernel 4.4.0, even when using this codebase.

Stacktrace:

make -C /lib/modules/4.4.0-040400-generic/build M=$PWD;
make[1]: Entering directory `/usr/src/linux-headers-4.4.0-040400-generic'
  CC [M]  /home/jool/git/Jool/test/graybox/mod/nf_hook.o
/home/jool/git/Jool/test/graybox/mod/nf_hook.c:43:3: warning: initialization from incompatible pointer type
   .hook = hook_ipv6,
   ^
/home/jool/git/Jool/test/graybox/mod/nf_hook.c:43:3: warning: (near initialization for ‘nfho[0].hook’)
/home/jool/git/Jool/test/graybox/mod/nf_hook.c:48:3: warning: initialization from incompatible pointer type
   .hook = hook_ipv4,
   ^
/home/jool/git/Jool/test/graybox/mod/nf_hook.c:48:3: warning: (near initialization for ‘nfho[1].hook’)
/home/jool/git/Jool/test/graybox/mod/nf_hook.c: In function ‘graybox_init’:
/home/jool/git/Jool/test/graybox/mod/nf_hook.c:80:10: error: ‘struct nf_hook_ops’ has no member named ‘owner’
   nfho[i].owner = NULL;
          ^
make[2]: *** [/home/jool/git/Jool/test/graybox/mod/nf_hook.o] Error 1
make[1]: *** [_module_/home/jool/git/Jool/test/graybox/mod] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-4.4.0-040400-generic'
make: *** [all] Error 2
ydahhrk commented 8 years ago

This should have been fixed in commit ce15a9667c4108e41a3f76c642153b490660b6d2.

crisdeleon commented 8 years ago

Graybox Kernel module compiles correctly.

However Graybox Userspace application doesn't (this happens with Ubuntu kernels 3.10 throughout 4.4.1). It does create a bunch of *.o files, but not the graybox executable needed to run the tests.

Here's the stacktrace; note that if you try to run make again, the stacktrace will be a lot shorter (since it is not trying to create all the *.o files). However if you run make clean then make again, it will show the full stacktrace.

jool@jool:~/git/Jool/test/graybox/usr$ make
gcc -Wall -g -I/usr/include/libnl3 -I../include -c -o device.o device.c
device.c:8:39: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_add_response(struct nl_core_buffer *buffer, void *arg)
                                       ^
device.c:8:39: warning: its scope is only this definition or declaration, which is probably not what you want
device.c: In function ‘dev_add’:
device.c:30:4: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
    handle_add_response, NULL);
    ^
In file included from device.c:3:0:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
device.c: At top level:
device.c:33:42: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_remove_response(struct nl_core_buffer *buffer, void *arg)
                                          ^
device.c: In function ‘dev_remove’:
device.c:55:4: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
    handle_remove_response, NULL);
    ^
In file included from device.c:3:0:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
device.c: At top level:
device.c:58:43: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_display_response(struct nl_core_buffer *buffer, void *arg)
                                           ^
device.c: In function ‘dev_display’:
device.c:71:48: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
  return netlink_request(&request, request.len, handle_display_response, NULL);
                                                ^
In file included from device.c:3:0:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
device.c: At top level:
device.c:74:41: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_flush_response(struct nl_core_buffer *buffer, void *arg)
                                         ^
device.c: In function ‘dev_flush’:
device.c:87:48: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
  return netlink_request(&request, request.len, handle_flush_response, NULL);
                                                ^
In file included from device.c:3:0:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
gcc -Wall -g -I/usr/include/libnl3 -I../include -c -o communication.o communication.c
communication.c:9:44: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_send_pkt_response(struct nl_core_buffer *buffer, void *arg)
                                            ^
communication.c:9:44: warning: its scope is only this definition or declaration, which is probably not what you want
communication.c: In function ‘send_packet’:
communication.c:38:4: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
    handle_send_pkt_response, NULL);
    ^
In file included from communication.h:5:0,
                 from communication.c:1:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
communication.c: At top level:
communication.c:42:44: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_flush_op_response(struct nl_core_buffer *buffer, void *arg)
                                            ^
communication.c: In function ‘send_flush_op’:
communication.c:58:43: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
  return netlink_request(request, HDR_LEN, handle_flush_op_response, NULL);
                                           ^
In file included from communication.h:5:0,
                 from communication.c:1:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
communication.c: At top level:
communication.c:61:42: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_update_response(struct nl_core_buffer *buffer, void *arg)
                                          ^
communication.c: In function ‘global_update’:
communication.c:82:46: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
  return netlink_request(hdr, HDR_LEN + size, handle_update_response, NULL);
                                              ^
In file included from communication.h:5:0,
                 from communication.c:1:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
communication.c: At top level:
communication.c:85:43: warning: ‘struct nl_core_buffer’ declared inside parameter list
 static int handle_display_response(struct nl_core_buffer *buffer, void *arg)
                                           ^
communication.c: In function ‘general_display_array’:
communication.c:99:48: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
  return netlink_request(&request, request.len, handle_display_response, NULL);
                                                ^
In file included from communication.h:5:0,
                 from communication.c:1:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
communication.c: In function ‘receiver_display’:
communication.c:110:48: warning: passing argument 3 of ‘netlink_request’ from incompatible pointer type
  return netlink_request(&request, request.len, handle_display_response, NULL);
                                                ^
In file included from communication.h:5:0,
                 from communication.c:1:
netlink.h:14:5: note: expected ‘int (*)(struct nl_msg *, void *)’ but argument is of type ‘int (*)(struct nl_core_buffer *, void *)’
 int netlink_request(void *request, __u16 request_len,
     ^
gcc -Wall -g -I/usr/include/libnl3 -I../include -c -o graybox.o graybox.c
gcc -Wall -g -I/usr/include/libnl3 -I../include -c -o netlink.o netlink.c
In file included from netlink.c:3:0:
netlink.c: In function ‘error_handler’:
netlink.c:7:54: error: invalid type argument of ‘->’ (have ‘struct nlmsghdr’)
  log_err("this is the message length: %d", nlerr->msg->nlmsg_len) ;
                                                      ^
../include/types.h:23:57: note: in definition of macro ‘log_error’
  #define log_error(func, text, ...) printf(text "\n", ##__VA_ARGS__)
                                                         ^
netlink.c:7:2: note: in expansion of macro ‘log_err’
  log_err("this is the message length: %d", nlerr->msg->nlmsg_len) ;
  ^
make: *** [netlink.o] Error 1
crisdeleon commented 8 years ago

Ok so it's been a while since this issue has been addressed.

I've successfully compiled both graybox kernel module and userspace application with kernels 3.10, 3.13, 4.3, 4.4, and more importantly I've also tested graybox works with 4.5.

The graybox tests also run properly. I'm not sure exactly which commit fixed this, but it has been fixed.

I'm adding the Tested (needs release) tag.

ydahhrk commented 8 years ago

Thanks!

ydahhrk commented 8 years ago

The tests were refactored in the 3.5 branch; switching milestone.