diff --git a/SOURCES/0009-iproute-force-rtm_dst_len-to-32-128.patch b/SOURCES/0009-iproute-force-rtm_dst_len-to-32-128.patch new file mode 100644 index 0000000..c5aee30 --- /dev/null +++ b/SOURCES/0009-iproute-force-rtm_dst_len-to-32-128.patch @@ -0,0 +1,67 @@ +From f2cb0f1570ca603c5d92d6a7d87596d07fdb01cd Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: +References: +From: Andrea Claudi +Date: Tue, 9 Feb 2021 12:00:58 +0100 +Subject: [PATCH] iproute: force rtm_dst_len to 32/128 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1852038 +Upstream Status: unknown commit 5a37254b + +commit 5a37254b71249bfb73d44d6278d767a6b127a2f9 +Author: Luca Boccassi +Date: Sun Jan 24 17:36:58 2021 +0000 + + iproute: force rtm_dst_len to 32/128 + + Since NETLINK_GET_STRICT_CHK was enabled, the kernel rejects commands + that pass a prefix length, eg: + + ip route get `1.0.0.0/1 + Error: ipv4: Invalid values in header for route get request. + ip route get 0.0.0.0/0 + Error: ipv4: rtm_src_len and rtm_dst_len must be 32 for IPv4 + + Since there's no point in setting a rtm_dst_len that we know is going + to be rejected, just force it to the right value if it's passed on + the command line. Print a warning to stderr to notify users. + + Bug-Debian: https://bugs.debian.org/944730 + Reported-By: Clément 'wxcafé' Hertling + Signed-off-by: Luca Boccassi + Signed-off-by: Stephen Hemminger +--- + ip/iproute.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/ip/iproute.c b/ip/iproute.c +index 05ec2c29..1f3c347e 100644 +--- a/ip/iproute.c ++++ b/ip/iproute.c +@@ -2067,7 +2067,18 @@ static int iproute_get(int argc, char **argv) + if (addr.bytelen) + addattr_l(&req.n, sizeof(req), + RTA_DST, &addr.data, addr.bytelen); +- req.r.rtm_dst_len = addr.bitlen; ++ if (req.r.rtm_family == AF_INET && addr.bitlen != 32) { ++ fprintf(stderr, ++ "Warning: /%u as prefix is invalid, only /32 (or none) is supported.\n", ++ addr.bitlen); ++ req.r.rtm_dst_len = 32; ++ } else if (req.r.rtm_family == AF_INET6 && addr.bitlen != 128) { ++ fprintf(stderr, ++ "Warning: /%u as prefix is invalid, only /128 (or none) is supported.\n", ++ addr.bitlen); ++ req.r.rtm_dst_len = 128; ++ } else ++ req.r.rtm_dst_len = addr.bitlen; + address_found = true; + } + argc--; argv++; +-- +2.29.2 + diff --git a/SPECS/iproute.spec b/SPECS/iproute.spec index 4d1ebdc..641bf33 100644 --- a/SPECS/iproute.spec +++ b/SPECS/iproute.spec @@ -1,5 +1,5 @@ %define rpmversion 5.9.0 -%define specrelease 2%{?dist} +%define specrelease 3%{?dist} %define pkg_release %{specrelease}%{?buildid} Summary: Advanced IP routing and network device configuration tools @@ -18,6 +18,7 @@ Patch4: 0005-m_mpls-test-the-mac_push-action-after-modify.patch Patch5: 0006-tc-vlan-fix-help-and-error-message-strings.patch Patch6: 0007-tc-mpls-fix-manpage-example-and-help-message-string.patch Patch7: 0008-tc-flower-fix-json-output-with-mpls-lse.patch +Patch8: 0009-iproute-force-rtm_dst_len-to-32-128.patch License: GPLv2+ and Public Domain BuildRequires: bison BuildRequires: elfutils-libelf-devel @@ -150,6 +151,9 @@ cat %{SOURCE1} >>%{buildroot}%{_sysconfdir}/iproute2/rt_dsfield %{_includedir}/iproute2/bpf_elf.h %changelog +* Tue Feb 09 2021 Andrea Claudi [5.9.0-3.el8] +- iproute: force rtm_dst_len to 32/128 (Andrea Claudi) [1852038] + * Thu Jan 28 2021 Andrea Claudi [5.9.0-2.el8] - tc: flower: fix json output with mpls lse (Andrea Claudi) [1885770] - tc-mpls: fix manpage example and help message string (Andrea Claudi) [1885770]