From 6a29a9f935c1a97b453659547948cee8448118d7ae5828a7398decf40e5926f9 Mon Sep 17 00:00:00 2001 From: Otto Hollmann Date: Thu, 23 May 2024 11:41:38 +0000 Subject: [PATCH] Accepting request 1176445 from home:ohollmann:branches:network - teamd: lw: arp_ping: bitmask VID in VLAN BPF filter [bsc#1224798] * Add 0001-teamd-lw-arp_ping-bitmask-VID-in-VLAN-BPF-filter.patch OBS-URL: https://build.opensuse.org/request/show/1176445 OBS-URL: https://build.opensuse.org/package/show/network/libteam?expand=0&rev=28 --- ..._ping-bitmask-VID-in-VLAN-BPF-filter.patch | 43 +++++++++++++++++++ libteam.changes | 6 +++ libteam.spec | 4 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 0001-teamd-lw-arp_ping-bitmask-VID-in-VLAN-BPF-filter.patch diff --git a/0001-teamd-lw-arp_ping-bitmask-VID-in-VLAN-BPF-filter.patch b/0001-teamd-lw-arp_ping-bitmask-VID-in-VLAN-BPF-filter.patch new file mode 100644 index 0000000..1d479ec --- /dev/null +++ b/0001-teamd-lw-arp_ping-bitmask-VID-in-VLAN-BPF-filter.patch @@ -0,0 +1,43 @@ +From 337125ce8d24ed66d7f4c7e6eef50458f3e7d154 Mon Sep 17 00:00:00 2001 +From: Robert Karbowski +Date: Sun, 19 May 2024 12:40:03 +0200 +Subject: [PATCH] teamd: lw: arp_ping: bitmask VID in VLAN BPF filter + +BPF filter arp_vlan_rpl_flt fails if in the ARP response the VLAN tag has, +in addition to VID, also PCP (priority code point). +This patch is masking the last 12 bits from SKF_AD_VLAN_TAG field +to extract VID only. + +Signed-off-by: Robert Karbowski +Signed-off-by: Jiri Pirko +--- + teamd/teamd_lw_arp_ping.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/teamd/teamd_lw_arp_ping.c b/teamd/teamd_lw_arp_ping.c +index c3d4710..5b5c044 100644 +--- a/teamd/teamd_lw_arp_ping.c ++++ b/teamd/teamd_lw_arp_ping.c +@@ -90,10 +90,11 @@ static const struct sock_fprog arp_novlan_rpl_fprog = { + + static struct sock_filter arp_vlan_rpl_flt[] = { + BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_PROTOCOL), +- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETH_P_ARP, 0, 8), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ETH_P_ARP, 0, 9), + BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_VLAN_TAG_PRESENT), +- BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 6, 0), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0, 7, 0), + BPF_STMT(BPF_LD + BPF_B + BPF_ABS, SKF_AD_OFF + SKF_AD_VLAN_TAG), ++ BPF_STMT(BPF_ALU + BPF_AND + BPF_K, 0xfff), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 0xffff, 0, 4), /* 0xffff will be replaced by vland id */ + BPF_STMT(BPF_LD + BPF_H + BPF_ABS, OFFSET_ARP_OP_CODE), + BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, ARPOP_REPLY, 1, 0), +@@ -103,7 +104,7 @@ static struct sock_filter arp_vlan_rpl_flt[] = { + }; + + /* this hack replaces vlanid value in filter code */ +-#define SET_FILTER_VLANID(fprog, vlanid) (fprog)->filter[5].k = vlanid ++#define SET_FILTER_VLANID(fprog, vlanid) (fprog)->filter[6].k = vlanid + + static const struct sock_fprog arp_vlan_rpl_fprog = { + .len = ARRAY_SIZE(arp_vlan_rpl_flt), diff --git a/libteam.changes b/libteam.changes index e45d2df..fe77274 100644 --- a/libteam.changes +++ b/libteam.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu May 23 11:22:27 UTC 2024 - Otto Hollmann + +- teamd: lw: arp_ping: bitmask VID in VLAN BPF filter [bsc#1224798] + * Add 0001-teamd-lw-arp_ping-bitmask-VID-in-VLAN-BPF-filter.patch + ------------------------------------------------------------------- Tue Sep 26 14:47:59 UTC 2023 - Otto Hollmann diff --git a/libteam.spec b/libteam.spec index 3b63ca5..87a6d5c 100644 --- a/libteam.spec +++ b/libteam.spec @@ -1,7 +1,7 @@ # # spec file for package libteam # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -35,6 +35,8 @@ Patch3: ignore_ebusy_for_team_hwaddr_set.patch Patch4: 0001-allow-send_interface-dbus.patch Patch5: harden_teamd@.service.patch Patch6: better_handle_failures_to_chown.patch +# PATCH-FIX-UPSTREAM bsc#1224798 teamd: lw: arp_ping: bitmask VID in VLAN BPF filter +Patch7: 0001-teamd-lw-arp_ping-bitmask-VID-in-VLAN-BPF-filter.patch BuildRequires: doxygen BuildRequires: libcap-devel BuildRequires: libtool