[PATCH 6.12.y 0/2] Fix rtnetlink.sh kselftest failures in stable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is reproducible on on stable kernels after the backport of commit:
2cf567f421db ("netdevsim: copy addresses for both in and out paths") to
stable kernels.

Using a single cover letter for all stable kernels but will send
separate patches for each stable kernel

Which kselftests are particularly failing:

2c2
< sa[0] tx ipaddr=0x00000000 00000000 00000000 047ba8c0
---
> sa[0] tx ipaddr=0x00000000 00000000 00000000 00000000
FAIL: ipsec_offload incorrect driver data
FAIL: ipsec_offload

 813         # does driver have correct offload info
 814         diff $sysfsf - << EOF
 815 SA count=2 tx=3
 816 sa[0] tx ipaddr=0x00000000 00000000 00000000 00000000
 817 sa[0]    spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1
 818 sa[0]    key=0x34333231 38373635 32313039 36353433
 819 sa[1] rx ipaddr=0x00000000 00000000 00000000 037ba8c0
 820 sa[1]    spi=0x00000009 proto=0x32 salt=0x61626364 crypt=1
 821 sa[1]    key=0x34333231 38373635 32313039 36353433
 822 EOF
 823         if [ $? -ne 0 ] ; then
 824                 echo "FAIL: ipsec_offload incorrect driver data"
 825                 check_err 1
 826         fi
 827

This part of check throws errors and the rtnetlink.sh fails on ipsec_offload.

Reason is that the after the below patch:

commit 2cf567f421dbfe7e53b7e5ddee9400da10efb75d
Author: Hangbin Liu <liuhangbin@xxxxxxxxx>
Date:   Thu Oct 10 04:00:26 2024 +0000

    netdevsim: copy addresses for both in and out paths
   
    [ Upstream commit 2cf567f421dbfe7e53b7e5ddee9400da10efb75d ]
   
    The current code only copies the address for the in path, leaving the out
    path address set to 0. This patch corrects the issue by copying the addresses
    for both the in and out paths. Before this patch:
   
      # cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec
      SA count=2 tx=20
      sa[0] tx ipaddr=0.0.0.0
      sa[0]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
      sa[0]    key=0x3167608a ca4f1397 43565909 941fa627
      sa[1] rx ipaddr=192.168.0.1
      sa[1]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
      sa[1]    key=0x3167608a ca4f1397 43565909 941fa627
   
    After this patch:
   
      = cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec
      SA count=2 tx=20
      sa[0] tx ipaddr=192.168.0.2
      sa[0]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
      sa[0]    key=0x3167608a ca4f1397 43565909 941fa627
      sa[1] rx ipaddr=192.168.0.1
      sa[1]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
      sa[1]    key=0x3167608a ca4f1397 43565909 941fa627
   
    Fixes: 7699353da875 ("netdevsim: add ipsec offload testing")


tx ip address is not 0.0.0.0 anymore, it is was 0.0.0.0 before above patch.

So this commit: 3ec920bb978c ("selftests: rtnetlink: update netdevsim
ipsec output format") which is not backported to stable kernels tries to
address rtneltlink.sh fixing.

fixes the change in handling tx ip address as well, so far so good!

but when I apply this script fix it doesn't pass yet:

2c2
< sa[0] tx ipaddr=0x00000000 00000000 00000000 047ba8c0
---
> sa[0] tx ipaddr=192.168.123.4
5c5
< sa[1] rx ipaddr=0x00000000 00000000 00000000 037ba8c0
---
> sa[1] rx ipaddr=192.168.123.3
FAIL: ipsec_offload incorrect driver data

So it clearly suggest that addresses are not properly handled, IPSec addresses
are printed in hexadecimal format, but the script expects it in more readable
format, that hinted me whats missing, and that commit is:

commit c71bc6da6198a6d88df86094f1052bb581951d65
Author: Hangbin Liu <liuhangbin@xxxxxxxxx>
Date:   Thu Oct 10 04:00:25 2024 +0000

    netdevsim: print human readable IP address
    
    Currently, IPSec addresses are printed in hexadecimal format, which is
    not user-friendly. e.g.
    
      # cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec
      SA count=2 tx=20
      sa[0] rx ipaddr=0x00000000 00000000 00000000 0100a8c0
      sa[0]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
      sa[0]    key=0x3167608a ca4f1397 43565909 941fa627
      sa[1] tx ipaddr=0x00000000 00000000 00000000 00000000
      sa[1]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
      sa[1]    key=0x3167608a ca4f1397 43565909 941fa627
    
    This patch updates the code to print the IPSec address in a human-readable
    format for easier debug. e.g.
    
     # cat /sys/kernel/debug/netdevsim/netdevsim0/ports/0/ipsec
     SA count=4 tx=40
     sa[0] tx ipaddr=0.0.0.0
     sa[0]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
     sa[0]    key=0x3167608a ca4f1397 43565909 941fa627
     sa[1] rx ipaddr=192.168.0.1
     sa[1]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
     sa[1]    key=0x3167608a ca4f1397 43565909 941fa627
     sa[2] tx ipaddr=::
     sa[2]    spi=0x00000100 proto=0x32 salt=0x0adecc3a crypt=1
     sa[2]    key=0x3167608a ca4f1397 43565909 941fa627
     sa[3] rx ipaddr=2000::1
     sa[3]    spi=0x00000101 proto=0x32 salt=0x0adecc3a crypt=1
     sa[3]    key=0x3167608a ca4f1397 43565909 941fa627

Solution:
========

Backport both the commits commit: c71bc6da6198 ("netdevsim: print human
readable IP address") and script fixup commit: 3ec920bb978c ("selftests:
rtnetlink: update netdevsim ipsec output format") to all stable kernels
which have commit: 2cf567f421db ("netdevsim: copy addresses for both in
and out paths") in them.

Another clue to say this is right way to do this is that these above
three patches did go as patchset into net/ [1].

I am sending patches for all stable trees differently, however I am
using same cover letter.

Tested all stable kernels after patching. This failure is no more
reproducible.

Thanks,
Harshit

[1] https://lore.kernel.org/all/172868703973.3018281.2970275743967117794.git-patchwork-notify@xxxxxxxxxx/


Hangbin Liu (2):
  netdevsim: print human readable IP address
  selftests: rtnetlink: update netdevsim ipsec output format

 drivers/net/netdevsim/ipsec.c            | 12 ++++++++----
 tools/testing/selftests/net/rtnetlink.sh |  4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

-- 
2.46.0





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux