mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-08-15 04:35:14 +00:00
treewide: Use addattr_nest()/addattr_nest_end() to handle nested attributes
We have helper routines to support nested attribute addition into netlink buffer: use them instead of open coding. Use addattr_nest_compat()/addattr_nest_compat_end() where appropriate. Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
parent
28254695d1
commit
c14f9d92ee
@ -1025,9 +1025,9 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
|
|||||||
else
|
else
|
||||||
iflatype = IFLA_INFO_DATA;
|
iflatype = IFLA_INFO_DATA;
|
||||||
if (lu && argc) {
|
if (lu && argc) {
|
||||||
struct rtattr *data
|
struct rtattr *data;
|
||||||
= addattr_nest(&req.n,
|
|
||||||
sizeof(req), iflatype);
|
data = addattr_nest(&req.n, sizeof(req), iflatype);
|
||||||
|
|
||||||
if (lu->parse_opt &&
|
if (lu->parse_opt &&
|
||||||
lu->parse_opt(lu, argc, argv, &req.n))
|
lu->parse_opt(lu, argc, argv, &req.n))
|
||||||
|
@ -56,8 +56,7 @@ static int vlan_parse_qos_map(int *argcp, char ***argvp, struct nlmsghdr *n,
|
|||||||
struct ifla_vlan_qos_mapping m;
|
struct ifla_vlan_qos_mapping m;
|
||||||
struct rtattr *tail;
|
struct rtattr *tail;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, attrtype);
|
||||||
addattr_l(n, 1024, attrtype, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
char *colon = strchr(*argv, ':');
|
char *colon = strchr(*argv, ':');
|
||||||
@ -75,7 +74,7 @@ static int vlan_parse_qos_map(int *argcp, char ***argvp, struct nlmsghdr *n,
|
|||||||
addattr_l(n, 1024, IFLA_VLAN_QOS_MAPPING, &m, sizeof(m));
|
addattr_l(n, 1024, IFLA_VLAN_QOS_MAPPING, &m, sizeof(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argcp = argc;
|
*argcp = argc;
|
||||||
*argvp = argv;
|
*argvp = argv;
|
||||||
|
@ -55,8 +55,7 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
ifm->ifi_flags = 0;
|
ifm->ifi_flags = 0;
|
||||||
ifm->ifi_change = 0;
|
ifm->ifi_change = 0;
|
||||||
|
|
||||||
data = NLMSG_TAIL(n);
|
data = addattr_nest(n, 1024, VXCAN_INFO_PEER);
|
||||||
addattr_l(n, 1024, VXCAN_INFO_PEER, NULL, 0);
|
|
||||||
|
|
||||||
n->nlmsg_len += sizeof(struct ifinfomsg);
|
n->nlmsg_len += sizeof(struct ifinfomsg);
|
||||||
|
|
||||||
@ -83,7 +82,7 @@ static int vxcan_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
if (group != -1)
|
if (group != -1)
|
||||||
addattr32(n, 1024, IFLA_GROUP, group);
|
addattr32(n, 1024, IFLA_GROUP, group);
|
||||||
|
|
||||||
data->rta_len = (void *)NLMSG_TAIL(n) - (void *)data;
|
addattr_nest_end(n, data);
|
||||||
return argc - 1 - err;
|
return argc - 1 - err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +53,7 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
ifm->ifi_flags = 0;
|
ifm->ifi_flags = 0;
|
||||||
ifm->ifi_change = 0;
|
ifm->ifi_change = 0;
|
||||||
|
|
||||||
data = NLMSG_TAIL(n);
|
data = addattr_nest(n, 1024, VETH_INFO_PEER);
|
||||||
addattr_l(n, 1024, VETH_INFO_PEER, NULL, 0);
|
|
||||||
|
|
||||||
n->nlmsg_len += sizeof(struct ifinfomsg);
|
n->nlmsg_len += sizeof(struct ifinfomsg);
|
||||||
|
|
||||||
@ -81,7 +80,7 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
|
|||||||
if (group != -1)
|
if (group != -1)
|
||||||
addattr32(n, 1024, IFLA_GROUP, group);
|
addattr32(n, 1024, IFLA_GROUP, group);
|
||||||
|
|
||||||
data->rta_len = (void *)NLMSG_TAIL(n) - (void *)data;
|
addattr_nest_end(n, data);
|
||||||
return argc - 1 - err;
|
return argc - 1 - err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,8 +147,7 @@ static int flow_parse_opt(struct filter_util *fu, char *handle,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 4096, TCA_OPTIONS);
|
||||||
addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (matches(*argv, "map") == 0) {
|
if (matches(*argv, "map") == 0) {
|
||||||
@ -259,7 +258,7 @@ static int flow_parse_opt(struct filter_util *fu, char *handle,
|
|||||||
addattr32(n, 4096, TCA_FLOW_XOR, xor);
|
addattr32(n, 4096, TCA_FLOW_XOR, xor);
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +67,7 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
|
|||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 4096, TCA_OPTIONS);
|
||||||
addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
if (mask_set)
|
if (mask_set)
|
||||||
addattr32(n, MAX_MSG, TCA_FW_MASK, mask);
|
addattr32(n, MAX_MSG, TCA_FW_MASK, mask);
|
||||||
@ -119,7 +118,7 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
|
|||||||
}
|
}
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +50,7 @@ static int route_parse_opt(struct filter_util *qu, char *handle, int argc, char
|
|||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 4096, TCA_OPTIONS);
|
||||||
addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (matches(*argv, "to") == 0) {
|
if (matches(*argv, "to") == 0) {
|
||||||
@ -128,7 +127,7 @@ static int route_parse_opt(struct filter_util *qu, char *handle, int argc, char
|
|||||||
}
|
}
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
if (order) {
|
if (order) {
|
||||||
fh &= ~0x7F00;
|
fh &= ~0x7F00;
|
||||||
fh |= (order<<8)&0x7F00;
|
fh |= (order<<8)&0x7F00;
|
||||||
|
@ -188,8 +188,7 @@ static int rsvp_parse_opt(struct filter_util *qu, char *handle, int argc,
|
|||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 4096, TCA_OPTIONS);
|
||||||
addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (matches(*argv, "session") == 0) {
|
if (matches(*argv, "session") == 0) {
|
||||||
@ -294,7 +293,7 @@ static int rsvp_parse_opt(struct filter_util *qu, char *handle, int argc,
|
|||||||
|
|
||||||
if (pinfo_ok)
|
if (pinfo_ok)
|
||||||
addattr_l(n, 4096, TCA_RSVP_PINFO, &pinfo, sizeof(pinfo));
|
addattr_l(n, 4096, TCA_RSVP_PINFO, &pinfo, sizeof(pinfo));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,7 @@ static int tcindex_parse_opt(struct filter_util *qu, char *handle, int argc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!argc) return 0;
|
if (!argc) return 0;
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 4096, TCA_OPTIONS);
|
||||||
addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
|
|
||||||
while (argc) {
|
while (argc) {
|
||||||
if (!strcmp(*argv, "hash")) {
|
if (!strcmp(*argv, "hash")) {
|
||||||
int hash;
|
int hash;
|
||||||
@ -113,7 +112,7 @@ static int tcindex_parse_opt(struct filter_util *qu, char *handle, int argc,
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,8 +1003,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
|
|||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, TCA_OPTIONS);
|
||||||
addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (matches(*argv, "match") == 0) {
|
if (matches(*argv, "match") == 0) {
|
||||||
@ -1197,7 +1196,7 @@ static int u32_parse_opt(struct filter_util *qu, char *handle,
|
|||||||
addattr_l(n, MAX_MSG, TCA_U32_FLAGS, &flags, 4);
|
addattr_l(n, MAX_MSG, TCA_U32_FLAGS, &flags, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,9 +166,7 @@ int parse_action(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
|
|||||||
if (argc <= 0)
|
if (argc <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
tail = tail2 = NLMSG_TAIL(n);
|
tail2 = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
|
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
|
|
||||||
@ -213,8 +211,7 @@ done0:
|
|||||||
goto bad_val;
|
goto bad_val;
|
||||||
|
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, ++prio);
|
||||||
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,
|
ret = a->parse_aopt(a, &argc, &argv, TCA_ACT_OPTIONS,
|
||||||
@ -252,7 +249,7 @@ done0:
|
|||||||
addattr_l(n, MAX_MSG, TCA_ACT_COOKIE,
|
addattr_l(n, MAX_MSG, TCA_ACT_COOKIE,
|
||||||
&act_ck, act_ck_len);
|
&act_ck, act_ck_len);
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
ok++;
|
ok++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +259,7 @@ done0:
|
|||||||
goto bad_val;
|
goto bad_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail2->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail2;
|
addattr_nest_end(n, tail2);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
@ -468,8 +465,7 @@ static int tc_action_gd(int cmd, unsigned int flags,
|
|||||||
argv += 1;
|
argv += 1;
|
||||||
|
|
||||||
|
|
||||||
tail = NLMSG_TAIL(&req.n);
|
tail = addattr_nest(&req.n, MAX_MSG, TCA_ACT_TAB);
|
||||||
addattr_l(&req.n, MAX_MSG, TCA_ACT_TAB, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (strcmp(*argv, "action") == 0) {
|
if (strcmp(*argv, "action") == 0) {
|
||||||
@ -518,16 +514,15 @@ static int tc_action_gd(int cmd, unsigned int flags,
|
|||||||
goto bad_val;
|
goto bad_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail2 = NLMSG_TAIL(&req.n);
|
tail2 = addattr_nest(&req.n, MAX_MSG, ++prio);
|
||||||
addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
|
|
||||||
addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
|
addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
addattr32(&req.n, MAX_MSG, TCA_ACT_INDEX, i);
|
addattr32(&req.n, MAX_MSG, TCA_ACT_INDEX, i);
|
||||||
tail2->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail2;
|
addattr_nest_end(&req.n, tail2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
|
addattr_nest_end(&req.n, tail);
|
||||||
|
|
||||||
req.n.nlmsg_seq = rth.dump = ++rth.seq;
|
req.n.nlmsg_seq = rth.dump = ++rth.seq;
|
||||||
|
|
||||||
@ -626,8 +621,7 @@ static int tc_act_list_or_flush(int *argc_p, char ***argv_p, int event)
|
|||||||
.t.tca_family = AF_UNSPEC,
|
.t.tca_family = AF_UNSPEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
tail = NLMSG_TAIL(&req.n);
|
tail = addattr_nest(&req.n, MAX_MSG, TCA_ACT_TAB);
|
||||||
addattr_l(&req.n, MAX_MSG, TCA_ACT_TAB, NULL, 0);
|
|
||||||
tail2 = NLMSG_TAIL(&req.n);
|
tail2 = NLMSG_TAIL(&req.n);
|
||||||
|
|
||||||
strncpy(k, *argv, sizeof(k) - 1);
|
strncpy(k, *argv, sizeof(k) - 1);
|
||||||
@ -659,7 +653,7 @@ static int tc_act_list_or_flush(int *argc_p, char ***argv_p, int event)
|
|||||||
addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
|
addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
|
||||||
addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
|
addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
|
||||||
tail2->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail2;
|
tail2->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail2;
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
|
addattr_nest_end(&req.n, tail);
|
||||||
|
|
||||||
tail3 = NLMSG_TAIL(&req.n);
|
tail3 = NLMSG_TAIL(&req.n);
|
||||||
flag_select.value |= TCA_FLAG_LARGE_DUMP_ON;
|
flag_select.value |= TCA_FLAG_LARGE_DUMP_ON;
|
||||||
|
@ -90,8 +90,7 @@ static int bpf_parse_opt(struct action_util *a, int *ptr_argc, char ***ptr_argv,
|
|||||||
|
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (matches(*argv, "run") == 0) {
|
if (matches(*argv, "run") == 0) {
|
||||||
@ -144,7 +143,7 @@ opt_bpf:
|
|||||||
}
|
}
|
||||||
|
|
||||||
addattr_l(n, MAX_MSG, TCA_ACT_BPF_PARMS, &parm, sizeof(parm));
|
addattr_l(n, MAX_MSG, TCA_ACT_BPF_PARMS, &parm, sizeof(parm));
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
if (bpf_uds_name)
|
if (bpf_uds_name)
|
||||||
ret = bpf_send_map_fds(bpf_uds_name, bpf_obj);
|
ret = bpf_send_map_fds(bpf_uds_name, bpf_obj);
|
||||||
|
@ -96,10 +96,9 @@ parse_connmark(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_CONNMARK_PARMS, &sel, sizeof(sel));
|
addattr_l(n, MAX_MSG, TCA_CONNMARK_PARMS, &sel, sizeof(sel));
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -139,10 +139,9 @@ parse_csum(struct action_util *a, int *argc_p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_CSUM_PARMS, &sel, sizeof(sel));
|
addattr_l(n, MAX_MSG, TCA_CSUM_PARMS, &sel, sizeof(sel));
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -175,13 +175,13 @@ static int parse_tree(struct nlmsghdr *n, struct ematch *tree)
|
|||||||
struct ematch *t;
|
struct ematch *t;
|
||||||
|
|
||||||
for (t = tree; t; t = t->next) {
|
for (t = tree; t; t = t->next) {
|
||||||
struct rtattr *tail = NLMSG_TAIL(n);
|
struct rtattr *tail;
|
||||||
struct tcf_ematch_hdr hdr = { .flags = t->relation };
|
struct tcf_ematch_hdr hdr = { .flags = t->relation };
|
||||||
|
|
||||||
if (t->inverted)
|
if (t->inverted)
|
||||||
hdr.flags |= TCF_EM_INVERT;
|
hdr.flags |= TCF_EM_INVERT;
|
||||||
|
|
||||||
addattr_l(n, MAX_MSG, index++, NULL, 0);
|
tail = addattr_nest(n, MAX_MSG, index++);
|
||||||
|
|
||||||
if (t->child) {
|
if (t->child) {
|
||||||
__u32 r = t->child_ref;
|
__u32 r = t->child_ref;
|
||||||
@ -216,7 +216,7 @@ static int parse_tree(struct nlmsghdr *n, struct ematch *tree)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -341,18 +341,16 @@ int parse_ematch(int *argc_p, char ***argv_p, int tca_id, struct nlmsghdr *n)
|
|||||||
.progid = TCF_EM_PROG_TC
|
.progid = TCF_EM_PROG_TC
|
||||||
};
|
};
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_EMATCH_TREE_HDR, &hdr, sizeof(hdr));
|
addattr_l(n, MAX_MSG, TCA_EMATCH_TREE_HDR, &hdr, sizeof(hdr));
|
||||||
|
|
||||||
tail_list = NLMSG_TAIL(n);
|
tail_list = addattr_nest(n, MAX_MSG, TCA_EMATCH_TREE_LIST);
|
||||||
addattr_l(n, MAX_MSG, TCA_EMATCH_TREE_LIST, NULL, 0);
|
|
||||||
|
|
||||||
if (parse_tree(n, ematch_root) < 0)
|
if (parse_tree(n, ematch_root) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
tail_list->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail_list;
|
addattr_nest_end(n, tail_list);
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
*argc_p = ematch_argc;
|
*argc_p = ematch_argc;
|
||||||
|
@ -148,14 +148,13 @@ parse_gact(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_GACT_PARMS, &p, sizeof(p));
|
addattr_l(n, MAX_MSG, TCA_GACT_PARMS, &p, sizeof(p));
|
||||||
#ifdef CONFIG_GACT_PROB
|
#ifdef CONFIG_GACT_PROB
|
||||||
if (rd)
|
if (rd)
|
||||||
addattr_l(n, MAX_MSG, TCA_GACT_PROB, &pp, sizeof(pp));
|
addattr_l(n, MAX_MSG, TCA_GACT_PROB, &pp, sizeof(pp));
|
||||||
#endif
|
#endif
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
10
tc/m_ife.c
10
tc/m_ife.c
@ -178,8 +178,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
ife_usage();
|
ife_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_IFE_PARMS, &p, sizeof(p));
|
addattr_l(n, MAX_MSG, TCA_IFE_PARMS, &p, sizeof(p));
|
||||||
|
|
||||||
if (!(p.flags & IFE_ENCODE))
|
if (!(p.flags & IFE_ENCODE))
|
||||||
@ -194,8 +193,7 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
if (saddr)
|
if (saddr)
|
||||||
addattr_l(n, MAX_MSG, TCA_IFE_SMAC, sbuf, ETH_ALEN);
|
addattr_l(n, MAX_MSG, TCA_IFE_SMAC, sbuf, ETH_ALEN);
|
||||||
|
|
||||||
tail2 = NLMSG_TAIL(n);
|
tail2 = addattr_nest(n, MAX_MSG, TCA_IFE_METALST);
|
||||||
addattr_l(n, MAX_MSG, TCA_IFE_METALST, NULL, 0);
|
|
||||||
if (ife_mark || ife_mark_v) {
|
if (ife_mark || ife_mark_v) {
|
||||||
if (ife_mark_v)
|
if (ife_mark_v)
|
||||||
addattr_l(n, MAX_MSG, IFE_META_SKBMARK, &ife_mark_v, 4);
|
addattr_l(n, MAX_MSG, IFE_META_SKBMARK, &ife_mark_v, 4);
|
||||||
@ -216,10 +214,10 @@ static int parse_ife(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
addattr_l(n, MAX_MSG, IFE_META_TCINDEX, NULL, 0);
|
addattr_l(n, MAX_MSG, IFE_META_TCINDEX, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
tail2->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail2;
|
addattr_nest_end(n, tail2);
|
||||||
|
|
||||||
skip_encode:
|
skip_encode:
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -383,8 +383,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
|
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
|
||||||
fprintf(stdout, "\ttarget: ");
|
fprintf(stdout, "\ttarget: ");
|
||||||
|
|
||||||
@ -405,7 +404,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
|
|||||||
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
|
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
|
||||||
if (m)
|
if (m)
|
||||||
addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
|
addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
@ -225,10 +225,9 @@ parse_direction(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_MIRRED_PARMS, &p, sizeof(p));
|
addattr_l(n, MAX_MSG, TCA_MIRRED_PARMS, &p, sizeof(p));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -129,10 +129,9 @@ parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, struct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_NAT_PARMS, &sel, sizeof(sel));
|
addattr_l(n, MAX_MSG, TCA_NAT_PARMS, &sel, sizeof(sel));
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -686,8 +686,7 @@ int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
if (!sel.extended) {
|
if (!sel.extended) {
|
||||||
addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS, &sel,
|
addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS, &sel,
|
||||||
sizeof(sel.sel) +
|
sizeof(sel.sel) +
|
||||||
@ -700,7 +699,7 @@ int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|||||||
pedit_keys_ex_addattr(&sel, n);
|
pedit_keys_ex_addattr(&sel, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -228,8 +228,7 @@ int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_POLICE_TBF, &p, sizeof(p));
|
addattr_l(n, MAX_MSG, TCA_POLICE_TBF, &p, sizeof(p));
|
||||||
if (p.rate.rate)
|
if (p.rate.rate)
|
||||||
addattr_l(n, MAX_MSG, TCA_POLICE_RATE, rtab, 1024);
|
addattr_l(n, MAX_MSG, TCA_POLICE_RATE, rtab, 1024);
|
||||||
@ -240,7 +239,7 @@ int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
if (presult)
|
if (presult)
|
||||||
addattr32(n, MAX_MSG, TCA_POLICE_RESULT, presult);
|
addattr32(n, MAX_MSG, TCA_POLICE_RESULT, presult);
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
|
@ -122,8 +122,7 @@ static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_SAMPLE_PARMS, &p, sizeof(p));
|
addattr_l(n, MAX_MSG, TCA_SAMPLE_PARMS, &p, sizeof(p));
|
||||||
if (rate_set)
|
if (rate_set)
|
||||||
addattr32(n, MAX_MSG, TCA_SAMPLE_RATE, rate);
|
addattr32(n, MAX_MSG, TCA_SAMPLE_RATE, rate);
|
||||||
@ -132,7 +131,7 @@ static int parse_sample(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
if (trunc_set)
|
if (trunc_set)
|
||||||
addattr32(n, MAX_MSG, TCA_SAMPLE_TRUNC_SIZE, trunc);
|
addattr32(n, MAX_MSG, TCA_SAMPLE_TRUNC_SIZE, trunc);
|
||||||
|
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -146,12 +146,11 @@ parse_simple(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|||||||
|
|
||||||
sel.action = TC_ACT_PIPE;
|
sel.action = TC_ACT_PIPE;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_DEF_PARMS, &sel, sizeof(sel));
|
addattr_l(n, MAX_MSG, TCA_DEF_PARMS, &sel, sizeof(sel));
|
||||||
if (simpdata)
|
if (simpdata)
|
||||||
addattr_l(n, MAX_MSG, TCA_DEF_DATA, simpdata, SIMP_MAX_DATA);
|
addattr_l(n, MAX_MSG, TCA_DEF_DATA, simpdata, SIMP_MAX_DATA);
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -143,8 +143,7 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_SKBEDIT_PARMS, &sel, sizeof(sel));
|
addattr_l(n, MAX_MSG, TCA_SKBEDIT_PARMS, &sel, sizeof(sel));
|
||||||
if (flags & SKBEDIT_F_QUEUE_MAPPING)
|
if (flags & SKBEDIT_F_QUEUE_MAPPING)
|
||||||
addattr_l(n, MAX_MSG, TCA_SKBEDIT_QUEUE_MAPPING,
|
addattr_l(n, MAX_MSG, TCA_SKBEDIT_QUEUE_MAPPING,
|
||||||
@ -158,7 +157,7 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
|
|||||||
if (flags & SKBEDIT_F_PTYPE)
|
if (flags & SKBEDIT_F_PTYPE)
|
||||||
addattr_l(n, MAX_MSG, TCA_SKBEDIT_PTYPE,
|
addattr_l(n, MAX_MSG, TCA_SKBEDIT_PTYPE,
|
||||||
&ptype, sizeof(ptype));
|
&ptype, sizeof(ptype));
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -143,8 +143,7 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
skbmod_usage();
|
skbmod_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_SKBMOD_PARMS, &p, sizeof(p));
|
addattr_l(n, MAX_MSG, TCA_SKBMOD_PARMS, &p, sizeof(p));
|
||||||
|
|
||||||
if (daddr)
|
if (daddr)
|
||||||
@ -154,7 +153,7 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
if (saddr)
|
if (saddr)
|
||||||
addattr_l(n, MAX_MSG, TCA_SKBMOD_SMAC, sbuf, ETH_ALEN);
|
addattr_l(n, MAX_MSG, TCA_SKBMOD_SMAC, sbuf, ETH_ALEN);
|
||||||
|
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -98,8 +98,7 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
if (matches(*argv, "tunnel_key") != 0)
|
if (matches(*argv, "tunnel_key") != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
|
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
|
|
||||||
@ -197,7 +196,7 @@ static int parse_tunnel_key(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
|
|
||||||
parm.t_action = action;
|
parm.t_action = action;
|
||||||
addattr_l(n, MAX_MSG, TCA_TUNNEL_KEY_PARMS, &parm, sizeof(parm));
|
addattr_l(n, MAX_MSG, TCA_TUNNEL_KEY_PARMS, &parm, sizeof(parm));
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -152,8 +152,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
}
|
}
|
||||||
|
|
||||||
parm.v_action = action;
|
parm.v_action = action;
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm));
|
addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm));
|
||||||
if (id_set)
|
if (id_set)
|
||||||
addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_ID, &id, 2);
|
addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_ID, &id, 2);
|
||||||
@ -170,7 +169,7 @@ static int parse_vlan(struct action_util *a, int *argc_p, char ***argv_p,
|
|||||||
if (prio_set)
|
if (prio_set)
|
||||||
addattr8(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_PRIORITY, prio);
|
addattr8(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_PRIORITY, prio);
|
||||||
|
|
||||||
tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
*argc_p = argc;
|
*argc_p = argc;
|
||||||
*argv_p = argv;
|
*argv_p = argv;
|
||||||
|
@ -264,8 +264,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
|
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
|
||||||
fprintf(stdout, "\ttarget: ");
|
fprintf(stdout, "\ttarget: ");
|
||||||
|
|
||||||
@ -290,7 +289,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
|
|||||||
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
|
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
|
||||||
if (m)
|
if (m)
|
||||||
addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
|
addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
argv += optind;
|
argv += optind;
|
||||||
*argc_p -= argc;
|
*argc_p -= argc;
|
||||||
|
@ -308,8 +308,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, MAX_MSG, tca_id);
|
||||||
addattr_l(n, MAX_MSG, tca_id, NULL, 0);
|
|
||||||
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
|
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
|
||||||
fprintf(stdout, "\ttarget: ");
|
fprintf(stdout, "\ttarget: ");
|
||||||
|
|
||||||
@ -330,7 +329,7 @@ static int parse_ipt(struct action_util *a, int *argc_p,
|
|||||||
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
|
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
|
||||||
if (m)
|
if (m)
|
||||||
addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
|
addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
11
tc/q_atm.c
11
tc/q_atm.c
@ -167,12 +167,13 @@ static int atm_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
perror("ioctl ATMARP_MKIP");
|
perror("ioctl ATMARP_MKIP");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_ATM_FD, &s, sizeof(s));
|
addattr_l(n, 1024, TCA_ATM_FD, &s, sizeof(s));
|
||||||
if (excess) addattr_l(n, 1024, TCA_ATM_EXCESS, &excess, sizeof(excess));
|
if (excess)
|
||||||
if (hdr_len != -1) addattr_l(n, 1024, TCA_ATM_HDR, hdr, hdr_len);
|
addattr_l(n, 1024, TCA_ATM_EXCESS, &excess, sizeof(excess));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
if (hdr_len != -1)
|
||||||
|
addattr_l(n, 1024, TCA_ATM_HDR, hdr, hdr_len);
|
||||||
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
tc/q_cbq.c
10
tc/q_cbq.c
@ -165,8 +165,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
|
|||||||
lss.change = TCF_CBQ_LSS_MAXIDLE|TCF_CBQ_LSS_EWMA|TCF_CBQ_LSS_AVPKT;
|
lss.change = TCF_CBQ_LSS_MAXIDLE|TCF_CBQ_LSS_EWMA|TCF_CBQ_LSS_AVPKT;
|
||||||
lss.avpkt = avpkt;
|
lss.avpkt = avpkt;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_CBQ_RATE, &r, sizeof(r));
|
addattr_l(n, 1024, TCA_CBQ_RATE, &r, sizeof(r));
|
||||||
addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss));
|
addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss));
|
||||||
addattr_l(n, 3024, TCA_CBQ_RTAB, rtab, 1024);
|
addattr_l(n, 3024, TCA_CBQ_RTAB, rtab, 1024);
|
||||||
@ -177,7 +176,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
|
|||||||
printf("%u ", rtab[i]);
|
printf("%u ", rtab[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,8 +418,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
|
|||||||
lss.change |= TCF_CBQ_LSS_EWMA;
|
lss.change |= TCF_CBQ_LSS_EWMA;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
if (lss.change) {
|
if (lss.change) {
|
||||||
lss.change |= TCF_CBQ_LSS_FLAGS;
|
lss.change |= TCF_CBQ_LSS_FLAGS;
|
||||||
addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss));
|
addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss));
|
||||||
@ -440,7 +438,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,10 +102,9 @@ static int cbs_parse_opt(struct qdisc_util *qu, int argc,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 2024, TCA_CBS_PARMS, &opt, sizeof(opt));
|
addattr_l(n, 2024, TCA_CBS_PARMS, &opt, sizeof(opt));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,13 +156,12 @@ static int choke_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
if (ecn_ok)
|
if (ecn_ok)
|
||||||
opt.flags |= TC_RED_ECN;
|
opt.flags |= TC_RED_ECN;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_CHOKE_PARMS, &opt, sizeof(opt));
|
addattr_l(n, 1024, TCA_CHOKE_PARMS, &opt, sizeof(opt));
|
||||||
addattr_l(n, 1024, TCA_CHOKE_STAB, sbuf, 256);
|
addattr_l(n, 1024, TCA_CHOKE_STAB, sbuf, 256);
|
||||||
max_P = probability * pow(2, 32);
|
max_P = probability * pow(2, 32);
|
||||||
addattr_l(n, 1024, TCA_CHOKE_MAX_P, &max_P, sizeof(max_P));
|
addattr_l(n, 1024, TCA_CHOKE_MAX_P, &max_P, sizeof(max_P));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +107,7 @@ static int codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
if (limit)
|
if (limit)
|
||||||
addattr_l(n, 1024, TCA_CODEL_LIMIT, &limit, sizeof(limit));
|
addattr_l(n, 1024, TCA_CODEL_LIMIT, &limit, sizeof(limit));
|
||||||
if (interval)
|
if (interval)
|
||||||
@ -121,7 +120,7 @@ static int codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
addattr_l(n, 1024, TCA_CODEL_CE_THRESHOLD,
|
addattr_l(n, 1024, TCA_CODEL_CE_THRESHOLD,
|
||||||
&ce_threshold, sizeof(ce_threshold));
|
&ce_threshold, sizeof(ce_threshold));
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +55,7 @@ static int drr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
struct rtattr *tail;
|
struct rtattr *tail;
|
||||||
__u32 tmp;
|
__u32 tmp;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (strcmp(*argv, "quantum") == 0) {
|
if (strcmp(*argv, "quantum") == 0) {
|
||||||
@ -77,7 +76,7 @@ static int drr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,16 +64,16 @@ static int dsmark_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
explain();
|
explain();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_DSMARK_INDICES, &ind, sizeof(ind));
|
addattr_l(n, 1024, TCA_DSMARK_INDICES, &ind, sizeof(ind));
|
||||||
if (dflt != -1) {
|
if (dflt != -1) {
|
||||||
__u16 tmp = dflt;
|
__u16 tmp = dflt;
|
||||||
|
|
||||||
addattr_l(n, 1024, TCA_DSMARK_DEFAULT_INDEX, &tmp, sizeof(tmp));
|
addattr_l(n, 1024, TCA_DSMARK_DEFAULT_INDEX, &tmp, sizeof(tmp));
|
||||||
}
|
}
|
||||||
if (set_tc_index) addattr_l(n, 1024, TCA_DSMARK_SET_TC_INDEX, NULL, 0);
|
if (set_tc_index)
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_l(n, 1024, TCA_DSMARK_SET_TC_INDEX, NULL, 0);
|
||||||
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,8 +91,7 @@ static int dsmark_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
__u8 tmp;
|
__u8 tmp;
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (!strcmp(*argv, "mask")) {
|
if (!strcmp(*argv, "mask")) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
@ -117,7 +116,7 @@ static int dsmark_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,8 +190,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
if (buckets) {
|
if (buckets) {
|
||||||
unsigned int log = ilog2(buckets);
|
unsigned int log = ilog2(buckets);
|
||||||
|
|
||||||
@ -227,7 +226,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
if (set_orphan_mask)
|
if (set_orphan_mask)
|
||||||
addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK,
|
addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK,
|
||||||
&orphan_mask, sizeof(refill_delay));
|
&orphan_mask, sizeof(refill_delay));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,8 +126,7 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
if (limit)
|
if (limit)
|
||||||
addattr_l(n, 1024, TCA_FQ_CODEL_LIMIT, &limit, sizeof(limit));
|
addattr_l(n, 1024, TCA_FQ_CODEL_LIMIT, &limit, sizeof(limit));
|
||||||
if (flows)
|
if (flows)
|
||||||
@ -147,7 +146,7 @@ static int fq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
addattr_l(n, 1024, TCA_FQ_CODEL_MEMORY_LIMIT,
|
addattr_l(n, 1024, TCA_FQ_CODEL_MEMORY_LIMIT,
|
||||||
&memory, sizeof(memory));
|
&memory, sizeof(memory));
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
tc/q_gred.c
10
tc/q_gred.c
@ -105,12 +105,11 @@ static int init_gred(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
|
|
||||||
DPRINTF("TC_GRED: sending DPs=%u def_DP=%u\n", opt.DPs, opt.def_DP);
|
DPRINTF("TC_GRED: sending DPs=%u def_DP=%u\n", opt.DPs, opt.def_DP);
|
||||||
n->nlmsg_flags |= NLM_F_CREATE;
|
n->nlmsg_flags |= NLM_F_CREATE;
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
|
addattr_l(n, 1024, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
|
||||||
if (limit)
|
if (limit)
|
||||||
addattr32(n, 1024, TCA_GRED_LIMIT, limit);
|
addattr32(n, 1024, TCA_GRED_LIMIT, limit);
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -257,13 +256,12 @@ static int gred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct n
|
|||||||
}
|
}
|
||||||
opt.Scell_log = parm;
|
opt.Scell_log = parm;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_GRED_PARMS, &opt, sizeof(opt));
|
addattr_l(n, 1024, TCA_GRED_PARMS, &opt, sizeof(opt));
|
||||||
addattr_l(n, 1024, TCA_GRED_STAB, sbuf, 256);
|
addattr_l(n, 1024, TCA_GRED_STAB, sbuf, 256);
|
||||||
max_P = probability * pow(2, 32);
|
max_P = probability * pow(2, 32);
|
||||||
addattr32(n, 1024, TCA_GRED_MAX_P, max_P);
|
addattr32(n, 1024, TCA_GRED_MAX_P, max_P);
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,9 +201,7 @@ hfsc_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
|
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
if (rsc_ok)
|
if (rsc_ok)
|
||||||
addattr_l(n, 1024, TCA_HFSC_RSC, &rsc, sizeof(rsc));
|
addattr_l(n, 1024, TCA_HFSC_RSC, &rsc, sizeof(rsc));
|
||||||
if (fsc_ok)
|
if (fsc_ok)
|
||||||
@ -211,7 +209,7 @@ hfsc_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
if (usc_ok)
|
if (usc_ok)
|
||||||
addattr_l(n, 1024, TCA_HFSC_USC, &usc, sizeof(usc));
|
addattr_l(n, 1024, TCA_HFSC_USC, &usc, sizeof(usc));
|
||||||
|
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +91,7 @@ static int hhf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
if (limit)
|
if (limit)
|
||||||
addattr_l(n, 1024, TCA_HHF_BACKLOG_LIMIT, &limit,
|
addattr_l(n, 1024, TCA_HHF_BACKLOG_LIMIT, &limit,
|
||||||
sizeof(limit));
|
sizeof(limit));
|
||||||
@ -113,7 +112,7 @@ static int hhf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
if (non_hh_weight)
|
if (non_hh_weight)
|
||||||
addattr_l(n, 1024, TCA_HHF_NON_HH_WEIGHT, &non_hh_weight,
|
addattr_l(n, 1024, TCA_HHF_NON_HH_WEIGHT, &non_hh_weight,
|
||||||
sizeof(non_hh_weight));
|
sizeof(non_hh_weight));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
tc/q_htb.c
10
tc/q_htb.c
@ -98,13 +98,12 @@ static int htb_parse_opt(struct qdisc_util *qu, int argc,
|
|||||||
}
|
}
|
||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
|
addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
|
||||||
if (direct_qlen != ~0U)
|
if (direct_qlen != ~0U)
|
||||||
addattr_l(n, 2024, TCA_HTB_DIRECT_QLEN,
|
addattr_l(n, 2024, TCA_HTB_DIRECT_QLEN,
|
||||||
&direct_qlen, sizeof(direct_qlen));
|
&direct_qlen, sizeof(direct_qlen));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,8 +253,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
|
|||||||
}
|
}
|
||||||
opt.cbuffer = tc_calc_xmittime(ceil64, cbuffer);
|
opt.cbuffer = tc_calc_xmittime(ceil64, cbuffer);
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
if (rate64 >= (1ULL << 32))
|
if (rate64 >= (1ULL << 32))
|
||||||
addattr_l(n, 1124, TCA_HTB_RATE64, &rate64, sizeof(rate64));
|
addattr_l(n, 1124, TCA_HTB_RATE64, &rate64, sizeof(rate64));
|
||||||
@ -266,7 +264,7 @@ static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
|
|||||||
addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
|
addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
|
||||||
addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
|
addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
|
||||||
addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024);
|
addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024);
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,8 +173,7 @@ static int mqprio_parse_opt(struct qdisc_util *qu, int argc,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest_compat(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
|
|
||||||
|
|
||||||
if (flags & TC_MQPRIO_F_MODE)
|
if (flags & TC_MQPRIO_F_MODE)
|
||||||
addattr_l(n, 1024, TCA_MQPRIO_MODE,
|
addattr_l(n, 1024, TCA_MQPRIO_MODE,
|
||||||
@ -209,7 +208,7 @@ static int mqprio_parse_opt(struct qdisc_util *qu, int argc,
|
|||||||
addattr_nest_end(n, start);
|
addattr_nest_end(n, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_compat_end(n, tail);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -422,8 +422,6 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
|
||||||
|
|
||||||
if (reorder.probability) {
|
if (reorder.probability) {
|
||||||
if (opt.latency == 0) {
|
if (opt.latency == 0) {
|
||||||
fprintf(stderr, "reordering not possible without specifying some delay\n");
|
fprintf(stderr, "reordering not possible without specifying some delay\n");
|
||||||
@ -452,8 +450,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)) < 0)
|
tail = addattr_nest_compat(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (present[TCA_NETEM_CORR] &&
|
if (present[TCA_NETEM_CORR] &&
|
||||||
addattr_l(n, 1024, TCA_NETEM_CORR, &cor, sizeof(cor)) < 0)
|
addattr_l(n, 1024, TCA_NETEM_CORR, &cor, sizeof(cor)) < 0)
|
||||||
@ -512,7 +509,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
return -1;
|
return -1;
|
||||||
free(dist_data);
|
free(dist_data);
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_compat_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,8 +103,7 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
if (limit)
|
if (limit)
|
||||||
addattr_l(n, 1024, TCA_PIE_LIMIT, &limit, sizeof(limit));
|
addattr_l(n, 1024, TCA_PIE_LIMIT, &limit, sizeof(limit));
|
||||||
if (tupdate)
|
if (tupdate)
|
||||||
@ -121,7 +120,7 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
addattr_l(n, 1024, TCA_PIE_BYTEMODE, &bytemode,
|
addattr_l(n, 1024, TCA_PIE_BYTEMODE, &bytemode,
|
||||||
sizeof(bytemode));
|
sizeof(bytemode));
|
||||||
|
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +53,7 @@ static int qfq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
struct rtattr *tail;
|
struct rtattr *tail;
|
||||||
__u32 tmp;
|
__u32 tmp;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 4096, TCA_OPTIONS);
|
||||||
addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
|
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (matches(*argv, "weight") == 0) {
|
if (matches(*argv, "weight") == 0) {
|
||||||
@ -80,7 +79,7 @@ static int qfq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
argc--; argv++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
|
addattr_nest_end(n, tail);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -148,13 +148,12 @@ static int red_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
}
|
}
|
||||||
opt.Scell_log = parm;
|
opt.Scell_log = parm;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_RED_PARMS, &opt, sizeof(opt));
|
addattr_l(n, 1024, TCA_RED_PARMS, &opt, sizeof(opt));
|
||||||
addattr_l(n, 1024, TCA_RED_STAB, sbuf, 256);
|
addattr_l(n, 1024, TCA_RED_STAB, sbuf, 256);
|
||||||
max_P = probability * pow(2, 32);
|
max_P = probability * pow(2, 32);
|
||||||
addattr_l(n, 1024, TCA_RED_MAX_P, &max_P, sizeof(max_P));
|
addattr_l(n, 1024, TCA_RED_MAX_P, &max_P, sizeof(max_P));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,10 +132,9 @@ static int sfb_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
if (opt.bin_size == 0)
|
if (opt.bin_size == 0)
|
||||||
opt.bin_size = (opt.max * 4 + 3) / 5;
|
opt.bin_size = (opt.max * 4 + 3) / 5;
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 1024, TCA_SFB_PARMS, &opt, sizeof(opt));
|
addattr_l(n, 1024, TCA_SFB_PARMS, &opt, sizeof(opt));
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,8 +241,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
opt.mtu = tc_calc_xmittime(opt.peakrate.rate, mtu);
|
opt.mtu = tc_calc_xmittime(opt.peakrate.rate, mtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(n);
|
tail = addattr_nest(n, 1024, TCA_OPTIONS);
|
||||||
addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
|
|
||||||
addattr_l(n, 2024, TCA_TBF_PARMS, &opt, sizeof(opt));
|
addattr_l(n, 2024, TCA_TBF_PARMS, &opt, sizeof(opt));
|
||||||
addattr_l(n, 2124, TCA_TBF_BURST, &buffer, sizeof(buffer));
|
addattr_l(n, 2124, TCA_TBF_BURST, &buffer, sizeof(buffer));
|
||||||
if (rate64 >= (1ULL << 32))
|
if (rate64 >= (1ULL << 32))
|
||||||
@ -254,7 +253,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||||||
addattr_l(n, 3224, TCA_TBF_PBURST, &mtu, sizeof(mtu));
|
addattr_l(n, 3224, TCA_TBF_PBURST, &mtu, sizeof(mtu));
|
||||||
addattr_l(n, 4096, TCA_TBF_PTAB, ptab, 1024);
|
addattr_l(n, 4096, TCA_TBF_PTAB, ptab, 1024);
|
||||||
}
|
}
|
||||||
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
|
addattr_nest_end(n, tail);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,14 +182,13 @@ static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
tail = NLMSG_TAIL(&req.n);
|
tail = addattr_nest(&req.n, sizeof(req), TCA_STAB);
|
||||||
addattr_l(&req.n, sizeof(req), TCA_STAB, NULL, 0);
|
|
||||||
addattr_l(&req.n, sizeof(req), TCA_STAB_BASE, &stab.szopts,
|
addattr_l(&req.n, sizeof(req), TCA_STAB_BASE, &stab.szopts,
|
||||||
sizeof(stab.szopts));
|
sizeof(stab.szopts));
|
||||||
if (stab.data)
|
if (stab.data)
|
||||||
addattr_l(&req.n, sizeof(req), TCA_STAB_DATA, stab.data,
|
addattr_l(&req.n, sizeof(req), TCA_STAB_DATA, stab.data,
|
||||||
stab.szopts.tsize * sizeof(__u16));
|
stab.szopts.tsize * sizeof(__u16));
|
||||||
tail->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail;
|
addattr_nest_end(&req.n, tail);
|
||||||
if (stab.data)
|
if (stab.data)
|
||||||
free(stab.data);
|
free(stab.data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user