|
|
318a74 |
From b83b0767eccfb386406ccb24130b975f1c2b0ee4 Mon Sep 17 00:00:00 2001
|
|
|
318a74 |
From: Phil Sutter <psutter@redhat.com>
|
|
|
318a74 |
Date: Thu, 21 Feb 2019 14:39:47 +0100
|
|
|
318a74 |
Subject: [PATCH] ip-route: Fix nexthop encap parsing
|
|
|
318a74 |
|
|
|
318a74 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1624656
|
|
|
318a74 |
Upstream Status: iproute2.git commit 05d978e0850a6
|
|
|
318a74 |
Conflicts: Some chunks dropped due to missing support for
|
|
|
318a74 |
ident-type and hook-type.
|
|
|
318a74 |
|
|
|
318a74 |
commit 05d978e0850a6a3bae1e6c5392d82f7b1496f86a
|
|
|
318a74 |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
318a74 |
Date: Tue Nov 13 13:39:04 2018 +0100
|
|
|
318a74 |
|
|
|
318a74 |
ip-route: Fix nexthop encap parsing
|
|
|
318a74 |
|
|
|
318a74 |
When parsing nexthop parameters, a buffer of 4k bytes is provided. Yet,
|
|
|
318a74 |
in lwt_parse_encap() and some functions called by it, buffer size was
|
|
|
318a74 |
assumed to be 1k despite the actual size was provided. This led to
|
|
|
318a74 |
spurious buffer size errors if the buffer was filled by previous nexthop
|
|
|
318a74 |
parameters to exceed that 1k boundary.
|
|
|
318a74 |
|
|
|
318a74 |
Fixes: 1e5293056a02c ("lwtunnel: Add encapsulation support to ip route")
|
|
|
318a74 |
Fixes: 5866bddd9aa9e ("ila: Add support for ILA lwtunnels")
|
|
|
318a74 |
Fixes: ed67f83806538 ("ila: Support for checksum neutral translation")
|
|
|
318a74 |
Fixes: 86905c8f057c0 ("ila: support for configuring identifier and hook types")
|
|
|
318a74 |
Fixes: b15f440e78373 ("lwt: BPF support for LWT")
|
|
|
318a74 |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
318a74 |
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
|
|
|
318a74 |
---
|
|
|
318a74 |
ip/iproute_lwtunnel.c | 10 +++++-----
|
|
|
318a74 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
318a74 |
|
|
|
318a74 |
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
|
|
|
d30c09 |
index 1a6891267d2e1..b6f08f073ef02 100644
|
|
|
318a74 |
--- a/ip/iproute_lwtunnel.c
|
|
|
318a74 |
+++ b/ip/iproute_lwtunnel.c
|
|
|
318a74 |
@@ -343,7 +343,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
|
|
|
318a74 |
|
|
|
318a74 |
argc--; argv++;
|
|
|
318a74 |
|
|
|
318a74 |
- if (rta_addattr64(rta, 1024, ILA_ATTR_LOCATOR, locator))
|
|
|
318a74 |
+ if (rta_addattr64(rta, len, ILA_ATTR_LOCATOR, locator))
|
|
|
318a74 |
return -1;
|
|
|
318a74 |
|
|
|
318a74 |
while (argc > 0) {
|
|
|
318a74 |
@@ -357,7 +357,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
|
|
|
318a74 |
invarg("\"csum-mode\" value is invalid\n",
|
|
|
318a74 |
*argv);
|
|
|
318a74 |
|
|
|
318a74 |
- ret = rta_addattr8(rta, 1024, ILA_ATTR_CSUM_MODE,
|
|
|
318a74 |
+ ret = rta_addattr8(rta, len, ILA_ATTR_CSUM_MODE,
|
|
|
318a74 |
(__u8)csum_mode);
|
|
|
318a74 |
|
|
|
318a74 |
argc--; argv++;
|
|
|
318a74 |
@@ -528,7 +528,7 @@ static int parse_encap_bpf(struct rtattr *rta, size_t len, int *argcp,
|
|
|
318a74 |
if (get_unsigned(&headroom, *argv, 0) || headroom == 0)
|
|
|
318a74 |
invarg("headroom is invalid\n", *argv);
|
|
|
318a74 |
if (!headroom_set)
|
|
|
318a74 |
- rta_addattr32(rta, 1024, LWT_BPF_XMIT_HEADROOM,
|
|
|
318a74 |
+ rta_addattr32(rta, len, LWT_BPF_XMIT_HEADROOM,
|
|
|
318a74 |
headroom);
|
|
|
318a74 |
headroom_set = 1;
|
|
|
318a74 |
} else if (strcmp(*argv, "help") == 0) {
|
|
|
318a74 |
@@ -569,7 +569,7 @@ int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp)
|
|
|
318a74 |
exit(-1);
|
|
|
318a74 |
}
|
|
|
318a74 |
|
|
|
318a74 |
- nest = rta_nest(rta, 1024, RTA_ENCAP);
|
|
|
318a74 |
+ nest = rta_nest(rta, len, RTA_ENCAP);
|
|
|
318a74 |
switch (type) {
|
|
|
318a74 |
case LWTUNNEL_ENCAP_MPLS:
|
|
|
318a74 |
ret = parse_encap_mpls(rta, len, &argc, &argv);
|
|
|
318a74 |
@@ -596,7 +596,7 @@ int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp)
|
|
|
318a74 |
|
|
|
318a74 |
rta_nest_end(rta, nest);
|
|
|
318a74 |
|
|
|
318a74 |
- ret = rta_addattr16(rta, 1024, RTA_ENCAP_TYPE, type);
|
|
|
318a74 |
+ ret = rta_addattr16(rta, len, RTA_ENCAP_TYPE, type);
|
|
|
318a74 |
|
|
|
318a74 |
*argcp = argc;
|
|
|
318a74 |
*argvp = argv;
|
|
|
318a74 |
--
|
|
|
d30c09 |
2.21.0
|
|
|
318a74 |
|