Merge branch 'master' into next

Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
David Ahern 2019-06-10 10:32:07 -07:00
commit 9a4f0ba478
10 changed files with 75 additions and 32 deletions

View File

@ -133,21 +133,21 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e,
open_json_object(NULL);
print_int(PRINT_ANY, "index", "%u: ", ifindex);
print_color_string(PRINT_ANY, COLOR_IFNAME, "dev", "%s ", dev);
print_string(PRINT_ANY, "port", " %s ",
print_int(PRINT_JSON, "index", NULL, ifindex);
print_color_string(PRINT_ANY, COLOR_IFNAME, "dev", "dev %s", dev);
print_string(PRINT_ANY, "port", " port %s",
ll_index_to_name(e->ifindex));
print_color_string(PRINT_ANY, ifa_family_color(af),
"grp", " %s ",
"grp", " grp %s",
inet_ntop(af, src, abuf, sizeof(abuf)));
print_string(PRINT_ANY, "state", " %s ",
print_string(PRINT_ANY, "state", " %s",
(e->state & MDB_PERMANENT) ? "permanent" : "temp");
open_json_array(PRINT_JSON, "flags");
if (e->flags & MDB_FLAGS_OFFLOAD)
print_string(PRINT_ANY, NULL, "%s ", "offload");
print_string(PRINT_ANY, NULL, " %s", "offload");
close_json_array(PRINT_JSON, NULL);
if (e->vid)

View File

@ -1523,7 +1523,7 @@ static void __pr_out_handle_start(struct dl *dl, struct nlattr **tb,
{
const char *bus_name = mnl_attr_get_str(tb[DEVLINK_ATTR_BUS_NAME]);
const char *dev_name = mnl_attr_get_str(tb[DEVLINK_ATTR_DEV_NAME]);
char buf[32];
char buf[64];
sprintf(buf, "%s/%s", bus_name, dev_name);
@ -1616,7 +1616,7 @@ static void __pr_out_port_handle_start(struct dl *dl, const char *bus_name,
uint32_t port_index, bool try_nice,
bool array)
{
static char buf[32];
static char buf[64];
char *ifname = NULL;
if (dl->no_nice_names || !try_nice ||

View File

@ -946,7 +946,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
else if (!strcmp(name, dev))
name = dev;
if (dev && addr_len) {
if (dev && addr_len &&
!(req->n.nlmsg_flags & NLM_F_CREATE)) {
int halen = nl_get_ll_addr_len(dev);
if (halen >= 0 && halen != addr_len) {

View File

@ -177,7 +177,7 @@ static int ll_link_get(const char *name, int index)
addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name,
strlen(name) + 1);
if (rtnl_talk(&rth, &req.n, &answer) < 0)
if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0)
goto out;
/* add entry to cache */

View File

@ -154,10 +154,15 @@ ip-link \- network device configuration
.br
.RB "[ " addrgenmode " { " eui64 " | " none " | " stable_secret " | " random " } ]"
.br
.RB "[ " macaddr " { " flush " | { " add " | " del " } "
.IR MACADDR " | set [ "
.IR MACADDR " [ "
.IR MACADDR " [ ... ] ] ] } ]"
.RB "[ " macaddr
.RI "[ " MACADDR " ]"
.br
.in +10
.RB "[ { " flush " | " add " | " del " } "
.IR MACADDR " ]"
.br
.RB "[ " set
.IR MACADDR " ] ]"
.br
.ti -8

View File

@ -10,9 +10,10 @@ skbedit - SKB editing action
.B priority
.IR PRIORITY " ] ["
.B mark
.IR MARK " ]"
.IR MARK " ] ["
.B ptype
.IR PTYPE " ]"
.IR PTYPE " ] ["
.BR inheritdsfield " ]"
.SH DESCRIPTION
The
.B skbedit
@ -22,7 +23,7 @@ action, which in turn allows to change parts of the packet data itself.
The most unique feature of
.B skbedit
is it's ability to decide over which queue of an interface with multiple
is its ability to decide over which queue of an interface with multiple
transmit queues the packet is to be sent out. The number of available transmit
queues is reflected by sysfs entries within
.I /sys/class/net/<interface>/queues
@ -61,6 +62,12 @@ needing to allow ingressing packets with the wrong MAC address but
correct IP address.
.I PTYPE
is one of: host, otherhost, broadcast, multicast
.TP
.BI inheritdsfield
Override the packet classification decision, and any value specified with
.BR priority ", "
using the information stored in the Differentiated Services Field of the
IPv6/IPv4 header (RFC2474).
.SH SEE ALSO
.BR tc (8),
.BR tc-pedit (8)

View File

@ -493,23 +493,40 @@ static int flower_port_range_attr_type(__u8 ip_proto, enum flower_endpoint type,
return 0;
}
/* parse range args in format 10-20 */
static int parse_range(char *str, __be16 *min, __be16 *max)
{
char *sep;
sep = strchr(str, '-');
if (sep) {
*sep = '\0';
if (get_be16(min, str, 10))
return -1;
if (get_be16(max, sep + 1, 10))
return -1;
} else {
if (get_be16(min, str, 10))
return -1;
}
return 0;
}
static int flower_parse_port(char *str, __u8 ip_proto,
enum flower_endpoint endpoint,
struct nlmsghdr *n)
{
__u16 min, max;
__be16 min = 0;
__be16 max = 0;
int ret;
ret = sscanf(str, "%hu-%hu", &min, &max);
ret = parse_range(str, &min, &max);
if (ret)
return -1;
if (ret == 1) {
int type;
type = flower_port_attr_type(ip_proto, endpoint);
if (type < 0)
return -1;
addattr16(n, MAX_MSG, type, htons(min));
} else if (ret == 2) {
if (min && max) {
__be16 min_port_type, max_port_type;
if (max <= min) {
@ -520,8 +537,15 @@ static int flower_parse_port(char *str, __u8 ip_proto,
&min_port_type, &max_port_type))
return -1;
addattr16(n, MAX_MSG, min_port_type, htons(min));
addattr16(n, MAX_MSG, max_port_type, htons(max));
addattr16(n, MAX_MSG, min_port_type, min);
addattr16(n, MAX_MSG, max_port_type, max);
} else if (min && !max) {
int type;
type = flower_port_attr_type(ip_proto, endpoint);
if (type < 0)
return -1;
addattr16(n, MAX_MSG, type, min);
} else {
return -1;
}

View File

@ -88,6 +88,9 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
if (!matches(*argv, "gact"))
NEXT_ARG_FWD();
/* we're binding existing gact action to filter by index. */
if (!matches(*argv, "index"))
goto skip_args;
if (parse_action_control(&argc, &argv, &p.action, false))
usage(); /* does not return */
@ -132,6 +135,7 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
if (argc > 0) {
if (matches(*argv, "index") == 0) {
skip_args:
NEXT_ARG();
if (get_u32(&p.index, *argv, 10)) {
fprintf(stderr, "Illegal \"index\"\n");

View File

@ -202,7 +202,8 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p,
if (p.eaction == TCA_EGRESS_MIRROR || p.eaction == TCA_INGRESS_MIRROR)
parse_action_control(&argc, &argv, &p.action, false);
parse_action_control_dflt(&argc, &argv, &p.action, false,
TC_ACT_PIPE);
if (argc) {
if (iok && matches(*argv, "index") == 0) {

View File

@ -120,6 +120,9 @@ parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
}
}
parse_action_control_dflt(&argc, &argv, &sel.action, false,
TC_ACT_PIPE);
if (argc) {
if (matches(*argv, "index") == 0) {
NEXT_ARG();
@ -145,8 +148,6 @@ parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
return -1;
}
sel.action = TC_ACT_PIPE;
tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_DEF_PARMS, &sel, sizeof(sel));
if (simpdata)