Merge branch 'master' into net-next
This commit is contained in:
commit
590dde3a98
|
|
@ -355,7 +355,7 @@ get_failed:
|
||||||
addattr_l(n, 1024, IFLA_GRE_TTL, &hop_limit, 1);
|
addattr_l(n, 1024, IFLA_GRE_TTL, &hop_limit, 1);
|
||||||
addattr_l(n, 1024, IFLA_GRE_ENCAP_LIMIT, &encap_limit, 1);
|
addattr_l(n, 1024, IFLA_GRE_ENCAP_LIMIT, &encap_limit, 1);
|
||||||
addattr_l(n, 1024, IFLA_GRE_FLOWINFO, &flowinfo, 4);
|
addattr_l(n, 1024, IFLA_GRE_FLOWINFO, &flowinfo, 4);
|
||||||
addattr_l(n, 1024, IFLA_GRE_FLAGS, &flowinfo, 4);
|
addattr32(n, 1024, IFLA_GRE_FLAGS, flags);
|
||||||
|
|
||||||
addattr16(n, 1024, IFLA_GRE_ENCAP_TYPE, encaptype);
|
addattr16(n, 1024, IFLA_GRE_ENCAP_TYPE, encaptype);
|
||||||
addattr16(n, 1024, IFLA_GRE_ENCAP_FLAGS, encapflags);
|
addattr16(n, 1024, IFLA_GRE_ENCAP_FLAGS, encapflags);
|
||||||
|
|
@ -383,7 +383,7 @@ static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
flags = rta_getattr_u32(tb[IFLA_GRE_FLAGS]);
|
flags = rta_getattr_u32(tb[IFLA_GRE_FLAGS]);
|
||||||
|
|
||||||
if (tb[IFLA_GRE_FLOWINFO])
|
if (tb[IFLA_GRE_FLOWINFO])
|
||||||
flags = rta_getattr_u32(tb[IFLA_GRE_FLOWINFO]);
|
flowinfo = rta_getattr_u32(tb[IFLA_GRE_FLOWINFO]);
|
||||||
|
|
||||||
if (tb[IFLA_GRE_REMOTE]) {
|
if (tb[IFLA_GRE_REMOTE]) {
|
||||||
struct in6_addr addr;
|
struct in6_addr addr;
|
||||||
|
|
|
||||||
|
|
@ -150,18 +150,19 @@ new_cmd(char **argv)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
|
||||||
parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
|
|
||||||
{
|
{
|
||||||
int argc = *argc_p;
|
int argc = *argc_p;
|
||||||
char **argv = *argv_p;
|
char **argv = *argv_p;
|
||||||
struct rtattr *tail, *tail2;
|
struct rtattr *tail, *tail2;
|
||||||
char k[16];
|
char k[16];
|
||||||
|
int act_ck_len = 0;
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
int eap = 0; /* expect action parameters */
|
int eap = 0; /* expect action parameters */
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int prio = 0;
|
int prio = 0;
|
||||||
|
unsigned char act_ck[TC_COOKIE_MAX_SIZE];
|
||||||
|
|
||||||
if (argc <= 0)
|
if (argc <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -215,16 +216,44 @@ done0:
|
||||||
addattr_l(n, MAX_MSG, ++prio, NULL, 0);
|
addattr_l(n, MAX_MSG, ++prio, NULL, 0);
|
||||||
addattr_l(n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
|
addattr_l(n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
|
||||||
|
|
||||||
ret = a->parse_aopt(a, &argc, &argv, TCA_ACT_OPTIONS, n);
|
ret = a->parse_aopt(a, &argc, &argv, TCA_ACT_OPTIONS,
|
||||||
|
n);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "bad action parsing\n");
|
fprintf(stderr, "bad action parsing\n");
|
||||||
goto bad_val;
|
goto bad_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*argv && strcmp(*argv, "cookie") == 0) {
|
||||||
|
size_t slen;
|
||||||
|
|
||||||
|
NEXT_ARG();
|
||||||
|
slen = strlen(*argv);
|
||||||
|
if (slen > TC_COOKIE_MAX_SIZE * 2) {
|
||||||
|
char cookie_err_m[128];
|
||||||
|
|
||||||
|
snprintf(cookie_err_m, 128,
|
||||||
|
"%zd Max allowed size %d",
|
||||||
|
slen, TC_COOKIE_MAX_SIZE*2);
|
||||||
|
invarg(cookie_err_m, *argv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hex2mem(*argv, act_ck, slen / 2) < 0)
|
||||||
|
invarg("cookie must be a hex string\n",
|
||||||
|
*argv);
|
||||||
|
|
||||||
|
act_ck_len = slen;
|
||||||
|
argc--;
|
||||||
|
argv++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (act_ck_len)
|
||||||
|
addattr_l(n, MAX_MSG, TCA_ACT_COOKIE,
|
||||||
|
&act_ck, act_ck_len);
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
||||||
ok++;
|
ok++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eap > 0) {
|
if (eap > 0) {
|
||||||
|
|
@ -245,8 +274,7 @@ bad_val:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int tc_print_one_action(FILE *f, struct rtattr *arg)
|
||||||
tc_print_one_action(FILE *f, struct rtattr *arg)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
struct rtattr *tb[TCA_ACT_MAX + 1];
|
struct rtattr *tb[TCA_ACT_MAX + 1];
|
||||||
|
|
@ -274,8 +302,17 @@ tc_print_one_action(FILE *f, struct rtattr *arg)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (show_stats && tb[TCA_ACT_STATS]) {
|
if (show_stats && tb[TCA_ACT_STATS]) {
|
||||||
|
|
||||||
fprintf(f, "\tAction statistics:\n");
|
fprintf(f, "\tAction statistics:\n");
|
||||||
print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
|
print_tcstats2_attr(f, tb[TCA_ACT_STATS], "\t", NULL);
|
||||||
|
if (tb[TCA_ACT_COOKIE]) {
|
||||||
|
int strsz = RTA_PAYLOAD(tb[TCA_ACT_COOKIE]);
|
||||||
|
char b1[strsz+1];
|
||||||
|
|
||||||
|
fprintf(f, "\n\tcookie len %d %s ", strsz,
|
||||||
|
hexstring_n2a(RTA_DATA(tb[TCA_ACT_COOKIE]),
|
||||||
|
strsz, b1, sizeof(b1)));
|
||||||
|
}
|
||||||
fprintf(f, "\n");
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue