Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow building with IPv6 disabled #2216

Open
carneallabrace opened this issue Dec 28, 2024 · 1 comment
Open

Allow building with IPv6 disabled #2216

carneallabrace opened this issue Dec 28, 2024 · 1 comment
Labels
kind/feature New feature or request

Comments

@carneallabrace
Copy link

Motivation

I would like to use sysdig on my raspberry (ARMv8, 64bit kernel) which doesn't have IPv6 enabled.

What i basically did

git clone https://github.com/draios/sysdig # 0.1.72-4500-g4918c7bea
cd sysdig
mkdir build; cd build; cmake ..
make

Relevant output

root@raspberrypi:/usr/src/sysdig/build# make 
[  1%] Built target uthash
[  3%] Built target tbb
[  4%] Built target c-ares
[  5%] Built target openssl
[  7%] Built target zlib
[  8%] Built target curl
[ 10%] Built target jsoncpp
[ 12%] Built target valijson
[ 14%] Built target re2
[ 16%] Built target njson
[configure-kmod] Including /usr/src/sysdig/build/driver/src//configure/ACCESS_OK_2/Makefile.inc /usr/src/sysdig/build/driver/src//configure/DEVNODE_ARG1_CONST/Makefile.inc /usr/src/sysdig/build/driver/src//configure/CLASS_CREATE_1/Makefile.inc
[configure-kmod] Setting HAS_ACCESS_OK_2 flag
[configure-kmod] Build output for HAS_DEVNODE_ARG1_CONST:
[configure-kmod] make: Entering directory '/usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST' make -C /usr/src/linux-rpi-5.10.y M=/usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST modules make[1]: Entering directory '/usr/src/linux-rpi-5.10.y'   CC [M]  /usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST/test.o /usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST/test.c: In function 'devnode_dev_const_init': /usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST/test.c:26:48: error: initialization of 'char * (*)(struct device *, umode_t *)' {aka 'char * (*)(struct device *, short unsigned int *)'} from incompatible pointer type 'char * (*)(const struct device *, umode_t *)' {aka 'char * (*)(const struct device *, short unsigned int *)'} [-Werror=incompatible-pointer-types]    26 |         struct class g_ppm_class = {.devnode = ppm_devnode};       |                                                ^~~~~~~~~~~ /usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST/test.c:26:48: note: (near initialization for 'g_ppm_class.devnode') cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:280: /usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST/test.o] Error 1 make[1]: *** [Makefile:1825: /usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST] Error 2 make[1]: Leaving directory '/usr/src/linux-rpi-5.10.y' make: *** [Makefile:15: all] Error 2 make: Leaving directory '/usr/src/sysdig/build/driver/src/configure/DEVNODE_ARG1_CONST'
[configure-kmod] Build output for HAS_CLASS_CREATE_1:
[configure-kmod] make: Entering directory '/usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1' make -C /usr/src/linux-rpi-5.10.y M=/usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1 modules make[1]: Entering directory '/usr/src/linux-rpi-5.10.y'   CC [M]  /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1/test.o /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1/test.c: In function 'class_create_test_init': /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1/test.c:23:56: error: macro "class_create" requires 2 arguments, but only 1 given    23 |         struct class *g_ppm_class = class_create("test");       |                                                        ^ In file included from ./include/linux/device.h:31,                  from /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1/test.c:17: ./include/linux/device/class.h:259: note: macro "class_create" defined here   259 | #define class_create(owner, name)               \       |  /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1/test.c:23:37: error: 'class_create' undeclared (first use in this function); did you mean 'class_compat'?    23 |         struct class *g_ppm_class = class_create("test");       |                                     ^~~~~~~~~~~~       |                                     class_compat /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1/test.c:23:37: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [scripts/Makefile.build:280: /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1/test.o] Error 1 make[1]: *** [Makefile:1825: /usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1] Error 2 make[1]: Leaving directory '/usr/src/linux-rpi-5.10.y' make: *** [Makefile:15: all] Error 2 make: Leaving directory '/usr/src/sysdig/build/driver/src/configure/CLASS_CREATE_1'
/usr/src/sysdig/build/driver/src/ppm_events.c: In function ‘sock_getname’:
/usr/src/sysdig/build/driver/src/ppm_events.c:217:66: error: ‘struct inet_sock’ has no member named ‘pinet6’
  217 |                 struct ipv6_pinfo *np = (struct ipv6_pinfo *)inet->pinet6;
      |                                                                  ^~
