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