From 546109a7cf16921112fd9752eea02ce14cd32f16 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 6 Mar 2019 12:04:00 +0100 Subject: [PATCH 01/10] iprule: fix printing hint about unresolved iifname and oifname was displayed as 10: from all iif eth1 [detached] goto 10000unresolved proto mrt now: 10: from all iif eth1 [detached] goto 10000 [unresolved] proto mrt Fixes: 0dd4ccc56c0e ("iprule: add json support") Signed-off-by: Thomas Haller Signed-off-by: Stephen Hemminger --- ip/iprule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/iprule.c b/ip/iprule.c index 4e9437de..83aef38e 100644 --- a/ip/iprule.c +++ b/ip/iprule.c @@ -455,7 +455,8 @@ int print_rule(struct nlmsghdr *n, void *arg) print_string(PRINT_ANY, "goto", "goto %s", "none"); if (frh->flags & FIB_RULE_UNRESOLVED) - print_null(PRINT_ANY, "unresolved", "unresolved", NULL); + print_null(PRINT_ANY, "unresolved", + " [unresolved]", NULL); } else if (frh->action == FR_ACT_NOP) { print_null(PRINT_ANY, "nop", "nop", NULL); } else if (frh->action != FR_ACT_TO_TBL) { From f36f8fe535c97f521cc76c2ceae06c2b6443ad98 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 15 Mar 2019 08:30:26 -0700 Subject: [PATCH 02/10] ipaddress: print error message on stderr Convention is to print error messages only on stderr. Helps when scripting. Signed-off-by: Stephen Hemminger --- ip/ipaddress.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 76edf706..b504200b 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -174,7 +174,9 @@ static void print_queuelen(FILE *f, struct rtattr *tb[IFLA_MAX + 1]) strcpy(ifr.ifr_name, rta_getattr_str(tb[IFLA_IFNAME])); if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) { - fprintf(f, "ioctl(SIOCGIFTXQLEN) failed: %s\n", strerror(errno)); + fprintf(stderr, + "ioctl(SIOCGIFTXQLEN) failed: %s\n", + strerror(errno)); close(s); return; } From ef1e02e6ac6b024d7b9d4657a0aaa1e6f1ba3ed7 Mon Sep 17 00:00:00 2001 From: Kevin 'ldir' Darbyshire-Bryant Date: Fri, 15 Mar 2019 10:50:45 +0000 Subject: [PATCH 03/10] tc: m_connmark: fix action error messages action m_connmark returns error messages identifying itself as the 'simple' action instead of 'connmark' action. e.g. tc filter add dev eth0 protocol all u32 match u32 0 0 flowid 1:1 \ action connmark index wrong simple: Illegal "index" bad action parsing parse_action: bad value (3:connmark)! Illegal "action" In what is most likely a copy/paste error from the simple action example code, fix connmark error messages to identify themselves as coming from connmark. tc filter add dev eth0 protocol all u32 match u32 0 0 flowid 1:1 \ action connmark index wrong connmark: Illegal "index" bad action parsing parse_action: bad value (3:connmark)! Illegal "action" While we're here also fixup the 'Illegal "Zone"' error code to say 'Illegal "zone"' instead of 'Illegal "index"' Signed-off-by: Kevin Darbyshire-Bryant Signed-off-by: Stephen Hemminger --- tc/m_connmark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/m_connmark.c b/tc/m_connmark.c index 45e2d05f..13543d33 100644 --- a/tc/m_connmark.c +++ b/tc/m_connmark.c @@ -73,7 +73,7 @@ parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, if (matches(*argv, "zone") == 0) { NEXT_ARG(); if (get_u16(&sel.zone, *argv, 10)) { - fprintf(stderr, "simple: Illegal \"index\"\n"); + fprintf(stderr, "connmark: Illegal \"zone\"\n"); return -1; } argc--; @@ -87,7 +87,7 @@ parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, if (matches(*argv, "index") == 0) { NEXT_ARG(); if (get_u32(&sel.index, *argv, 10)) { - fprintf(stderr, "simple: Illegal \"index\"\n"); + fprintf(stderr, "connmark: Illegal \"index\"\n"); return -1; } argc--; From 073661773872709518d35d4d093f3a715281f21d Mon Sep 17 00:00:00 2001 From: Matteo Croce Date: Mon, 18 Mar 2019 18:19:29 +0100 Subject: [PATCH 04/10] ip route: print route type in JSON output ip route generates an invalid JSON if the route type has to be printed, eg. when detailed mode is active, or the type is different that unicast: $ ip -d -j -p route show [ {"unicast", "dst": "192.168.122.0/24", "dev": "virbr0", "protocol": "kernel", "scope": "link", "prefsrc": "192.168.122.1", "flags": [ "linkdown" ] } ] $ ip -j -p route show [ {"unreachable", "dst": "192.168.23.0/24", "flags": [ ] },{"prohibit", "dst": "192.168.24.0/24", "flags": [ ] },{"blackhole", "dst": "192.168.25.0/24", "flags": [ ] } ] Fix it by printing the route type as the "type" attribute: $ ip -d -j -p route show [ { "type": "unicast", "dst": "default", "gateway": "192.168.85.1", "dev": "wlp3s0", "protocol": "dhcp", "scope": "global", "metric": 600, "flags": [ ] },{ "type": "unreachable", "dst": "192.168.23.0/24", "protocol": "boot", "scope": "global", "flags": [ ] },{ "type": "prohibit", "dst": "192.168.24.0/24", "protocol": "boot", "scope": "global", "flags": [ ] },{ "type": "blackhole", "dst": "192.168.25.0/24", "protocol": "boot", "scope": "global", "flags": [ ] } ] Fixes: 663c3cb23103 ("iproute: implement JSON and color output") Acked-by: Phil Sutter Reviewed-and-tested-by: Andrea Claudi Signed-off-by: Matteo Croce Signed-off-by: Stephen Hemminger --- ip/iproute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/iproute.c b/ip/iproute.c index cc02a3e1..e091927b 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -766,7 +766,7 @@ int print_route(struct nlmsghdr *n, void *arg) if ((r->rtm_type != RTN_UNICAST || show_details > 0) && (!filter.typemask || (filter.typemask & (1 << r->rtm_type)))) - print_string(PRINT_ANY, NULL, "%s ", + print_string(PRINT_ANY, "type", "%s ", rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1))); color = COLOR_NONE; From a0a639d9c002d957ce9d5547c806919cbffa3834 Mon Sep 17 00:00:00 2001 From: Matteo Croce Date: Mon, 18 Mar 2019 18:19:30 +0100 Subject: [PATCH 05/10] ip route: get: print JSON output when -j is given The ip -j option to print output as JSON is ignored when using 'route get': $ ip -j route get 127.0.0.1 local 127.0.0.1 dev lo src 127.0.0.1 uid 1000 cache Enable JSON output in iproute_get(), and don't let print_cache_flags() close the JSON output, as it's not always the last called JSON function. Tested on different route types: $ ip -j -p route get 127.0.0.1 [ { "type": "local", "dst": "127.0.0.1", "dev": "lo", "prefsrc": "127.0.0.1", "flags": [ ], "uid": 1000, "cache": [ "local" ] } ] $ ip -d -j -p route get 192.0.2.1 [ { "type": "unicast", "dst": "192.0.2.1", "gateway": "192.168.85.1", "dev": "wlp3s0", "table": "main", "prefsrc": "192.168.85.2", "flags": [ ], "uid": 1000, "cache": [ ] } ] Fixes: 663c3cb23103 ("iproute: implement JSON and color output") Acked-by: Phil Sutter Reviewed-and-tested-by: Andrea Claudi Signed-off-by: Matteo Croce Signed-off-by: Stephen Hemminger --- ip/iproute.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ip/iproute.c b/ip/iproute.c index e091927b..2b3dcc5d 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -450,10 +450,8 @@ static void print_cache_flags(FILE *fp, __u32 flags) if (flags) print_hex(PRINT_ANY, "flags", "%x>", flags); - if (jw) { + if (jw) jsonw_end_array(jw); - jsonw_destroy(&jw); - } } static void print_rta_cacheinfo(FILE *fp, const struct rta_cacheinfo *ci) @@ -2079,6 +2077,8 @@ static int iproute_get(int argc, char **argv) if (rtnl_talk(&rth, &req.n, &answer) < 0) return -2; + new_json_obj(json); + if (connected && !from_ok) { struct rtmsg *r = NLMSG_DATA(answer); int len = answer->nlmsg_len; @@ -2123,6 +2123,7 @@ static int iproute_get(int argc, char **argv) req.n.nlmsg_flags = NLM_F_REQUEST; req.n.nlmsg_type = RTM_GETROUTE; + delete_json_obj(); free(answer); if (rtnl_talk(&rth, &req.n, &answer) < 0) return -2; @@ -2134,6 +2135,7 @@ static int iproute_get(int argc, char **argv) return -1; } + delete_json_obj(); free(answer); return 0; } From 93d0d92f615a853fe5423d36e9a2ef2c1fee9e52 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 19 Mar 2019 10:06:19 -0700 Subject: [PATCH 06/10] v5.0.0 --- include/SNAPSHOT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SNAPSHOT.h b/include/SNAPSHOT.h index e9d546d0..3b2f8f1b 100644 --- a/include/SNAPSHOT.h +++ b/include/SNAPSHOT.h @@ -1 +1 @@ -static const char SNAPSHOT[] = "190107"; +static const char SNAPSHOT[] = "190319"; From 8e1554625d243e70094d7d15c382d5ff891228a5 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 19 Mar 2019 10:34:32 -0700 Subject: [PATCH 07/10] rdma: update uapi headers from 5.1-rc1 Update from upstream. Signed-off-by: Stephen Hemminger --- rdma/include/uapi/rdma/ib_user_verbs.h | 2 ++ rdma/include/uapi/rdma/rdma_netlink.h | 10 ++++++++-- rdma/include/uapi/rdma/rdma_user_cm.h | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/rdma/include/uapi/rdma/ib_user_verbs.h b/rdma/include/uapi/rdma/ib_user_verbs.h index 480d9a60..0474c740 100644 --- a/rdma/include/uapi/rdma/ib_user_verbs.h +++ b/rdma/include/uapi/rdma/ib_user_verbs.h @@ -270,6 +270,8 @@ struct ib_uverbs_ex_query_device_resp { struct ib_uverbs_tm_caps tm_caps; struct ib_uverbs_cq_moderation_caps cq_moderation_caps; __aligned_u64 max_dm_size; + __u32 xrc_odp_caps; + __u32 reserved; }; struct ib_uverbs_query_port { diff --git a/rdma/include/uapi/rdma/rdma_netlink.h b/rdma/include/uapi/rdma/rdma_netlink.h index 5027c627..23a90ad5 100644 --- a/rdma/include/uapi/rdma/rdma_netlink.h +++ b/rdma/include/uapi/rdma/rdma_netlink.h @@ -255,9 +255,11 @@ enum rdma_nldev_command { RDMA_NLDEV_CMD_GET, /* can dump */ RDMA_NLDEV_CMD_SET, - /* 3 - 4 are free to use */ + RDMA_NLDEV_CMD_NEWLINK, - RDMA_NLDEV_CMD_PORT_GET = 5, /* can dump */ + RDMA_NLDEV_CMD_DELLINK, + + RDMA_NLDEV_CMD_PORT_GET, /* can dump */ /* 6 - 8 are free to use */ @@ -465,6 +467,10 @@ enum rdma_nldev_attr { RDMA_NLDEV_ATTR_RES_MRN, /* u32 */ RDMA_NLDEV_ATTR_RES_CM_IDN, /* u32 */ RDMA_NLDEV_ATTR_RES_CTXN, /* u32 */ + /* + * Identifies the rdma driver. eg: "rxe" or "siw" + */ + RDMA_NLDEV_ATTR_LINK_TYPE, /* string */ /* * Always the end diff --git a/rdma/include/uapi/rdma/rdma_user_cm.h b/rdma/include/uapi/rdma/rdma_user_cm.h index 0d1e78eb..e42940a2 100644 --- a/rdma/include/uapi/rdma/rdma_user_cm.h +++ b/rdma/include/uapi/rdma/rdma_user_cm.h @@ -300,6 +300,10 @@ enum { RDMA_OPTION_ID_TOS = 0, RDMA_OPTION_ID_REUSEADDR = 1, RDMA_OPTION_ID_AFONLY = 2, + RDMA_OPTION_ID_ACK_TIMEOUT = 3 +}; + +enum { RDMA_OPTION_IB_PATH = 1 }; From a7cd7badedcb643dc1adb41edeb4cf8e4d9ec063 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 19 Mar 2019 10:36:56 -0700 Subject: [PATCH 08/10] uapi: add CAKE FWMARK Signed-off-by: Stephen Hemminger --- include/uapi/linux/pkt_sched.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 1eb572ef..7ee74c34 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -1021,6 +1021,7 @@ enum { TCA_CAKE_INGRESS, TCA_CAKE_ACK_FILTER, TCA_CAKE_SPLIT_GSO, + TCA_CAKE_FWMARK, __TCA_CAKE_MAX }; #define TCA_CAKE_MAX (__TCA_CAKE_MAX - 1) From 828132fdd1a48472b86e891b0e6c75b46ddb8279 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 19 Mar 2019 10:37:28 -0700 Subject: [PATCH 09/10] uapi: in6.h add router alert isolate Signed-off-by: Stephen Hemminger --- include/uapi/linux/in6.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h index 2bb132a9..d016ac9f 100644 --- a/include/uapi/linux/in6.h +++ b/include/uapi/linux/in6.h @@ -178,6 +178,7 @@ struct in6_flowlabel_req { #define IPV6_JOIN_ANYCAST 27 #define IPV6_LEAVE_ANYCAST 28 #define IPV6_MULTICAST_ALL 29 +#define IPV6_ROUTER_ALERT_ISOLATE 30 /* IPV6_MTU_DISCOVER values */ #define IPV6_PMTUDISC_DONT 0 From dd4a2b68333eb82c18af46956a36a9c39728c390 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 19 Mar 2019 10:37:55 -0700 Subject: [PATCH 10/10] uapi: bpf add set_ce New api from upstream. Signed-off-by: Stephen Hemminger --- include/uapi/linux/bpf.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index b7b748f1..a857878f 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -2359,6 +2359,13 @@ union bpf_attr { * Return * A **struct bpf_tcp_sock** pointer on success, or NULL in * case of failure. + * + * int bpf_skb_ecn_set_ce(struct sk_buf *skb) + * Description + * Sets ECN of IP header to ce (congestion encountered) if + * current value is ect (ECN capable). Works with IPv6 and IPv4. + * Return + * 1 if set, 0 if not set. */ #define __BPF_FUNC_MAPPER(FN) \ FN(unspec), \ @@ -2457,7 +2464,8 @@ union bpf_attr { FN(spin_lock), \ FN(spin_unlock), \ FN(sk_fullsock), \ - FN(tcp_sock), + FN(tcp_sock), \ + FN(skb_ecn_set_ce), /* integer value in 'imm' field of BPF_CALL instruction selects which helper * function eBPF program intends to call @@ -2813,6 +2821,8 @@ struct bpf_prog_info { __u32 jited_line_info_rec_size; __u32 nr_prog_tags; __aligned_u64 prog_tags; + __u64 run_time_ns; + __u64 run_cnt; } __attribute__((aligned(8))); struct bpf_map_info {