Merge branch 'main' into next

Conflicts:
	bridge/fdb.c
	man/man8/bridge.8

Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
David Ahern 2020-08-06 16:21:35 +00:00
commit e572e3af0d
22 changed files with 161 additions and 51 deletions

View File

@ -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; \

View File

@ -12,7 +12,7 @@
#include <string.h>
#include <errno.h>
#include "SNAPSHOT.h"
#include "version.h"
#include "utils.h"
#include "br_common.h"
#include "namespace.h"

View File

@ -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 ] [ vlan VID ]\n"
" { [ dst IPADDR ] [ port PORT] [ vni VNI ] | [ nhid NHID ] }\n"
" [ via DEV ] [ 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);
}
@ -62,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;
}
@ -167,6 +172,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);
@ -326,6 +334,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();
@ -582,6 +592,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();

View File

@ -35,7 +35,7 @@
#include <sys/types.h>
#include <rt_names.h>
#include "SNAPSHOT.h"
#include "version.h"
#include "list.h"
#include "mnlg.h"
#include "json_print.h"
@ -7815,7 +7815,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':

View File

@ -22,7 +22,7 @@
#include <errno.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h> /* 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();

View File

@ -1 +0,0 @@
static const char SNAPSHOT[] = "200602";

1
include/version.h Normal file
View File

@ -0,0 +1 @@
static const char version[] = "5.8.0";

View File

@ -18,7 +18,7 @@
#include <string.h>
#include <errno.h>
#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;

View File

@ -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);

View File

@ -19,7 +19,7 @@
#include <netinet/in.h>
#include <string.h>
#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--;

View File

@ -81,9 +81,7 @@ bridge \- show / manipulate bridge addresses and devices
.IR NHID " } "
.ti -8
.BR "bridge fdb" " [ " show " ] [ "
.B dev
.IR DEV " ] [ "
.BR "bridge fdb" " [ [ " show " ] [ "
.B br
.IR BRDEV " ] [ "
.B brport
@ -91,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 " } "

View File

@ -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

View File

@ -33,7 +33,7 @@
#include "libnetlink.h"
#include "json_writer.h"
#include "SNAPSHOT.h"
#include "version.h"
#include "utils.h"
int dump_zeros;
@ -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;
@ -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 '?':

View File

@ -38,6 +38,7 @@
#include <json_writer.h>
#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);
}

View File

@ -5,8 +5,6 @@
#include <limits.h>
#include <sys/select.h>
#define LNSTAT_VERSION "0.02 041002"
#define PROC_NET_STAT "/proc/net/stat"
#define LNSTAT_MAX_FILES 32

View File

@ -29,7 +29,7 @@
#include <getopt.h>
#include <json_writer.h>
#include <SNAPSHOT.h>
#include "version.h"
#include "utils.h"
int dump_zeros;
@ -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;
@ -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 '?':

View File

@ -30,7 +30,7 @@
#include "rt_names.h"
#include <SNAPSHOT.h>
#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

View File

@ -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"
@ -1682,7 +1682,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)
@ -5504,7 +5504,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++;

View File

@ -5,7 +5,7 @@
*/
#include "rdma.h"
#include "SNAPSHOT.h"
#include "version.h"
#include "color.h"
static void help(char *name)
@ -133,8 +133,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;

View File

@ -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;

View File

@ -24,7 +24,7 @@
#include <string.h>
#include <errno.h>
#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;

View File

@ -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