From b84ecb89a9999a28cec938d0d0ff1fff9f0c9eae Mon Sep 17 00:00:00 2001 From: chengyechun Date: Fri, 29 Oct 2021 20:46:52 +0800 Subject: [PATCH] update some patches from community --- ...ix-bpffs-mount-when-sys-fs-bpf-exist.patch | 52 +++++++++++++++++++ ...2-tc-f_flower-fix-port-range-parsing.patch | 36 +++++++++++++ iproute.spec | 11 +++- 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 bugfix-iproute2-lib-bpf-fix-bpffs-mount-when-sys-fs-bpf-exist.patch create mode 100644 bugfix-iproute2-tc-f_flower-fix-port-range-parsing.patch diff --git a/bugfix-iproute2-lib-bpf-fix-bpffs-mount-when-sys-fs-bpf-exist.patch b/bugfix-iproute2-lib-bpf-fix-bpffs-mount-when-sys-fs-bpf-exist.patch new file mode 100644 index 0000000..26d0e6f --- /dev/null +++ b/bugfix-iproute2-lib-bpf-fix-bpffs-mount-when-sys-fs-bpf-exist.patch @@ -0,0 +1,52 @@ +From cdedd335b6cbe7fff492b32ef00d928d8d389570 Mon Sep 17 00:00:00 2001 +From: Andrea Claudi +Date: Tue, 21 Sep 2021 11:33:24 +0200 +Subject: [PATCH] lib: bpf_legacy: fix bpffs mount when /sys/fs/bpf exists +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bpf selftests using iproute2 fails with: + +$ ip link set dev veth0 xdp object ../bpf/xdp_dummy.o section xdp_dummy +Continuing without mounted eBPF fs. Too old kernel? +mkdir (null)/globals failed: No such file or directory +Unable to load program + +This happens when the /sys/fs/bpf directory exists. In this case, mkdir +in bpf_mnt_check_target() fails with errno == EEXIST, and the function +returns -1. Thus bpf_get_work_dir() does not call bpf_mnt_fs() and the +bpffs is not mounted. + +Fix this in bpf_mnt_check_target(), returning 0 when the mountpoint +exists. + +Fixes: d4fcdbbec9df ("lib/bpf: Fix and simplify bpf_mnt_check_target()") +Reported-by: Mingyu Shi +Reported-by: Jiri Benc +Suggested-by: Jiri Benc +Signed-off-by: Andrea Claudi +Reviewed-by: Toke Høiland-Jørgensen +Signed-off-by: Stephen Hemminger + +Conflicts: lib/bpf.c +--- + lib/bpf.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/bpf.c b/lib/bpf.c +index 0062e83..014314b 100644 +--- a/lib/bpf.c ++++ b/lib/bpf.c +@@ -525,6 +525,8 @@ static int bpf_mnt_check_target(const char *target) + if (ret) { + ret = mkdir(target, S_IRWXU); + if (ret) { ++ if (errno == EEXIST) ++ return 0; + fprintf(stderr, "mkdir %s failed: %s\n", target, + strerror(errno)); + return ret; +-- +1.8.3.1 + diff --git a/bugfix-iproute2-tc-f_flower-fix-port-range-parsing.patch b/bugfix-iproute2-tc-f_flower-fix-port-range-parsing.patch new file mode 100644 index 0000000..7e4e197 --- /dev/null +++ b/bugfix-iproute2-tc-f_flower-fix-port-range-parsing.patch @@ -0,0 +1,36 @@ +From 9ce12b62181cfed8ddac855efb858f88ac036ce1 Mon Sep 17 00:00:00 2001 +From: Puneet Sharma +Date: Mon, 20 Sep 2021 11:00:01 -0400 +Subject: [PATCH] tc/f_flower: fix port range parsing + +Provided port range in tc rule are parsed incorrectly. +Even though range is passed as min-max. It throws an error. + +$ tc filter add dev eth0 ingress handle 100 priority 10000 protocol ipv4 flower ip_proto tcp dst_port 10368-61000 action pass +max value should be greater than min value +Illegal "dst_port" + +Fixes: 8930840e678b ("tc: flower: Classify packets based port ranges") +Signed-off-by: Puneet Sharma +Signed-off-by: Stephen Hemminger +Conflict: NA +--- + tc/f_flower.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tc/f_flower.c b/tc/f_flower.c +index 8f248db..e7f28c6 100644 +--- a/tc/f_flower.c ++++ b/tc/f_flower.c +@@ -717,7 +717,7 @@ static int flower_parse_port(char *str, __u8 ip_proto, + if (min && max) { + __be16 min_port_type, max_port_type; + +- if (max <= min) { ++ if (ntohs(max) <= ntohs(min)) { + fprintf(stderr, "max value should be greater than min value\n"); + return -1; + } +-- +1.8.3.1 + diff --git a/iproute.spec b/iproute.spec index e1bbab0..21f1240 100644 --- a/iproute.spec +++ b/iproute.spec @@ -1,7 +1,7 @@ #needsrootforbuild Name: iproute Version: 5.5.0 -Release: 6 +Release: 7 Summary: Linux network configuration utilities License: GPLv2+ and Public Domain URL: https://kernel.org/pub/linux/utils/net/iproute2/ @@ -23,6 +23,8 @@ Patch9003: feature-iproute-add-support-for-ipvlan-l2e-mode.patch Patch9004: feature-peer_notify_delay-renamed-to-peer_notif_delay.patch Patch9005: bugfix-iproute-support-assume-default-route.patch Patch9006: bugfix-iproute2-cancel-some-test-cases.patch +Patch9007: bugfix-iproute2-lib-bpf-fix-bpffs-mount-when-sys-fs-bpf-exist.patch +Patch9008: bugfix-iproute2-tc-f_flower-fix-port-range-parsing.patch BuildRequires: gcc bison elfutils-libelf-devel flex iptables-devel libcap-devel BuildRequires: libdb-devel libmnl-devel libselinux-devel pkgconfig git sudo @@ -98,6 +100,13 @@ install -m 0644 lib/libnetlink.a %{buildroot}%{_libdir}/libnetlink.a %{_mandir}/* %changelog +* Fri Oct 29 2021 chengyechun - 5.5.0-7 +104 - Type:bugfix +105 - Id:NA +106 - SUG:NA +107 - DESC:lib/bpf:fix bpffs mount when /sys/fs/bpf exists + tc/f_flower:fix port range parsing + * Sun Sep 26 2021 jiangheng - 5.5.0-6 - Type:bugfix - Id:NA -- Gitee