ovpn-dco icon indicating copy to clipboard operation
ovpn-dco copied to clipboard

Centos 9 Stream build problem "skb_gso_segment"

Open purum-pum-pum opened this issue 9 months ago • 8 comments

I see that such issue was already closed? but I feel it again

uname -r 5.14.0-437.el9.x86_64

Source from master on this date and also tried three previous tags

/home/andrew/ovpn-dco-master/gen-compat-autoconf.sh /home/andrew/ovpn-dco-master/compat-autoconf.h
make -C /lib/modules/5.14.0-437.el9.x86_64/build M=/home/andrew/ovpn-dco-master PWD=/home/andrew/ovpn-dco-master REVISION= CONFIG_OVPN_DCO_V2=m INSTALL_MOD_DIR=updates/      modules
make[1]: вход в каталог «/usr/src/kernels/5.14.0-437.el9.x86_64»
  CC [M]  /home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/main.o
  CC [M]  /home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/bind.o
  CC [M]  /home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/crypto.o
  CC [M]  /home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/ovpn.o
/home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/ovpn.c: В функции «ovpn_net_xmit»:
/home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/ovpn.c:433:28: ошибка: неявная декларация функции «skb_gso_segment»; имелось в виду «skb_gso_reset»? [-Werror=implicit-function-declaration]
  433 |                 segments = skb_gso_segment(skb, 0);
      |                            ^~~~~~~~~~~~~~~
      |                            skb_gso_reset
/home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/ovpn.c:433:26: предупреждение: assignment to «struct sk_buff *» from «int» makes pointer from integer without a cast [-Wint-conversion]
  433 |                 segments = skb_gso_segment(skb, 0);
      |                          ^
cc1: некоторые предупреждения считаются ошибками
make[3]: *** [scripts/Makefile.build:300: /home/andrew/ovpn-dco-master/drivers/net/ovpn-dco/ovpn.o] Ошибка 1
make[2]: *** [scripts/Makefile.build:588: /home/andrew/ovpn-dco-master/drivers/net/ovpn-dco] Ошибка 2
make[1]: *** [Makefile:1927: /home/andrew/ovpn-dco-master] Ошибка 2
make[1]: выход из каталога «/usr/src/kernels/5.14.0-437.el9.x86_64»
make: *** [Makefile:47: all] Ошибка 2
ndrew@localhost ovpn-dco-master]$ gcc --version
gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3)

purum-pum-pum avatar May 02 '24 15:05 purum-pum-pum

I am pretty sure this is a new issue with RH kernel where they backported the header file split. Can you check if you have the file include/net/gso.h in your kernel source tree?

ordex avatar May 02 '24 20:05 ordex

I am pretty sure this is a new issue with RH kernel where they backported the header file split. Can you check if you have the file include/net/gso.h in your kernel source tree?

I think I have

rew@localhost ~]$ sudo ls /lib/modules/5.14.0-437.el9.x86_64/build/include/net | grep g...h
gre.h
gro.h
gso.h
gtp.h
gue.h

and here

[andrew@localhost ~]$ sudo ls /lib/modules/5.14.0-437.el9.x86_64/source/include/net | grep g...h
gre.h
gro.h
gso.h
gtp.h
gue.h

purum-pum-pum avatar May 03 '24 07:05 purum-pum-pum

Yeah, as expected. That file was introduced way later in the mainline kernel. So we need a RH specific exception in the compat code (like we do for other RH peculiarities)

ordex avatar May 03 '24 09:05 ordex

@ordex But as I see we have lines in ovpn.c:

#include <linux/workqueue.h>
#include <net/gso.h>
#include <uapi/linux/if_ether.h>

I thought it enough to build. Like here reccopmend https://github.com/mkubecek/vmware-host-modules/issues/244

purum-pum-pum avatar May 03 '24 12:05 purum-pum-pum

@ordex But as I see we have lines in ovpn.c:

#include <linux/workqueue.h>
#include <net/gso.h>
#include <uapi/linux/if_ether.h>

I thought it enough to build. Like here reccopmend mkubecek/vmware-host-modules#244

This code does not compile as is on older kernels. There is the compat code to take into consideration. If you want you can have a look at the linux-compat.h file and compat-include folder.

We already have checks for the RH macro for other pieces of code. It's about adding the same check also around the compat code for net/gso.h

ordex avatar May 03 '24 12:05 ordex

@ordex Ohhh, I thout that all in ovpn.c compiles as it is. And linux-compat.h anly add additional lines in source codes

Well, as a test I have added before all lines this:

 [andrew@localhost ~]$ nano linux-compat.h


#include <net/gso.h>

#ifndef _NET_OVPN_DCO_LINUX_COMPAT_H_
#define _NET_OVPN_DCO_LINUX_COMPAT_H_

#include <linux/kconfig.h>
#include <linux/version.h>

And... Got other errors( make2024.log

purum-pum-pum avatar May 04 '24 08:05 purum-pum-pum

Nope, that can't work. Like I said above, you need to extend the check in the gso compat code to account for this RH exception. We have similar approaches for other compat hunks

ordex avatar May 04 '24 08:05 ordex

@ordex ohh, i too dummy for such things.

well, made edit the file /compat-include/net/gso.h for my kernel and yeah. It work. I have build kernel module Thank you for passion and help. I'm waiting new pull from you, that will fix build

PS I used source from master branch

purum-pum-pum avatar May 04 '24 09:05 purum-pum-pum

@purum-pum-pum can you please provide us the output of cat /usr/include/linux/version.h ?

edit: changed command

ordex avatar May 21 '24 06:05 ordex

@ordex [andrew@localhost Downloads]$ grep RHEL_RELEASE_CODE /lib/modules/5.14.0-444.el9.x86_64/source/include/generated/uapi/linux/version.h #define RHEL_RELEASE_CODE 2309

purum-pum-pum avatar May 21 '24 10:05 purum-pum-pum

oh, see edits

[andrew@localhost Downloads]$ cat /usr/include/linux/version.h
#define LINUX_VERSION_CODE 331264
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
#define LINUX_VERSION_MAJOR 5
#define LINUX_VERSION_PATCHLEVEL 14
#define LINUX_VERSION_SUBLEVEL 0
#define RHEL_MAJOR 9
#define RHEL_MINOR 5
#define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))
#define RHEL_RELEASE_CODE 2309
#define RHEL_RELEASE "444"

purum-pum-pum avatar May 21 '24 10:05 purum-pum-pum

@purum-pum-pum I pushed a fix to the rhel-9.4 branch. care to give it a go?

ordex avatar May 21 '24 11:05 ordex

@ordex I have updated to kernel 5.14.0-447.el9.x86_64 and build again ovpn-dco module. Everythink OK I think you can pull changes from rhel 9.4 branch to master

[andrew@localhost ~]$ ethtool -i tun0
driver: ovpn-dco
version: 2.0.0
firmware-version: 
expansion-rom-version: 
bus-info: ovpn
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

purum-pum-pum avatar May 21 '24 15:05 purum-pum-pum

Thanks for the feedback! Merged to master as c4c4f80edad9f4b94461dff861e63e722cc0590d

ordex avatar May 21 '24 20:05 ordex