From 6cd959bb125c50a04ab6671645fa38c5b07426f4 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 13 Nov 2018 16:55:13 +0100 Subject: [PATCH 1/3] man: ip-route.8: Document nexthop limit Add a note to 'nexthop' description stating the maximum number of nexthops per command and pointing at 'append' command as a workaround. Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- man/man8/ip-route.8.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in index a33ce1f0..11dd4ca7 100644 --- a/man/man8/ip-route.8.in +++ b/man/man8/ip-route.8.in @@ -589,6 +589,15 @@ argument lists: route reflecting its relative bandwidth or quality. .in -8 +The internal buffer used in iproute2 limits the maximum number of nexthops that +may be specified in one go. If only +.I ADDRESS +is given, the current buffer size allows for 144 IPv6 nexthops and 253 IPv4 +ones. For IPv4, this effectively limits the number of nexthops possible per +route. With IPv6, further nexthops may be appended to the same route via +.B "ip route append" +command. + .TP .BI scope " SCOPE_VAL" the scope of the destinations covered by the route prefix. From 7e2f71b431bbde1d040a524731e9b210fd905de2 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 12 Nov 2018 08:39:32 -0800 Subject: [PATCH 2/3] testsuite: colorize test result output When running testsuite it is easy as a human to miss failure. Add symbol colorizing to SKIPED/PASS/FAIL output. Signed-off-by: Stephen Hemminger --- testsuite/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/Makefile b/testsuite/Makefile index b3aebec1..46b243b0 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -85,11 +85,11 @@ endif TC="$$i/tc/tc" IP="$$i/ip/ip" SS=$$i/misc/ss DEV="$(DEV)" IPVER="$@" SNAME="$$i" \ ERRF="$(RESULTS_DIR)/$@.$$o.err" $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \ if [ "$$?" = "127" ]; then \ - echo "SKIPPED"; \ + echo "\e[1;35mSKIPPED\e[0m"; \ elif [ -e "$(RESULTS_DIR)/$@.$$o.err" ]; then \ - echo "FAILED"; \ + echo "\e[0;31mFAILED\e[0m"; \ else \ - echo "PASS"; \ + echo "\e[0;32mPASS\e[0m"; \ fi; \ rm "$$TMP_ERR" "$$TMP_OUT"; \ sudo dmesg > $(RESULTS_DIR)/$@.$$o.dmesg; \ From 05d978e0850a6a3bae1e6c5392d82f7b1496f86a Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 13 Nov 2018 13:39:04 +0100 Subject: [PATCH 3/3] ip-route: Fix nexthop encap parsing When parsing nexthop parameters, a buffer of 4k bytes is provided. Yet, in lwt_parse_encap() and some functions called by it, buffer size was assumed to be 1k despite the actual size was provided. This led to spurious buffer size errors if the buffer was filled by previous nexthop parameters to exceed that 1k boundary. Fixes: 1e5293056a02c ("lwtunnel: Add encapsulation support to ip route") Fixes: 5866bddd9aa9e ("ila: Add support for ILA lwtunnels") Fixes: ed67f83806538 ("ila: Support for checksum neutral translation") Fixes: 86905c8f057c0 ("ila: support for configuring identifier and hook types") Fixes: b15f440e78373 ("lwt: BPF support for LWT") Signed-off-by: Phil Sutter Signed-off-by: Stephen Hemminger --- ip/iproute_lwtunnel.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c index 8f497015..85ab13cb 100644 --- a/ip/iproute_lwtunnel.c +++ b/ip/iproute_lwtunnel.c @@ -860,7 +860,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len, argc--; argv++; - if (rta_addattr64(rta, 1024, ILA_ATTR_LOCATOR, locator)) + if (rta_addattr64(rta, len, ILA_ATTR_LOCATOR, locator)) return -1; while (argc > 0) { @@ -874,7 +874,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len, invarg("\"csum-mode\" value is invalid\n", *argv); - ret = rta_addattr8(rta, 1024, ILA_ATTR_CSUM_MODE, + ret = rta_addattr8(rta, len, ILA_ATTR_CSUM_MODE, (__u8)csum_mode); argc--; argv++; @@ -888,7 +888,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len, invarg("\"ident-type\" value is invalid\n", *argv); - ret = rta_addattr8(rta, 1024, ILA_ATTR_IDENT_TYPE, + ret = rta_addattr8(rta, len, ILA_ATTR_IDENT_TYPE, (__u8)ident_type); argc--; argv++; @@ -902,7 +902,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len, invarg("\"hook-type\" value is invalid\n", *argv); - ret = rta_addattr8(rta, 1024, ILA_ATTR_HOOK_TYPE, + ret = rta_addattr8(rta, len, ILA_ATTR_HOOK_TYPE, (__u8)hook_type); argc--; argv++; @@ -1034,7 +1034,7 @@ static int parse_encap_bpf(struct rtattr *rta, size_t len, int *argcp, if (get_unsigned(&headroom, *argv, 0) || headroom == 0) invarg("headroom is invalid\n", *argv); if (!headroom_set) - rta_addattr32(rta, 1024, LWT_BPF_XMIT_HEADROOM, + rta_addattr32(rta, len, LWT_BPF_XMIT_HEADROOM, headroom); headroom_set = 1; } else if (strcmp(*argv, "help") == 0) { @@ -1075,7 +1075,7 @@ int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp) exit(-1); } - nest = rta_nest(rta, 1024, RTA_ENCAP); + nest = rta_nest(rta, len, RTA_ENCAP); switch (type) { case LWTUNNEL_ENCAP_MPLS: ret = parse_encap_mpls(rta, len, &argc, &argv); @@ -1108,7 +1108,7 @@ int lwt_parse_encap(struct rtattr *rta, size_t len, int *argcp, char ***argvp) rta_nest_end(rta, nest); - ret = rta_addattr16(rta, 1024, RTA_ENCAP_TYPE, type); + ret = rta_addattr16(rta, len, RTA_ENCAP_TYPE, type); *argcp = argc; *argvp = argv;