Chion82 / netfilter-full-cone-nat

A kernel module to turn MASQUERADE into full cone SNAT
GNU General Public License v2.0
427 stars 121 forks source link

kernel build failure due to 'error: invalid use of undefined type' #38

Open enihcam opened 3 years ago

enihcam commented 3 years ago
  CC [M]  net/netfilter/xt_FULLCONENAT.o
net/netfilter/xt_FULLCONENAT.c:339:52: warning: ‘struct nf_ct_event’ declared inside parameter list will not be
 visible outside of this definition or declaration
  339 | static int ct_event_cb(unsigned int events, struct nf_ct_event *item) {
      |                                                    ^~~~~~~~~~~
net/netfilter/xt_FULLCONENAT.c: In function ‘ct_event_cb’:
net/netfilter/xt_FULLCONENAT.c:346:12: error: invalid use of undefined type ‘struct nf_ct_event’
  346 |   ct = item->ct;
      |            ^~
net/netfilter/xt_FULLCONENAT.c: In function ‘fullconenat_tg_check’:
net/netfilter/xt_FULLCONENAT.c:648:22: error: invalid use of undefined type ‘struct nf_ct_event_notifier’
  648 |     ct_event_notifier.fcn = ct_event_cb;
      |                      ^
net/netfilter/xt_FULLCONENAT.c:651:9: error: implicit declaration of function ‘nf_conntrack_register_notifier’;
 did you mean ‘netlink_register_notifier’? [-Werror=implicit-function-declaration]
  651 |     if (nf_conntrack_register_notifier(par->net, &ct_event_notifier) == 0) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         netlink_register_notifier
net/netfilter/xt_FULLCONENAT.c: In function ‘fullconenat_tg_destroy’:
net/netfilter/xt_FULLCONENAT.c:675:7: error: implicit declaration of function ‘nf_conntrack_unregister_notifier
’; did you mean ‘netlink_unregister_notifier’? [-Werror=implicit-function-declaration]
  675 |       nf_conntrack_unregister_notifier(par->net, &ct_event_notifier);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       netlink_unregister_notifier
net/netfilter/xt_FULLCONENAT.c: At top level:
net/netfilter/xt_FULLCONENAT.c:91:29: error: storage size of ‘ct_event_notifier’ isn’t known
   91 | struct nf_ct_event_notifier ct_event_notifier;
      |                             ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:273: net/netfilter/xt_FULLCONENAT.o] Error 1
make[1]: *** [scripts/Makefile.build:516: net/netfilter] Error 2
make: *** [Makefile:1854: net] Error 2

Anyone?

FerdiScholten commented 2 years ago

Also fails to build on my system, haven't had time to find out why.

FerdiScholten commented 2 years ago

Exactly the same output as enihcam in my buildconsole

Kayuii commented 2 years ago

make netfilter-full-cone-nat in ubuntu 22.04TLS

make -C /lib/modules/5.15.0-30-generic/build M=/root/fullcone/netfilter-full-cone-nat modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-30-generic'
  CC [M]  /root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.o
/root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.c: In function ‘fullconenat_tg_check’:
/root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.c:648:22: error: ‘struct nf_ct_event_notifier’ has no member named ‘fcn’
  648 |     ct_event_notifier.fcn = ct_event_cb;
      |                      ^
/root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.c:651:9: error: void value not ignored as it ought to be
  651 |     if (nf_conntrack_register_notifier(par->net, &ct_event_notifier) == 0) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.c: In function ‘fullconenat_tg_destroy’:
/root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.c:675:7: error: too many arguments to function ‘nf_conntrack_unregister_notifier’
  675 |       nf_conntrack_unregister_notifier(par->net, &ct_event_notifier);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./include/net/netfilter/nf_conntrack_core.h:18,
                 from /root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.c:28:
./include/net/netfilter/nf_conntrack_ecache.h:88:6: note: declared here
   88 | void nf_conntrack_unregister_notifier(struct net *net);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:285: /root/fullcone/netfilter-full-cone-nat/xt_FULLCONENAT.o] Error 1
make[1]: *** [Makefile:1875: /root/fullcone/netfilter-full-cone-nat] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-30-generic'
make: *** [Makefile:5: all] Error 2
vincenthsing commented 2 years ago

same here~