support kernel 4.1 or later #185

Merged
merged 1 commit into from Nov 11, 2015

Projects

None yet

2 participants

@pandax381
Contributor

Compile failed in Linux kernel 4.1.

$ make
make -C stateless
make[1]: Entering directory `/home/pandax381/LOCAL/NAT64/mod/stateless'
make -C /lib/modules/4.1.7-v7+/build M=$PWD JOOL_FLAGS=""
make[2]: Entering directory `/usr/src/linux-headers-4.1.7-v7+'
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/rfc6145/4to6.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/rfc6145/6to4.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/rfc6145/common.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/rfc6145/core.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/address.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/types.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/str_utils.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/packet.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/stats.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/log_time.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/icmp_wrapper.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/ipv6_hdr_iterator.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/pool6.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/rfc6052.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/nl_buffer.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/rbtree.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/config.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/nl_handler.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/route.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/send_packet.o
  CC [M]  /home/pandax381/LOCAL/NAT64/mod/stateless/../common/core.o
/home/pandax381/LOCAL/NAT64/mod/stateless/../common/core.c: In function 'check_namespace':
/home/pandax381/LOCAL/NAT64/mod/stateless/../common/core.c:70:25: error: invalid operands to binary != (have 'possible_net_t' and 'struct net *')
make[3]: *** [/home/pandax381/LOCAL/NAT64/mod/stateless/../common/core.o] Error 1
make[2]: *** [_module_/home/pandax381/LOCAL/NAT64/mod/stateless] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-4.1.7-v7+'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/pandax381/LOCAL/NAT64/mod/stateless'
make: *** [stateless] Error 2

The cause is because the API of the callback function of Netfilter has been changed in the kernel 4.1 or later. If the kernel version 4.1 or later, you need to use the new API.

include/linux/netfilter.h (kernel 4.0 or earlier)

typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
                               struct sk_buff *skb,
                               const struct net_device *in,
                               const struct net_device *out,
                               int (*okfn)(struct sk_buff *));

include/linux/netfilter.h (kernel 4.1 or later)

typedef unsigned int nf_hookfn(const struct nf_hook_ops *ops,
                               struct sk_buff *skb,
                               const struct nf_hook_state *state);
@ydahhrk ydahhrk merged commit 624bb60 into NICMx:master Nov 11, 2015
@ydahhrk
Member
ydahhrk commented Nov 11, 2015

This is a huge deal. Want credits in Jool's README?

(If so, you might want to add whether you want your email in there too.)

Also, sorry for the inconveniences.

@pandax381
Contributor

Thank you quickly merged my pull request.

Want credits in Jool's README?

Yes, I want it.
I want you to put my name (with a link to my github profile page).

Thank you.

@ydahhrk ydahhrk added a commit that referenced this pull request Nov 11, 2015
@ydahhrk ydahhrk Adding credits for pull request #185. cd484f8
@ydahhrk
Member
ydahhrk commented Nov 11, 2015

Ok, done.

I'm wondering if I should have swapped the name and last name, but I left it as currently specified.
(It can be tweaked any time in the future if you wish.)

@ydahhrk
Member
ydahhrk commented Nov 11, 2015

Actually, the proposed code also fixes a messed up function call that used to lead to kernel panics.

New plan:
I'm going to tag this as critical and release 3.4.1 right now.

@ydahhrk ydahhrk added this to the 3.4.1 milestone Nov 12, 2015
@ydahhrk ydahhrk referenced this pull request Nov 12, 2015
Closed

Enhance the testing suite #189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment