Merge branch 'iproute2-master' into iproute2-next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2018-11-02 09:34:18 -07:00
commit 70bc1f6550
18 changed files with 77 additions and 9 deletions

View File

@ -484,7 +484,7 @@ static void print_vlan_stats_attr(struct rtattr *attr, int ifindex)
rem = RTA_PAYLOAD(list);
ifname = ll_index_to_name(ifindex);
open_json_object(ifname);
open_vlan_port(ifindex);
print_color_string(PRINT_FP, COLOR_IFNAME,
NULL, "%-16s", ifname);
@ -505,8 +505,7 @@ static void print_vlan_stats_attr(struct rtattr *attr, int ifindex)
print_one_vlan_stats(vstats);
}
close_json_object();
close_vlan_port();
}
static int print_vlan_stats(struct nlmsghdr *n, void *arg)

11
configure vendored
View File

@ -330,8 +330,15 @@ EOF
then
echo "no"
else
echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
echo "yes"
if ${PKG_CONFIG} libbsd --exists
then
echo 'CFLAGS += -DHAVE_LIBBSD' `${PKG_CONFIG} libbsd --cflags` >>$CONFIG
echo 'LDLIBS +=' `${PKG_CONFIG} libbsd --libs` >> $CONFIG
echo "no"
else
echo 'CFLAGS += -DNEED_STRLCPY' >>$CONFIG
echo "yes"
fi
fi
rm -f $TMPDIR/strtest.c $TMPDIR/strtest
}

View File

@ -18,6 +18,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include "utils.h"
#include "genl_utils.h"

View File

@ -126,6 +126,10 @@ struct ipx_addr {
#define IPPROTO_MPLS 137
#endif
#ifndef CLOCK_TAI
# define CLOCK_TAI 11
#endif
__u32 get_addr32(const char *name);
int get_addr_1(inet_prefix *dst, const char *arg, int family);
int get_prefix_1(inet_prefix *dst, char *arg, int family);

View File

@ -24,6 +24,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <sys/ioctl.h>
#include <stdbool.h>
#include <linux/mpls.h>

View File

@ -8,6 +8,9 @@
#include <sys/syscall.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <sched.h>
#include <fcntl.h>
#include <dirent.h>

View File

@ -16,6 +16,9 @@
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <linux/ila.h>
#include <linux/lwtunnel.h>
#include <linux/mpls_iptunnel.h>

View File

@ -461,6 +461,7 @@ static int flush_rule(struct nlmsghdr *n, void *arg)
struct fib_rule_hdr *frh = NLMSG_DATA(n);
int len = n->nlmsg_len;
struct rtattr *tb[FRA_MAX+1];
int host_len = -1;
len -= NLMSG_LENGTH(sizeof(*frh));
if (len < 0)
@ -468,6 +469,10 @@ static int flush_rule(struct nlmsghdr *n, void *arg)
parse_rtattr(tb, FRA_MAX, RTM_RTA(frh), len);
host_len = af_bit_len(frh->family);
if (!filter_nlmsg(n, tb, host_len))
return 0;
if (tb[FRA_PROTOCOL]) {
__u8 protocol = rta_getattr_u8(tb[FRA_PROTOCOL]);
@ -691,6 +696,11 @@ static int iprule_modify(int cmd, int argc, char **argv)
};
if (cmd == RTM_NEWRULE) {
if (argc == 0) {
fprintf(stderr,
"\"ip rule add\" requires arguments.\n");
return -1;
}
req.n.nlmsg_flags |= NLM_F_CREATE|NLM_F_EXCL;
req.frh.action = FR_ACT_TO_TBL;
}

View File

@ -21,6 +21,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <dirent.h>
#include <errno.h>
#include <limits.h>

View File

@ -28,6 +28,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <time.h>

View File

@ -24,6 +24,9 @@
#include <stdio.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>

View File

@ -27,6 +27,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <netdb.h>
#include "utils.h"
#include "xfrm.h"

View File

@ -15,6 +15,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
@ -1758,11 +1761,13 @@ static const char *bpf_map_fetch_name(struct bpf_elf_ctx *ctx, int which)
int i;
for (i = 0; i < ctx->sym_num; i++) {
int type = GELF_ST_TYPE(sym.st_info);
if (gelf_getsym(ctx->sym_tab, i, &sym) != &sym)
continue;
if (GELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
GELF_ST_TYPE(sym.st_info) != STT_NOTYPE ||
(type != STT_NOTYPE && type != STT_OBJECT) ||
sym.st_shndx != ctx->sec_maps ||
sym.st_value / ctx->map_len != which)
continue;
@ -1849,11 +1854,13 @@ static int bpf_map_num_sym(struct bpf_elf_ctx *ctx)
GElf_Sym sym;
for (i = 0; i < ctx->sym_num; i++) {
int type = GELF_ST_TYPE(sym.st_info);
if (gelf_getsym(ctx->sym_tab, i, &sym) != &sym)
continue;
if (GELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
GELF_ST_TYPE(sym.st_info) != STT_NOTYPE ||
(type != STT_NOTYPE && type != STT_OBJECT) ||
sym.st_shndx != ctx->sec_maps)
continue;
num++;
@ -1927,10 +1934,12 @@ static int bpf_map_verify_all_offs(struct bpf_elf_ctx *ctx, int end)
* the table again.
*/
for (i = 0; i < ctx->sym_num; i++) {
int type = GELF_ST_TYPE(sym.st_info);
if (gelf_getsym(ctx->sym_tab, i, &sym) != &sym)
continue;
if (GELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
GELF_ST_TYPE(sym.st_info) != STT_NOTYPE ||
(type != STT_NOTYPE && type != STT_OBJECT) ||
sym.st_shndx != ctx->sec_maps)
continue;
if (sym.st_value == off)

View File

@ -20,6 +20,9 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <errno.h>
#include <limits.h>

View File

@ -18,6 +18,9 @@
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include "rt_names.h"
#include "utils.h"

View File

@ -19,6 +19,9 @@
#include <sys/sysmacros.h>
#include <netinet/in.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <errno.h>
#include <netdb.h>
#include <arpa/inet.h>
@ -1260,7 +1263,7 @@ static void render(void)
while (token) {
/* Print left delimiter only if we already started a line */
if (line_started++)
printed = printf("%s", current_field->ldelim);
printed = printf("%s", f->ldelim);
else
printed = 0;

View File

@ -20,6 +20,9 @@
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <stdlib.h>
#include <getopt.h>

View File

@ -23,6 +23,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#ifdef HAVE_LIBBSD
#include <bsd/string.h>
#endif
#include <dlfcn.h>
#include "utils.h"
#include "tc_util.h"