From 66702fb9baf277b2eb6d44a7983d5333ca2a0a2c Mon Sep 17 00:00:00 2001 From: Jamie Gloudon Date: Fri, 17 Jul 2020 11:05:30 -0400 Subject: [PATCH 01/10] tc/m_estimator: Print proper value for estimator interval in raw. While looking at the estimator code, I noticed an incorrect interval number printed in raw for the handles. This patch fixes the formatting. Before patch: root@bytecenter.fr:~# tc -r filter add dev eth0 ingress estimator 250ms 999ms matchall action police avrate 12mbit conform-exceed drop [estimator i=4294967294 e=2] After patch: root@bytecenter.fr:~# tc -r filter add dev eth0 ingress estimator 250ms 999ms matchall action police avrate 12mbit conform-exceed drop [estimator i=-2 e=2] Signed-off-by: Jamie Gloudon Signed-off-by: Stephen Hemminger --- tc/m_estimator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tc/m_estimator.c b/tc/m_estimator.c index ef62e1bb..b5f4c860 100644 --- a/tc/m_estimator.c +++ b/tc/m_estimator.c @@ -57,7 +57,7 @@ int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est) return -1; } if (show_raw) - fprintf(stderr, "[estimator i=%u e=%u]\n", est->interval, est->ewma_log); + fprintf(stderr, "[estimator i=%hhd e=%u]\n", est->interval, est->ewma_log); *p_argc = argc; *p_argv = argv; return 0; From 8f5a602f7afce40fcb988316157dbc45ebbf491d Mon Sep 17 00:00:00 2001 From: Anton Danilov Date: Thu, 9 Jul 2020 18:03:43 +0300 Subject: [PATCH 02/10] misc: make the pattern matching case-insensitive To improve the usability better use case-insensitive pattern-matching in ifstat, nstat and ss tools. Signed-off-by: Anton Danilov Signed-off-by: Stephen Hemminger --- man/man8/rtacct.8 | 7 +++++++ misc/ifstat.c | 2 +- misc/nstat.c | 2 +- misc/ss.c | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/man/man8/rtacct.8 b/man/man8/rtacct.8 index ccdbf6ca..988a6d1b 100644 --- a/man/man8/rtacct.8 +++ b/man/man8/rtacct.8 @@ -14,6 +14,13 @@ and .B rtacct are simple tools to monitor kernel snmp counters and network interface statistics. +.B nstat +can filter kernel snmp counters by name with one or several specified wildcards. Wildcards are case-insensitive and can include special symbols +.B ? +and +.B * +. + .SH OPTIONS .B \-h, \-\-help Print help diff --git a/misc/ifstat.c b/misc/ifstat.c index 60efe6cb..03327af8 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -104,7 +104,7 @@ static int match(const char *id) return 1; for (i = 0; i < npatterns; i++) { - if (!fnmatch(patterns[i], id, 0)) + if (!fnmatch(patterns[i], id, FNM_CASEFOLD)) return 1; } return 0; diff --git a/misc/nstat.c b/misc/nstat.c index 425e75ef..88f52eaf 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -114,7 +114,7 @@ static int match(const char *id) return 1; for (i = 0; i < npatterns; i++) { - if (!fnmatch(patterns[i], id, 0)) + if (!fnmatch(patterns[i], id, FNM_CASEFOLD)) return 1; } return 0; diff --git a/misc/ss.c b/misc/ss.c index f3d01812..5aa10e4a 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -1670,7 +1670,7 @@ static int unix_match(const inet_prefix *a, const inet_prefix *p) return 1; if (addr == NULL) addr = ""; - return !fnmatch(pattern, addr, 0); + return !fnmatch(pattern, addr, FNM_CASEFOLD); } static int run_ssfilter(struct ssfilter *f, struct sockstat *s) From 4735df15a2ea1cf83326addc2501cfadefee16e6 Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Fri, 17 Jul 2020 16:39:46 +0200 Subject: [PATCH 03/10] testsuite: Add tests for bareudp tunnels Test the plain MPLS (unicast and multicast) and IP (v4 and v6) modes. Also test the multiproto option for MPLS and for IP. Signed-off-by: Guillaume Nault Signed-off-by: Stephen Hemminger --- testsuite/tests/ip/link/add_type_bareudp.t | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100755 testsuite/tests/ip/link/add_type_bareudp.t diff --git a/testsuite/tests/ip/link/add_type_bareudp.t b/testsuite/tests/ip/link/add_type_bareudp.t new file mode 100755 index 00000000..8a2a1edf --- /dev/null +++ b/testsuite/tests/ip/link/add_type_bareudp.t @@ -0,0 +1,86 @@ +#!/bin/sh + +. lib/generic.sh + +ts_log "[Testing Add BareUDP interface (unicast MPLS)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (unicast MPLS)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype mpls_uc + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (unicast MPLS)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype mpls_uc" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (unicast MPLS)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (multicast MPLS)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (multicast MPLS)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype mpls_mc + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (multicast MPLS)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype mpls_mc" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (multicast MPLS)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (unicast and multicast MPLS)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (unicast and multicast MPLS)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype mpls_uc multiproto + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (unicast and multicast MPLS)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype mpls_uc" +test_on "multiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (unicast and multicast MPLS)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (IPv4)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (IPv4)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype ipv4 + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (IPv4)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype ip" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (IPv4)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (IPv6)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (IPv6)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype ipv6 + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (IPv6)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype ipv6" +test_on "nomultiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (IPv6)" link del dev $NEW_DEV + + +ts_log "[Testing Add BareUDP interface (IPv4 and IPv6)]" +NEW_DEV="$(rand_dev)" + +ts_ip "$0" "Add $NEW_DEV BareUDP interface (IPv4 and IPv6)" link add dev $NEW_DEV type bareudp dstport 6635 ethertype ipv4 multiproto + +ts_ip "$0" "Show $NEW_DEV BareUDP interface (IPv4 and IPv6)" -d link show dev $NEW_DEV +test_on "$NEW_DEV" +test_on "dstport 6635" +test_on "ethertype ip" +test_on "multiproto" + +ts_ip "$0" "Del $NEW_DEV BareUDP interface (IPv4 and IPv6)" link del dev $NEW_DEV From 848b1b8e0476830b2630c257e890933c1ed8d4fd Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 21 Jul 2020 09:18:15 -0700 Subject: [PATCH 04/10] uapi: update bpf.h Upstrean 5.8-rc6 changes. Signed-off-by: Stephen Hemminger --- include/uapi/linux/bpf.h | 41 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 4dfcb81b..f21232ed 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -3171,13 +3171,12 @@ union bpf_attr { * int bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) * Description * Copy *size* bytes from *data* into a ring buffer *ringbuf*. - * If BPF_RB_NO_WAKEUP is specified in *flags*, no notification of - * new data availability is sent. - * IF BPF_RB_FORCE_WAKEUP is specified in *flags*, notification of - * new data availability is sent unconditionally. + * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification + * of new data availability is sent. + * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification + * of new data availability is sent unconditionally. * Return - * 0, on success; - * < 0, on error. + * 0 on success, or a negative error in case of failure. * * void *bpf_ringbuf_reserve(void *ringbuf, u64 size, u64 flags) * Description @@ -3189,20 +3188,20 @@ union bpf_attr { * void bpf_ringbuf_submit(void *data, u64 flags) * Description * Submit reserved ring buffer sample, pointed to by *data*. - * If BPF_RB_NO_WAKEUP is specified in *flags*, no notification of - * new data availability is sent. - * IF BPF_RB_FORCE_WAKEUP is specified in *flags*, notification of - * new data availability is sent unconditionally. + * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification + * of new data availability is sent. + * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification + * of new data availability is sent unconditionally. * Return * Nothing. Always succeeds. * * void bpf_ringbuf_discard(void *data, u64 flags) * Description * Discard reserved ring buffer sample, pointed to by *data*. - * If BPF_RB_NO_WAKEUP is specified in *flags*, no notification of - * new data availability is sent. - * IF BPF_RB_FORCE_WAKEUP is specified in *flags*, notification of - * new data availability is sent unconditionally. + * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification + * of new data availability is sent. + * If **BPF_RB_FORCE_WAKEUP** is specified in *flags*, notification + * of new data availability is sent unconditionally. * Return * Nothing. Always succeeds. * @@ -3210,16 +3209,18 @@ union bpf_attr { * Description * Query various characteristics of provided ring buffer. What * exactly is queries is determined by *flags*: - * - BPF_RB_AVAIL_DATA - amount of data not yet consumed; - * - BPF_RB_RING_SIZE - the size of ring buffer; - * - BPF_RB_CONS_POS - consumer position (can wrap around); - * - BPF_RB_PROD_POS - producer(s) position (can wrap around); - * Data returned is just a momentary snapshots of actual values + * + * * **BPF_RB_AVAIL_DATA**: Amount of data not yet consumed. + * * **BPF_RB_RING_SIZE**: The size of ring buffer. + * * **BPF_RB_CONS_POS**: Consumer position (can wrap around). + * * **BPF_RB_PROD_POS**: Producer(s) position (can wrap around). + * + * Data returned is just a momentary snapshot of actual values * and could be inaccurate, so this facility should be used to * power heuristics and for reporting, not to make 100% correct * calculation. * Return - * Requested value, or 0, if flags are not recognized. + * Requested value, or 0, if *flags* are not recognized. * * int bpf_csum_level(struct sk_buff *skb, u64 level) * Description From 3a53ff7e587cd26e7dc5285b0a78716928270554 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Fri, 24 Jul 2020 14:17:18 +0200 Subject: [PATCH 05/10] mptcp: show all endpoints when no ID is specified According to 'ip mptcp help', 'endpoint show' can accept no argument: ip mptcp endpoint show [ id ID ] It makes sense to print all endpoints when no filter is used. So here if the following command is used, all endpoints are printed: ip mptcp endpoint show Same as: ip mptcp endpoint Fixes: 7e0767cd ("add support for mptcp netlink interface") Signed-off-by: Matthieu Baerts Signed-off-by: Stephen Hemminger --- ip/ipmptcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index bc12418b..e1ffafb3 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -273,7 +273,7 @@ static int mptcp_addr_show(int argc, char **argv) struct nlmsghdr *answer; int ret; - if (!argv) + if (argc <= 0) return mptcp_addr_dump(); ret = mptcp_parse_opt(argc, argv, &req.n, false); From 65c0c4d21b9610acdaced7f3ce256d265651b47d Mon Sep 17 00:00:00 2001 From: Anton Danilov Date: Mon, 27 Jul 2020 16:26:07 +0300 Subject: [PATCH 06/10] bridge: fdb: the 'dynamic' option in the show/get commands In most of cases a user wants to see only the dynamic mac addresses in the fdb output. But currently the 'fdb show' displays tons of various self entries, those only waste the output without any useful goal. New option 'dynamic' for 'show' and 'get' commands forces display only relevant records. Signed-off-by: Anton Danilov Signed-off-by: Stephen Hemminger --- bridge/fdb.c | 17 +++++++++++++---- man/man8/bridge.8 | 30 ++++++++++++++++++------------ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/bridge/fdb.c b/bridge/fdb.c index a12b5474..118fd523 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -30,7 +30,8 @@ #include "rt_names.h" #include "utils.h" -static unsigned int filter_index, filter_vlan, filter_state, filter_master; +static unsigned int filter_index, filter_dynamic, filter_master, + filter_state, filter_vlan; static void usage(void) { @@ -40,9 +41,10 @@ static void usage(void) " [ sticky ] [ local | static | dynamic ] [ dst IPADDR ]\n" " [ vlan VID ] [ port PORT] [ vni VNI ] [ via DEV ]\n" " [ src_vni VNI ]\n" - " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n" - " bridge fdb get ADDR [ br BRDEV ] { brport |dev } DEV [ vlan VID ]\n" - " [ vni VNI ]\n"); + " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ]\n" + " [ state STATE ] [ dynamic ] ]\n" + " bridge fdb get [ to ] LLADDR [ br BRDEV ] { brport | dev } DEV\n" + " [ vlan VID ] [ vni VNI ] [ self ] [ master ] [ dynamic ]\n"); exit(-1); } @@ -167,6 +169,9 @@ int print_fdb(struct nlmsghdr *n, void *arg) if (filter_vlan && filter_vlan != vid) return 0; + if (filter_dynamic && (r->ndm_state & NUD_PERMANENT)) + return 0; + open_json_object(NULL); if (n->nlmsg_type == RTM_DELNEIGH) print_bool(PRINT_ANY, "deleted", "Deleted ", true); @@ -322,6 +327,8 @@ static int fdb_show(int argc, char **argv) if (state_a2n(&state, *argv)) invarg("invalid state", *argv); filter_state |= state; + } else if (strcmp(*argv, "dynamic") == 0) { + filter_dynamic = 1; } else { if (matches(*argv, "help") == 0) usage(); @@ -566,6 +573,8 @@ static int fdb_get(int argc, char **argv) duparg2("vlan", *argv); NEXT_ARG(); vlan = atoi(*argv); + } else if (matches(*argv, "dynamic") == 0) { + filter_dynamic = 1; } else { if (strcmp(*argv, "to") == 0) NEXT_ARG(); diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index efe67f7b..08c53f27 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -76,12 +76,12 @@ bridge \- show / manipulate bridge addresses and devices .B port .IR PORT " ] [" .B via -.IR DEVICE " ]" +.IR DEVICE " ] [" +.B src_vni +.IR VNI " ]" .ti -8 -.BR "bridge fdb" " [ " show " ] [ " -.B dev -.IR DEV " ] [ " +.BR "bridge fdb" " [ [ " show " ] [ " .B br .IR BRDEV " ] [ " .B brport @@ -89,18 +89,24 @@ bridge \- show / manipulate bridge addresses and devices .B vlan .IR VID " ] [ " .B state -.IR STATE " ]" +.IR STATE " ] [" +.B dynamic +.IR "] ]" .ti -8 -.B bridge fdb get -.I LLADDR " [ " -.B dev -.IR DEV " ] [ " +.BR "bridge fdb get" " [" +.B to +.IR "]" +.I LLADDR "[ " .B br -.IR BRDEV " ] [ " +.IR BRDEV " ]" +.B { brport | dev } +.IR DEV " [ " .B vlan -.IR VID " ] [" -.BR self " ] [ " master " ]" +.IR VID " ] [ " +.B vni +.IR VNI " ] [" +.BR self " ] [ " master " ] [ " dynamic " ]" .ti -8 .BR "bridge mdb" " { " add " | " del " } " From cb17e0cc578162a33d62afcbf9df471183a6b0c7 Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Wed, 29 Jul 2020 15:04:25 +0200 Subject: [PATCH 07/10] bridge: fdb show: fix fdb entry state output for json context bridge json fdb show is printing an incorrect / non-machine readable value, when using -j (json output) we are expecting machine readable data that shouldn't require special handling/parsing. $ bridge -j fdb show | \ python -c \ 'import sys,json;print(json.dumps(json.loads(sys.stdin.read()),indent=4))' [ { "master": "br0", "mac": "56:23:28:4f:4f:e5", "flags": [], "ifname": "vx0", "state": "state=0x80" <<<<<<<<< with the patch: "state": "0x80" } ] Fixes: c7c1a1ef51aea7c ("bridge: colorize output and use JSON print library") Signed-off-by: Julien Fortin Signed-off-by: Stephen Hemminger --- bridge/fdb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bridge/fdb.c b/bridge/fdb.c index 118fd523..06a2254b 100644 --- a/bridge/fdb.c +++ b/bridge/fdb.c @@ -64,7 +64,10 @@ static const char *state_n2a(unsigned int s) if (s & NUD_REACHABLE) return ""; - sprintf(buf, "state=%#x", s); + if (is_json_context()) + sprintf(buf, "%#x", s); + else + sprintf(buf, "state=%#x", s); return buf; } From fbef655568ee931a82ad463a6f46f01ce3fb27aa Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sat, 1 Aug 2020 10:26:41 -0700 Subject: [PATCH 08/10] replace SNAPSHOT with auto-generated version string Replace the iproute2 snapshot with a version string which is autogenerated as part of the build process using git describe. This will also allow seeing if the version of the command is built from the same sources is as upstream. Signed-off-by: Stephen Hemminger --- Makefile | 10 ++++++---- bridge/bridge.c | 2 +- devlink/devlink.c | 4 ++-- genl/genl.c | 4 ++-- include/SNAPSHOT.h | 1 - include/version.h | 1 + ip/ip.c | 4 ++-- ip/rtmon.c | 4 ++-- misc/ifstat.c | 4 ++-- misc/nstat.c | 4 ++-- misc/rtacct.c | 4 ++-- misc/ss.c | 4 ++-- rdma/rdma.c | 6 +++--- tc/tc.c | 4 ++-- 14 files changed, 29 insertions(+), 27 deletions(-) delete mode 100644 include/SNAPSHOT.h create mode 100644 include/version.h diff --git a/Makefile b/Makefile index 25d05fac..cadda235 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,8 @@ all: config.mk for i in $(SUBDIRS); \ do echo; echo $$i; $(MAKE) $(MFLAGS) -C $$i; done +.PHONY: clean clobber distclean check cscope version + help: @echo "Make Targets:" @echo " all - build binaries" @@ -73,7 +75,7 @@ help: @echo " install - install binaries on local machine" @echo " check - run tests" @echo " cscope - build cscope database" - @echo " snapshot - generate version number header" + @echo " version - update version" @echo "" @echo "Make Arguments:" @echo " V=[0|1] - set build verbosity level" @@ -93,9 +95,9 @@ install: all install -m 0644 bash-completion/devlink $(DESTDIR)$(BASH_COMPDIR) install -m 0644 include/bpf_elf.h $(DESTDIR)$(HDRDIR) -snapshot: - echo "static const char SNAPSHOT[] = \""`date +%y%m%d`"\";" \ - > include/SNAPSHOT.h +version: + echo "static const char version[] = \""`git describe --tags --long`"\";" \ + > include/version.h clean: @for i in $(SUBDIRS) testsuite; \ diff --git a/bridge/bridge.c b/bridge/bridge.c index a50d9d59..453d6897 100644 --- a/bridge/bridge.c +++ b/bridge/bridge.c @@ -12,7 +12,7 @@ #include #include -#include "SNAPSHOT.h" +#include "version.h" #include "utils.h" #include "br_common.h" #include "namespace.h" diff --git a/devlink/devlink.c b/devlink/devlink.c index 7f83fb74..0982faef 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -34,7 +34,7 @@ #include #include -#include "SNAPSHOT.h" +#include "version.h" #include "list.h" #include "mnlg.h" #include "json_print.h" @@ -7606,7 +7606,7 @@ int main(int argc, char **argv) switch (opt) { case 'V': - printf("devlink utility, iproute2-ss%s\n", SNAPSHOT); + printf("devlink utility, iproute2-%s\n", version); ret = EXIT_SUCCESS; goto dl_free; case 'f': diff --git a/genl/genl.c b/genl/genl.c index aba3c13a..6557e6bc 100644 --- a/genl/genl.c +++ b/genl/genl.c @@ -22,7 +22,7 @@ #include #include #include /* until we put our own header */ -#include "SNAPSHOT.h" +#include "version.h" #include "utils.h" #include "genl_utils.h" @@ -118,7 +118,7 @@ int main(int argc, char **argv) } else if (matches(argv[1], "-raw") == 0) { ++show_raw; } else if (matches(argv[1], "-Version") == 0) { - printf("genl utility, iproute2-ss%s\n", SNAPSHOT); + printf("genl utility, iproute2-%s\n", version); exit(0); } else if (matches(argv[1], "-help") == 0) { usage(); diff --git a/include/SNAPSHOT.h b/include/SNAPSHOT.h deleted file mode 100644 index 0d211784..00000000 --- a/include/SNAPSHOT.h +++ /dev/null @@ -1 +0,0 @@ -static const char SNAPSHOT[] = "200602"; diff --git a/include/version.h b/include/version.h new file mode 100644 index 00000000..7b7bde3d --- /dev/null +++ b/include/version.h @@ -0,0 +1 @@ +static const char version[] = "v5.7.0-77-gb687d1067169"; diff --git a/ip/ip.c b/ip/ip.c index 4249df03..ac445023 100644 --- a/ip/ip.c +++ b/ip/ip.c @@ -18,7 +18,7 @@ #include #include -#include "SNAPSHOT.h" +#include "version.h" #include "utils.h" #include "ip_common.h" #include "namespace.h" @@ -255,7 +255,7 @@ int main(int argc, char **argv) ++timestamp; ++timestamp_short; } else if (matches(opt, "-Version") == 0) { - printf("ip utility, iproute2-ss%s\n", SNAPSHOT); + printf("ip utility, iproute2-%s\n", version); exit(0); } else if (matches(opt, "-force") == 0) { ++force; diff --git a/ip/rtmon.c b/ip/rtmon.c index bccddedd..01c19c80 100644 --- a/ip/rtmon.c +++ b/ip/rtmon.c @@ -19,7 +19,7 @@ #include #include -#include "SNAPSHOT.h" +#include "version.h" #include "utils.h" #include "libnetlink.h" @@ -107,7 +107,7 @@ main(int argc, char **argv) } else if (strcmp(argv[1], "-0") == 0) { family = AF_PACKET; } else if (matches(argv[1], "-Version") == 0) { - printf("rtmon utility, iproute2-ss%s\n", SNAPSHOT); + printf("rtmon utility, iproute2-%s\n", version); exit(0); } else if (matches(argv[1], "file") == 0) { argc--; diff --git a/misc/ifstat.c b/misc/ifstat.c index 03327af8..c05183d7 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -33,7 +33,7 @@ #include "libnetlink.h" #include "json_writer.h" -#include "SNAPSHOT.h" +#include "version.h" #include "utils.h" int dump_zeros; @@ -869,7 +869,7 @@ int main(int argc, char *argv[]) break; case 'v': case 'V': - printf("ifstat utility, iproute2-ss%s\n", SNAPSHOT); + printf("ifstat utility, iproute2-%s\n", version); exit(0); case 'h': case '?': diff --git a/misc/nstat.c b/misc/nstat.c index 88f52eaf..6fdd316c 100644 --- a/misc/nstat.c +++ b/misc/nstat.c @@ -29,7 +29,7 @@ #include #include -#include +#include "version.h" #include "utils.h" int dump_zeros; @@ -621,7 +621,7 @@ int main(int argc, char *argv[]) break; case 'v': case 'V': - printf("nstat utility, iproute2-ss%s\n", SNAPSHOT); + printf("nstat utility, iproute2-%s\n", version); exit(0); case 'h': case '?': diff --git a/misc/rtacct.c b/misc/rtacct.c index c4bb5bc3..47b27e3f 100644 --- a/misc/rtacct.c +++ b/misc/rtacct.c @@ -30,7 +30,7 @@ #include "rt_names.h" -#include +#include "version.h" int reset_history; int ignore_history; @@ -463,7 +463,7 @@ int main(int argc, char *argv[]) break; case 'v': case 'V': - printf("rtacct utility, iproute2-ss%s\n", SNAPSHOT); + printf("rtacct utility, iproute2-%s\n", version); exit(0); case 'M': /* Some secret undocumented option, nobody diff --git a/misc/ss.c b/misc/ss.c index 5aa10e4a..35066bf6 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -35,7 +35,7 @@ #include "ll_map.h" #include "libnetlink.h" #include "namespace.h" -#include "SNAPSHOT.h" +#include "version.h" #include "rt_names.h" #include "cg_map.h" @@ -5411,7 +5411,7 @@ int main(int argc, char *argv[]) break; case 'v': case 'V': - printf("ss utility, iproute2-ss%s\n", SNAPSHOT); + printf("ss utility, iproute2-%s\n", version); exit(0); case 'z': show_sock_ctx++; diff --git a/rdma/rdma.c b/rdma/rdma.c index 22050555..d1957465 100644 --- a/rdma/rdma.c +++ b/rdma/rdma.c @@ -5,7 +5,7 @@ */ #include "rdma.h" -#include "SNAPSHOT.h" +#include "version.h" #include "color.h" static void help(char *name) @@ -131,8 +131,8 @@ int main(int argc, char **argv) long_options, NULL)) >= 0) { switch (opt) { case 'V': - printf("%s utility, iproute2-ss%s\n", - filename, SNAPSHOT); + printf("%s utility, iproute2-%s\n", + filename, version); return EXIT_SUCCESS; case 'p': pretty = 1; diff --git a/tc/tc.c b/tc/tc.c index b72657ec..5d57054b 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -24,7 +24,7 @@ #include #include -#include "SNAPSHOT.h" +#include "version.h" #include "utils.h" #include "tc_util.h" #include "tc_common.h" @@ -299,7 +299,7 @@ int main(int argc, char **argv) } else if (matches(argv[1], "-graph") == 0) { show_graph = 1; } else if (matches(argv[1], "-Version") == 0) { - printf("tc utility, iproute2-ss%s\n", SNAPSHOT); + printf("tc utility, iproute2-%s\n", version); return 0; } else if (matches(argv[1], "-iec") == 0) { ++use_iec; From d530608d336abe710edf8235901c188593af8ce0 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 3 Aug 2020 09:27:48 -0700 Subject: [PATCH 09/10] lnstat: use same version as iproute2 Lnstat was trying to be different and have its own version. Signed-off-by: Stephen Hemminger --- misc/lnstat.c | 3 ++- misc/lnstat.h | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/misc/lnstat.c b/misc/lnstat.c index e3c84211..89cb0e7e 100644 --- a/misc/lnstat.c +++ b/misc/lnstat.c @@ -38,6 +38,7 @@ #include #include "lnstat.h" +#include "version.h" static struct option opts[] = { { "version", 0, NULL, 'V' }, @@ -79,7 +80,7 @@ static int usage(char *name, int exit_code) " 2 = every 20 lines (default))\n" " -w --width n,n,n,... Width for each field\n" "\n", - name, LNSTAT_VERSION); + name, version); exit(exit_code); } diff --git a/misc/lnstat.h b/misc/lnstat.h index 199eb54a..433599cc 100644 --- a/misc/lnstat.h +++ b/misc/lnstat.h @@ -5,8 +5,6 @@ #include #include -#define LNSTAT_VERSION "0.02 041002" - #define PROC_NET_STAT "/proc/net/stat" #define LNSTAT_MAX_FILES 32 From 53159d81156f7fab53b97ceb4750d8b9c3c10fcc Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 3 Aug 2020 10:03:42 -0700 Subject: [PATCH 10/10] v5.8.0 --- include/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/version.h b/include/version.h index 7b7bde3d..0088493d 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -static const char version[] = "v5.7.0-77-gb687d1067169"; +static const char version[] = "5.8.0";