Douane / douane-dkms

Kernel module used by Douane firewall
23 stars 15 forks source link

Compilation error Ubuntu 16.04.2 #24

Closed Kwaadpepper closed 6 years ago

Kwaadpepper commented 7 years ago

I failed to install this :

sudo make dkms
Installing Douane Linux kernel module version 0.8.2...

Creating symlink /var/lib/dkms/douane/0.8.2/source ->
                 /usr/src/douane-0.8.2

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=4.11.0-041100rc6-generic -C /lib/modules/4.11.0-041100rc6-generic/build M=/var/lib/dkms/douane/0.8.2/build....(bad exit status: 2)
ERROR (dkms apport): binary package for douane: 0.8.2 not found
Error! Bad return status for module build on kernel: 4.11.0-041100rc6-generic (x86_64)
Consult /var/lib/dkms/douane/0.8.2/build/make.log for more information.
Makefile:77 : la recette pour la cible « dkms » a échouée
make: *** [dkms] Erreur 10

sudo make KERNELRELEASE=4.11.0-041100rc6-generic -C /lib/modules/4.11.0-041100rc6-generic/build M=/var/lib/dkms/douane/0.8.2/build    
make : on entre dans le répertoire « /usr/src/linux-headers-4.11.0-041100rc6-generic »    
  CC [M]  /var/lib/dkms/douane/0.8.2/build/douane.o    
/var/lib/dkms/douane/0.8.2/build/douane.c: In function ‘task_exe_path’:    
/var/lib/dkms/douane/0.8.2/build/douane.c:713:5: error: implicit declaration of function ‘task_lock’ [-Werror=implicit-function-declaration]    
     task_lock(locked_task);    
     ^    
/var/lib/dkms/douane/0.8.2/build/douane.c:734:11: error: implicit declaration of function ‘task_unlock’ [-Werror=implicit-function-declaration]    
           task_unlock(locked_task);    
           ^    
/var/lib/dkms/douane/0.8.2/build/douane.c:759:5: error: expected ‘while’ before ‘while_each_thread’    
   } while_each_thread(task, locked_task);    
     ^    
/var/lib/dkms/douane/0.8.2/build/douane.c: In function ‘find_task_from_socket_file’:    
/var/lib/dkms/douane/0.8.2/build/douane.c:773:3: error: implicit declaration of function ‘for_each_process’ [-Werror=implicit-function-declaration]    
   for_each_process(task)    
   ^    
/var/lib/dkms/douane/0.8.2/build/douane.c:774:3: error: expected ‘;’ before ‘{’ token    
   {    
   ^    
cc1: some warnings being treated as errors    
scripts/Makefile.build:300 : la recette pour la cible « /var/lib/dkms/douane/0.8.2/build/douane.o » a échouée    
make[1]: *** [/var/lib/dkms/douane/0.8.2/build/douane.o] Erreur 1    
Makefile:1498 : la recette pour la cible « _module_/var/lib/dkms/douane/0.8.2/build » a échouée    
make: *** [_module_/var/lib/dkms/douane/0.8.2/build] Erreur 2    
make : on quitte le répertoire « /usr/src/linux-headers-4.11.0-041100rc6-generic »    

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.1-2ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.1 20160904 (Ubuntu 5.4.1-2ubuntu1~16.04) 
zedtux commented 7 years ago

Thank you @Kwaadpepper for reporting this compilation issue.

tejado commented 7 years ago

Following patch solved the compiling issue for me on 16.04.02:

diff --git a/Makefile b/Makefile
index ad4b043..9ada284 100644
--- a/Makefile
+++ b/Makefile
@@ -50,11 +50,11 @@ endif

 # make
 all:
-       $(MAKE) -C /lib/modules/$(KERNEL_VERSION)/build M=$(PWD) modules
+       $(MAKE) -C /lib/modules/$(KERNEL_VERSION)/build M=$(shell pwd) modules

 # make clean
 clean:
-       $(MAKE) -C /lib/modules/$(KERNEL_VERSION)/build M=$(PWD) clean
+       $(MAKE) -C /lib/modules/$(KERNEL_VERSION)/build M=$(shell pwd) clean

 # make install (While developing, without using DKMS)
 install:
diff --git a/douane.c b/douane.c
index 674bf10..6143805 100644
--- a/douane.c
+++ b/douane.c
@@ -30,6 +30,7 @@ enum nf_ip_hook_priorities {
 #include <linux/netfilter.h>      // nf_register_hook(), nf_unregister_hook()
 #include <linux/netlink.h>        // NLMSG_SPACE(), nlmsg_put(), NETLINK_CB(), NLMSG_DATA(), NLM_F_REQUEST, netlink_unicast(), netlink_kernel_release(), nlmsg_hdr(), NETLINK_USERSOCK, netlink_kernel_create()
 #include <linux/sched.h>          // for_each_process(), task_lock(), task_unlock()
+#include <linux/sched/signal.h>   // for_each_process(), task_lock(), task_unlock()
 #include <linux/ip.h>             // ip_hdr()
 #include <linux/udp.h>            // udp_hdr()
 #include <linux/tcp.h>            // tcp_hdr()
zedtux commented 7 years ago

Thank you very much @tejado for your input! Can you please open a pull request with this change so that @Kwaadpepper will test it?

tejado commented 7 years ago

Done: https://github.com/Douane/douane-dkms/pull/25

zedtux commented 7 years ago

Thank you @tejado! @Kwaadpepper can you please check and update this issue?

zedtux commented 7 years ago

@Kwaadpepper any news please?

Kwaadpepper commented 7 years ago

Hello sorry, I really don't have time nor the computer to test this. My apologies.

Le lun. 20 nov. 2017 à 09:33, Guillaume Hain notifications@github.com a écrit :

@Kwaadpepper https://github.com/kwaadpepper any news please?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Douane/douane-dkms/issues/24#issuecomment-345625099, or mute the thread https://github.com/notifications/unsubscribe-auth/AFvY8eVa4y2KXBzLi8thV_v-b5m16k1-ks5s4TlfgaJpZM4NJLdy .

zedtux commented 7 years ago

Okay, thank you @Kwaadpepper for answering.

@tejado are you using your fork and is it working since?

tejado commented 7 years ago

I used it but currently I'm not using douane. But yeah, it worked with the mentioned patch.

zedtux commented 6 years ago

@Kwaadpepper and @tejado I have merged the PR so please check and re-open an issue if it isn't fixed. Thank you @tejado for your contribution 👍

vbhasin2 commented 5 years ago

Thankyou @tejado for providing the patch! :)