From 2f103545a5454bcdb3fa3ee9075a1ed5acd7f5f3 Mon Sep 17 00:00:00 2001 From: Dmytro Linkin Date: Wed, 27 Feb 2019 12:10:17 +0000 Subject: [PATCH 1/2] tc/pedit: Fix wrong pedit ipv6 structure id Tc pedit action with more than two ip6 munge in a row cause infinite loop. Example: $ tc filter add dev eth0 protocol ipv6 parent ffff: \ flower ip_proto sctp \ action pedit ex \ munge ip6 hoplimit set 0x1 \ munge ip6 src set 2001:0db8:0:f101::1 \ munge that cause infinite loop The example command never returns, instead of failing with parse error as expected. Pedit ipv6 structure has wrong id, which leads to the creation linked list with one node in tc/m_pedit.c:get_pedit_kind(), referring to itself. This node is created if command have two ip6 munge in a row, and any third ip6 munge will cause infinite loop. Changing this id from "ipv6" to "ip6" solves the problem. Fixes: f3e1b2448a95 ("pedit: Introduce ipv6 support") Signed-off-by: Dmytro Linkin Reviewed-by: Roi Dayan Signed-off-by: Stephen Hemminger --- tc/p_ip6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/p_ip6.c b/tc/p_ip6.c index dbfdca42..7cc7997b 100644 --- a/tc/p_ip6.c +++ b/tc/p_ip6.c @@ -84,6 +84,6 @@ done: } struct m_pedit_util p_pedit_ip6 = { - .id = "ipv6", + .id = "ip6", .parse_peopt = parse_ip6, }; From 8b5f9338e549cf06a3fa94c14b3a0b61ae8c3eca Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Thu, 21 Feb 2019 16:04:01 +0100 Subject: [PATCH 2/2] man: Document COLORFGBG environment variable Default colors are not contrast enough on dark backround and this functionality, which uses more suitable colors is hidden in the code. Signed-off-by: Petr Vorel --- man/man8/ip.8 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/man/man8/ip.8 b/man/man8/ip.8 index 84ade110..133d40d5 100644 --- a/man/man8/ip.8 +++ b/man/man8/ip.8 @@ -189,6 +189,12 @@ precedence. This flag is ignored if .B \-json is also given. +Used color palette can be influenced by +.BR COLORFGBG +environment variable +(see +.BR ENVIRONMENT ). + .TP .BR "\-t" , " \-timestamp" display current time when using monitor option. @@ -330,6 +336,17 @@ Usually it is or, if the objects of this class cannot be listed, .BR "help" . +.SH ENVIRONMENT +.TP +.B COLORFGBG +If set, it's value is used for detection whether background is dark or light and use contrast colors for it. + +COLORFGBG environment variable usually contains either two or three +values separated by semicolons; we want the last value in either case. +If this value is 0-6 or 8, chose colors suitable for dark background: + +COLORFGBG=";0" ip -c a + .SH EXIT STATUS Exit status is 0 if command was successful, and 1 if there is a syntax error. If an error was reported by the kernel exit status is 2.