In file included from /usr/src/sysdig/build/driver/src/ppm_events.c:16:
./include/net/sock.h:380:45: error: ‘struct sock_common’ has no member named ‘skc_v6_daddr’; did you mean ‘skc_daddr’?
  380 | #define sk_v6_daddr             __sk_common.skc_v6_daddr
      |                                             ^~~~~~~~~~~~
/usr/src/sysdig/build/driver/src/ppm_events.c:222:46: note: in expansion of macro ‘sk_v6_daddr’
  222 |                         sin->sin6_addr = sk->sk_v6_daddr;
      |                                              ^~~~~~~~~~~
./include/net/sock.h:381:37: error: ‘struct sock_common’ has no member named ‘skc_v6_rcv_saddr’; did you mean ‘skc_rcv_saddr’?
  381 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
      |                                     ^~~~~~~~~~~~~~~~
/usr/src/sysdig/build/driver/src/ppm_events.c:224:46: note: in expansion of macro ‘sk_v6_rcv_saddr’
  224 |                         sin->sin6_addr = sk->sk_v6_rcv_saddr;
      |                                              ^~~~~~~~~~~~~~~
/usr/src/sysdig/build/driver/src/ppm_events.c: In function ‘fd_to_socktuple’:
/usr/src/sysdig/build/driver/src/ppm_events.c:1125:70: error: ‘struct sock_common’ has no member named ‘skc_v6_daddr’; did you mean ‘skc_daddr’?
 1125 |                                         sip6 = sock->sk->__sk_common.skc_v6_daddr.in6_u.u6_addr8;
      |                                                                      ^~~~~~~~~~~~
      |                                                                      skc_daddr
make[5]: *** [scripts/Makefile.build:280: /usr/src/sysdig/build/driver/src/ppm_events.o] Error 1
make[4]: *** [Makefile:1825: /usr/src/sysdig/build/driver/src] Error 2
make[3]: *** [Makefile:22: all] Error 2
make[2]: *** [driver/CMakeFiles/driver.dir/build.make:70: driver/CMakeFiles/driver] Error 2
make[1]: *** [CMakeFiles/Makefile2:769: driver/CMakeFiles/driver.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
root@raspberrypi:/usr/src/sysdig/build# zgrep IPV6 /proc/config.gz 
# CONFIG_IPV6 is not set
root@raspberrypi:/usr/src/sysdig/build# 

I reported this here since the code affected seems to be in this repo.

Feature

It seems you guys have some sort of autotools-like (why?) configuration system in "driver/configure" so maybe you could add a new HAS_IPV6 (HAVE_IPV6?) "macro" and then use it to #ifdef all those pesky case AF_INET:

Alternatives

Rebuilding my kernel with IPv6 enabled.

Additional context

@carneallabrace carneallabrace added the kind/feature New feature or request label Dec 28, 2024
@carneallabrace
Copy link
Author

carneallabrace commented Dec 28, 2024

Just to be clear the same problem can be reproduced on amd64/linux-6.12.7 with IPv6 disabled, it has nothing to do with building on a Raspberry.

OTOH building with IPV6 enabled works, even on the Raspberry:

root@raspberrypi:/usr/src/linux-rpi-5.10.y# grep IPV6=y .config
CONFIG_IPV6=y
CONFIG_NF_DEFRAG_IPV6=y
root@raspberrypi:/usr/src/linux-rpi-5.10.y# modinfo ../sysdig/build/driver/scap.ko
filename:       /usr/src/linux-rpi-5.10.y/../sysdig/build/driver/scap.ko
schema_version: 2.22.1
api_version:    8.0.3
build_commit:   4918c7beab536d4859f33900e8121aaed6b203e3
version:        7.3.0+driver
author:         the Falco authors
license:        Dual MIT/GPL
srcversion:     A413F6F811834BFEA4B787C
depends:        
name:           scap
vermagic:       5.10.110-v8 SMP preempt mod_unload modversions aarch64
parm:           g_buffer_bytes_dim:This is the dimension of a single per-CPU buffer in bytes. Please note: this buffer will be mapped twice in the process virtual memory, so pay attention to its size.
parm:           max_consumers:Maximum number of consumers that can simultaneously open the devices (uint)
parm:           verbose:Enable verbose logging (bool)
root@raspberrypi:/usr/src/linux-rpi-5.10.y# 

@carneallabrace carneallabrace changed the title Allow building with Pv6 disabled Allow building with IPv6 disabled Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant