Merge branch 'iproute2-master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2019-05-10 12:01:01 -07:00
commit d53d7ce382
6 changed files with 22 additions and 17 deletions

View File

@ -3858,12 +3858,8 @@ static int cmd_mon(struct dl *dl)
if (dl_argv_match(dl, "help")) { if (dl_argv_match(dl, "help")) {
cmd_mon_help(); cmd_mon_help();
return 0; return 0;
} else if (dl_no_arg(dl)) {
dl_arg_inc(dl);
return cmd_mon_show(dl);
} }
pr_err("Command \"%s\" not found\n", dl_argv(dl)); return cmd_mon_show(dl);
return -ENOENT;
} }
struct dpipe_field { struct dpipe_field {

View File

@ -57,6 +57,7 @@ int print_mroute(struct nlmsghdr *n, void *arg)
struct rtmsg *r = NLMSG_DATA(n); struct rtmsg *r = NLMSG_DATA(n);
int len = n->nlmsg_len; int len = n->nlmsg_len;
struct rtattr *tb[RTA_MAX+1]; struct rtattr *tb[RTA_MAX+1];
FILE *fp = arg;
const char *src, *dst; const char *src, *dst;
SPRINT_BUF(b1); SPRINT_BUF(b1);
SPRINT_BUF(b2); SPRINT_BUF(b2);
@ -209,6 +210,7 @@ int print_mroute(struct nlmsghdr *n, void *arg)
print_string(PRINT_FP, NULL, "\n", NULL); print_string(PRINT_FP, NULL, "\n", NULL);
close_json_object(); close_json_object();
fflush(fp);
return 0; return 0;
} }

View File

@ -107,7 +107,7 @@ int get_netnsid_from_name(const char *name)
struct nlmsghdr *answer; struct nlmsghdr *answer;
struct rtattr *tb[NETNSA_MAX + 1]; struct rtattr *tb[NETNSA_MAX + 1];
struct rtgenmsg *rthdr; struct rtgenmsg *rthdr;
int len, fd; int len, fd, ret = -1;
netns_nsid_socket_init(); netns_nsid_socket_init();
@ -124,23 +124,22 @@ int get_netnsid_from_name(const char *name)
/* Validate message and parse attributes */ /* Validate message and parse attributes */
if (answer->nlmsg_type == NLMSG_ERROR) if (answer->nlmsg_type == NLMSG_ERROR)
goto err_out; goto out;
rthdr = NLMSG_DATA(answer); rthdr = NLMSG_DATA(answer);
len = answer->nlmsg_len - NLMSG_SPACE(sizeof(*rthdr)); len = answer->nlmsg_len - NLMSG_SPACE(sizeof(*rthdr));
if (len < 0) if (len < 0)
goto err_out; goto out;
parse_rtattr(tb, NETNSA_MAX, NETNS_RTA(rthdr), len); parse_rtattr(tb, NETNSA_MAX, NETNS_RTA(rthdr), len);
if (tb[NETNSA_NSID]) { if (tb[NETNSA_NSID]) {
free(answer); ret = rta_getattr_u32(tb[NETNSA_NSID]);
return rta_getattr_u32(tb[NETNSA_NSID]);
} }
err_out: out:
free(answer); free(answer);
return -1; return ret;
} }
struct nsid_cache { struct nsid_cache {

View File

@ -410,6 +410,10 @@ static int xfrm_policy_filter_match(struct xfrm_userpolicy_info *xpinfo,
if (!filter.use) if (!filter.use)
return 1; return 1;
if (filter.xpinfo.sel.family != AF_UNSPEC &&
filter.xpinfo.sel.family != xpinfo->sel.family)
return 0;
if ((xpinfo->dir^filter.xpinfo.dir)&filter.dir_mask) if ((xpinfo->dir^filter.xpinfo.dir)&filter.dir_mask)
return 0; return 0;
@ -780,7 +784,7 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall)
char *selp = NULL; char *selp = NULL;
struct rtnl_handle rth; struct rtnl_handle rth;
if (argc > 0) if (argc > 0 || preferred_family != AF_UNSPEC)
filter.use = 1; filter.use = 1;
filter.xpinfo.sel.family = preferred_family; filter.xpinfo.sel.family = preferred_family;

View File

@ -898,6 +898,10 @@ static int xfrm_state_filter_match(struct xfrm_usersa_info *xsinfo)
if (!filter.use) if (!filter.use)
return 1; return 1;
if (filter.xsinfo.family != AF_UNSPEC &&
filter.xsinfo.family != xsinfo->family)
return 0;
if (filter.id_src_mask) if (filter.id_src_mask)
if (xfrm_addr_match(&xsinfo->saddr, &filter.xsinfo.saddr, if (xfrm_addr_match(&xsinfo->saddr, &filter.xsinfo.saddr,
filter.id_src_mask)) filter.id_src_mask))
@ -1170,7 +1174,7 @@ static int xfrm_state_list_or_deleteall(int argc, char **argv, int deleteall)
struct rtnl_handle rth; struct rtnl_handle rth;
bool nokeys = false; bool nokeys = false;
if (argc > 0) if (argc > 0 || preferred_family != AF_UNSPEC)
filter.use = 1; filter.use = 1;
filter.xsinfo.family = preferred_family; filter.xsinfo.family = preferred_family;

View File

@ -89,7 +89,7 @@ ip-xfrm \- transform configuration
.IR MASK " ] ]" .IR MASK " ] ]"
.ti -8 .ti -8
.BR "ip xfrm state " deleteall " [" .BR ip " [ " -4 " | " -6 " ] " "xfrm state deleteall" " ["
.IR ID " ]" .IR ID " ]"
.RB "[ " mode .RB "[ " mode
.IR MODE " ]" .IR MODE " ]"
@ -99,7 +99,7 @@ ip-xfrm \- transform configuration
.IR FLAG-LIST " ]" .IR FLAG-LIST " ]"
.ti -8 .ti -8
.BR "ip xfrm state " list " [" .BR ip " [ " -4 " | " -6 " ] " "xfrm state list" " ["
.IR ID " ]" .IR ID " ]"
.RB "[ " nokeys " ]" .RB "[ " nokeys " ]"
.RB "[ " mode .RB "[ " mode
@ -257,7 +257,7 @@ ip-xfrm \- transform configuration
.IR PTYPE " ]" .IR PTYPE " ]"
.ti -8 .ti -8
.BR "ip xfrm policy" " { " deleteall " | " list " }" .BR ip " [ " -4 " | " -6 " ] " "xfrm policy" " { " deleteall " | " list " }"
.RB "[ " nosock " ]" .RB "[ " nosock " ]"
.RI "[ " SELECTOR " ]" .RI "[ " SELECTOR " ]"
.RB "[ " dir .RB "[ " dir