elb-toa icon indicating copy to clipboard operation
elb-toa copied to clipboard

It seems there is no modification during two years. Is this module still working?

Open DafuSHI opened this issue 5 years ago • 3 comments

DafuSHI avatar Jun 14 '19 16:06 DafuSHI

I just tried to compile it to experiment, and it fails with:

$ make
make CONFIG_TOA=m  -C /lib/modules/`uname -r`/build M=`pwd` modules
make[1]: Entering directory '/usr/src/linux-headers-4.19.52'
  CC [M]  /home/kotnik/elb-toa/src/toa.o
/home/kotnik/elb-toa/src/toa.c: In function ‘inet_getname_toa’:
/home/kotnik/elb-toa/src/toa.c:114:37: warning: passing argument 3 of ‘inet_getname’ makes integer from pointer without a cast [-Wint-conversion]
  retval = inet_getname(sock, uaddr, uaddr_len, peer);
                                     ^~~~~~~~~
In file included from /home/kotnik/elb-toa/src/toa.h:12:0,
                 from /home/kotnik/elb-toa/src/toa.c:1:
./include/net/inet_common.h:37:5: note: expected ‘int’ but argument is of type ‘int *’
 int inet_getname(struct socket *sock, struct sockaddr *uaddr,
     ^~~~~~~~~~~~
/home/kotnik/elb-toa/src/toa.c:114:11: error: too many arguments to function ‘inet_getname’
  retval = inet_getname(sock, uaddr, uaddr_len, peer);
           ^~~~~~~~~~~~
In file included from /home/kotnik/elb-toa/src/toa.h:12:0,
                 from /home/kotnik/elb-toa/src/toa.c:1:
./include/net/inet_common.h:37:5: note: declared here
 int inet_getname(struct socket *sock, struct sockaddr *uaddr,
     ^~~~~~~~~~~~
/home/kotnik/elb-toa/src/toa.c: In function ‘hook_toa_functions’:
/home/kotnik/elb-toa/src/toa.c:295:29: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
  inet_stream_ops_p->getname = inet_getname_toa;
                             ^
cc1: some warnings being treated as errors
scripts/Makefile.build:309: recipe for target '/home/kotnik/elb-toa/src/toa.o' failed
make[2]: *** [/home/kotnik/elb-toa/src/toa.o] Error 1
Makefile:1517: recipe for target '_module_/home/kotnik/elb-toa/src' failed
make[1]: *** [_module_/home/kotnik/elb-toa/src] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.19.52'
Makefile:8: recipe for target 'default' failed
make: *** [default] Error 2

kotnik avatar Jun 19 '19 10:06 kotnik

It seems your version 4.19 is not yet supported by toa

DafuSHI avatar Aug 07 '19 09:08 DafuSHI

@kotnik It is breaking because of this change - https://github.com/torvalds/linux/commit/9b2c45d479d0fb8647c9e83359df69162b5fbe5f

In 3.16 kernel inet_getname function has 4 arguments - https://github.com/torvalds/linux/blob/v3.16/include/net/inet_common.h#L34

But in the latest kernels, the same function has 3 arguments - (uaddr_len is removed) https://github.com/torvalds/linux/blob/v5.4/include/net/inet_common.h#L40

With this change, I am able to successfully compile it on 5.4 kernel version -

arun@thinkpad:~/projects/elb-toa$ git diff
diff --git a/src/toa.c b/src/toa.c
index 998880b..7015fd7 100644
--- a/src/toa.c
+++ b/src/toa.c
@@ -100,7 +100,7 @@ static void *get_toa_data(struct sk_buff *skb)
  */
 static int
 inet_getname_toa(struct socket *sock, struct sockaddr *uaddr,
-               int *uaddr_len, int peer)
+               int peer)
 {
        int retval = 0;
        struct sock *sk = sock->sk;
@@ -111,7 +111,7 @@ inet_getname_toa(struct socket *sock, struct sockaddr *uaddr,
                sk->sk_user_data);
 
        /* call orginal one */
-       retval = inet_getname(sock, uaddr, uaddr_len, peer);
+       retval = inet_getname(sock, uaddr, peer);
 
        /* set our value if need */
        if (retval == 0 && NULL != sk->sk_user_data && peer) {

bingoarun avatar Jul 19 '20 06:07 bingoarun