NICMx / Jool

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

compiling against a vendor kernel for 5.4 resulted in an undeclared function #407

Closed chardin-cpi closed 1 year ago

chardin-cpi commented 1 year ago

This is a vendor environment targeting an aarch64 platform with a gcc 11.2 and kernel close to 5.4.x kernel

# SPDX-License-Identifier: GPL-2.0
VERSION = 5
PATCHLEVEL = 4
SUBLEVEL = 70
EXTRAVERSION =
NAME = Kleptomaniac Octopus

and then building the jool kernel module

  CC [M]  /home/ubuntu/build/jool-4.1.10/src/mod/common/rfc7915/6to4.o
../jool-4.1.10/src/mod/common/rfc7915/6to4.c: In function 'update_icmp4_csum':
../jool-4.1.10/src/mod/common/rfc7915/6to4.c:825:28: error: implicit declaration of function 'csum_ipv6_magic'; did you mean 'csum_tcpudp_magic'? [-Werror=implicit-function-declaration]
  825 |         tmp = ~csum_unfold(csum_ipv6_magic(&in_ip6->saddr, &in_ip6->daddr,
      |                            ^~~~~~~~~~~~~~~
      |                            csum_tcpudp_magic
cc1: some warnings being treated as errors

So, resolved this with this patch that seems to work on all of the platforms targeted with arm and aarch64

diff -Naur Jool-4.1.10.orig/src/mod/common/rfc7915/6to4.c Jool-4.1.10/src/mod/common/rfc7915/6to4.c
--- Jool-4.1.10.orig/src/mod/common/rfc7915/6to4.c      2023-06-11 11:24:56.000000000 -0700
+++ Jool-4.1.10/src/mod/common/rfc7915/6to4.c   2023-06-26 15:47:09.573363699 -0700
@@ -1,6 +1,7 @@
 #include "mod/common/rfc7915/6to4.h"

 #include <linux/inetdevice.h>
+#include <net/ip6_checksum.h>
 #include <net/udp.h>
 #include <net/tcp.h>

This might be a problem in a linux tree - but, the patch seemed benign enough to report upstream.

ydahhrk commented 1 year ago

Thanks!