OpenVPN / ovpn-dco

OpenVPN Data Channel Offload in the linux kernel
108 stars 28 forks source link

Centos 9 Stream build problem "skb_gso_segment" #64

Closed purum-pum-pum closed 6 months ago

purum-pum-pum commented 6 months ago

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)
ordex commented 6 months ago

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?

purum-pum-pum commented 6 months ago

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
ordex commented 6 months ago

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)

purum-pum-pum commented 6 months ago

@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

ordex commented 6 months ago

@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

purum-pum-pum commented 6 months ago

@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

ordex commented 6 months ago

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

purum-pum-pum commented 6 months ago

@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

ordex commented 6 months ago

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

edit: changed command

purum-pum-pum commented 6 months ago

@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 commented 6 months ago

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"
ordex commented 6 months ago

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

purum-pum-pum commented 6 months ago

@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
ordex commented 6 months ago

Thanks for the feedback! Merged to master as c4c4f80edad9f4b94461dff861e63e722cc0590d