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")) {
cmd_mon_help();
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 -ENOENT;
return cmd_mon_show(dl);
}
struct dpipe_field {

View File

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

View File

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

View File

@ -410,6 +410,10 @@ static int xfrm_policy_filter_match(struct xfrm_userpolicy_info *xpinfo,
if (!filter.use)
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)
return 0;
@ -780,7 +784,7 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall)
char *selp = NULL;
struct rtnl_handle rth;
if (argc > 0)
if (argc > 0 || preferred_family != AF_UNSPEC)
filter.use = 1;
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)
return 1;
if (filter.xsinfo.family != AF_UNSPEC &&
filter.xsinfo.family != xsinfo->family)
return 0;
if (filter.id_src_mask)
if (xfrm_addr_match(&xsinfo->saddr, &filter.xsinfo.saddr,
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;
bool nokeys = false;
if (argc > 0)
if (argc > 0 || preferred_family != AF_UNSPEC)
filter.use = 1;
filter.xsinfo.family = preferred_family;

View File

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