else
iflatype = IFLA_INFO_DATA;
if (lu && argc) {
- struct rtattr *data
- = addattr_nest(&req.n,
- sizeof(req), iflatype);
+ struct rtattr *data;
+
+ data = addattr_nest(&req.n, sizeof(req), iflatype);
if (lu->parse_opt &&
lu->parse_opt(lu, argc, argv, &req.n))
struct ifla_vlan_qos_mapping m;
struct rtattr *tail;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, attrtype, NULL, 0);
+ tail = addattr_nest(n, 1024, attrtype);
while (argc > 0) {
char *colon = strchr(*argv, ':');
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;
*argvp = argv;
ifm->ifi_flags = 0;
ifm->ifi_change = 0;
- data = NLMSG_TAIL(n);
- addattr_l(n, 1024, VXCAN_INFO_PEER, NULL, 0);
+ data = addattr_nest(n, 1024, VXCAN_INFO_PEER);
n->nlmsg_len += sizeof(struct ifinfomsg);
if (group != -1)
addattr32(n, 1024, IFLA_GROUP, group);
- data->rta_len = (void *)NLMSG_TAIL(n) - (void *)data;
+ addattr_nest_end(n, data);
return argc - 1 - err;
}
ifm->ifi_flags = 0;
ifm->ifi_change = 0;
- data = NLMSG_TAIL(n);
- addattr_l(n, 1024, VETH_INFO_PEER, NULL, 0);
+ data = addattr_nest(n, 1024, VETH_INFO_PEER);
n->nlmsg_len += sizeof(struct ifinfomsg);
if (group != -1)
addattr32(n, 1024, IFLA_GROUP, group);
- data->rta_len = (void *)NLMSG_TAIL(n) - (void *)data;
+ addattr_nest_end(n, data);
return argc - 1 - err;
}
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 4096, TCA_OPTIONS);
while (argc > 0) {
if (matches(*argv, "map") == 0) {
addattr32(n, 4096, TCA_FLOW_XOR, xor);
}
- tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+ addattr_nest_end(n, tail);
return 0;
}
if (argc == 0)
return 0;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 4096, TCA_OPTIONS);
if (mask_set)
addattr32(n, MAX_MSG, TCA_FW_MASK, mask);
}
argc--; argv++;
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
if (argc == 0)
return 0;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 4096, TCA_OPTIONS);
while (argc > 0) {
if (matches(*argv, "to") == 0) {
}
argc--; argv++;
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
if (order) {
fh &= ~0x7F00;
fh |= (order<<8)&0x7F00;
if (argc == 0)
return 0;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 4096, TCA_OPTIONS);
while (argc > 0) {
if (matches(*argv, "session") == 0) {
if (pinfo_ok)
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;
}
}
}
if (!argc) return 0;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 4096, TCA_OPTIONS);
while (argc) {
if (!strcmp(*argv, "hash")) {
int hash;
argc--;
argv++;
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
if (argc == 0)
return 0;
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, TCA_OPTIONS);
while (argc > 0) {
if (matches(*argv, "match") == 0) {
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;
}
if (argc <= 0)
return -1;
- tail = tail2 = NLMSG_TAIL(n);
-
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail2 = addattr_nest(n, MAX_MSG, tca_id);
while (argc > 0) {
goto bad_val;
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, ++prio, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, ++prio);
addattr_l(n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
ret = a->parse_aopt(a, &argc, &argv, TCA_ACT_OPTIONS,
addattr_l(n, MAX_MSG, TCA_ACT_COOKIE,
&act_ck, act_ck_len);
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
ok++;
}
}
goto bad_val;
}
- tail2->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail2;
+ addattr_nest_end(n, tail2);
done:
*argc_p = argc;
argv += 1;
- tail = NLMSG_TAIL(&req.n);
- addattr_l(&req.n, MAX_MSG, TCA_ACT_TAB, NULL, 0);
+ tail = addattr_nest(&req.n, MAX_MSG, TCA_ACT_TAB);
while (argc > 0) {
if (strcmp(*argv, "action") == 0) {
goto bad_val;
}
- tail2 = NLMSG_TAIL(&req.n);
- addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
+ tail2 = addattr_nest(&req.n, MAX_MSG, ++prio);
addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
if (i > 0)
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;
.t.tca_family = AF_UNSPEC,
};
- tail = NLMSG_TAIL(&req.n);
- addattr_l(&req.n, MAX_MSG, TCA_ACT_TAB, NULL, 0);
+ tail = addattr_nest(&req.n, MAX_MSG, TCA_ACT_TAB);
tail2 = NLMSG_TAIL(&req.n);
strncpy(k, *argv, sizeof(k) - 1);
addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
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);
flag_select.value |= TCA_FLAG_LARGE_DUMP_ON;
NEXT_ARG();
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
while (argc > 0) {
if (matches(*argv, "run") == 0) {
}
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)
ret = bpf_send_map_fds(bpf_uds_name, bpf_obj);
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
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;
*argv_p = argv;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
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;
*argv_p = argv;
struct ematch *t;
for (t = tree; t; t = t->next) {
- struct rtattr *tail = NLMSG_TAIL(n);
+ struct rtattr *tail;
struct tcf_ematch_hdr hdr = { .flags = t->relation };
if (t->inverted)
hdr.flags |= TCF_EM_INVERT;
- addattr_l(n, MAX_MSG, index++, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, index++);
if (t->child) {
__u32 r = t->child_ref;
return -1;
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
}
return 0;
.progid = TCF_EM_PROG_TC
};
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_EMATCH_TREE_HDR, &hdr, sizeof(hdr));
- tail_list = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, TCA_EMATCH_TREE_LIST, NULL, 0);
+ tail_list = addattr_nest(n, MAX_MSG, TCA_EMATCH_TREE_LIST);
if (parse_tree(n, ematch_root) < 0)
return -1;
- tail_list->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail_list;
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail_list);
+ addattr_nest_end(n, tail);
}
*argc_p = ematch_argc;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_GACT_PARMS, &p, sizeof(p));
#ifdef CONFIG_GACT_PROB
if (rd)
addattr_l(n, MAX_MSG, TCA_GACT_PROB, &pp, sizeof(pp));
#endif
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
*argc_p = argc;
*argv_p = argv;
ife_usage();
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_IFE_PARMS, &p, sizeof(p));
if (!(p.flags & IFE_ENCODE))
if (saddr)
addattr_l(n, MAX_MSG, TCA_IFE_SMAC, sbuf, ETH_ALEN);
- tail2 = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, TCA_IFE_METALST, NULL, 0);
+ tail2 = addattr_nest(n, MAX_MSG, TCA_IFE_METALST);
if (ife_mark || 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_TCINDEX, NULL, 0);
}
- tail2->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail2;
+ addattr_nest_end(n, tail2);
skip_encode:
- tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+ addattr_nest_end(n, tail);
*argc_p = argc;
*argv_p = argv;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
fprintf(stdout, "\ttarget: ");
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
if (m)
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;
argv += optind;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
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;
*argv_p = argv;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
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;
*argv_p = argv;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
if (!sel.extended) {
addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS, &sel,
sizeof(sel.sel) +
pedit_keys_ex_addattr(&sel, n);
}
- tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+ addattr_nest_end(n, tail);
*argc_p = argc;
*argv_p = argv;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_POLICE_TBF, &p, sizeof(p));
if (p.rate.rate)
addattr_l(n, MAX_MSG, TCA_POLICE_RATE, rtab, 1024);
if (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;
*argc_p = argc;
usage();
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_SAMPLE_PARMS, &p, sizeof(p));
if (rate_set)
addattr32(n, MAX_MSG, TCA_SAMPLE_RATE, rate);
if (trunc_set)
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;
*argv_p = argv;
sel.action = TC_ACT_PIPE;
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_DEF_PARMS, &sel, sizeof(sel));
if (simpdata)
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;
*argv_p = argv;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_SKBEDIT_PARMS, &sel, sizeof(sel));
if (flags & SKBEDIT_F_QUEUE_MAPPING)
addattr_l(n, MAX_MSG, TCA_SKBEDIT_QUEUE_MAPPING,
if (flags & SKBEDIT_F_PTYPE)
addattr_l(n, MAX_MSG, TCA_SKBEDIT_PTYPE,
&ptype, sizeof(ptype));
- tail->rta_len = (char *)NLMSG_TAIL(n) - (char *)tail;
+ addattr_nest_end(n, tail);
*argc_p = argc;
*argv_p = argv;
skbmod_usage();
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_SKBMOD_PARMS, &p, sizeof(p));
if (daddr)
if (saddr)
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;
*argv_p = argv;
if (matches(*argv, "tunnel_key") != 0)
return -1;
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
NEXT_ARG();
parm.t_action = action;
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;
*argv_p = argv;
}
parm.v_action = action;
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_VLAN_PARMS, &parm, sizeof(parm));
if (id_set)
addattr_l(n, MAX_MSG, TCA_VLAN_PUSH_VLAN_ID, &id, 2);
if (prio_set)
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;
*argv_p = argv;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
fprintf(stdout, "\ttarget: ");
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
if (m)
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;
*argc_p -= argc;
}
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+ tail = addattr_nest(n, MAX_MSG, tca_id);
fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
fprintf(stdout, "\ttarget: ");
addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
if (m)
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;
argv += optind;
perror("ioctl ATMARP_MKIP");
return -1;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 1024, TCA_ATM_FD, &s, sizeof(s));
- if (excess) addattr_l(n, 1024, TCA_ATM_EXCESS, &excess, sizeof(excess));
- if (hdr_len != -1) addattr_l(n, 1024, TCA_ATM_HDR, hdr, hdr_len);
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ if (excess)
+ addattr_l(n, 1024, TCA_ATM_EXCESS, &excess, sizeof(excess));
+ if (hdr_len != -1)
+ addattr_l(n, 1024, TCA_ATM_HDR, hdr, hdr_len);
+ addattr_nest_end(n, tail);
return 0;
}
lss.change = TCF_CBQ_LSS_MAXIDLE|TCF_CBQ_LSS_EWMA|TCF_CBQ_LSS_AVPKT;
lss.avpkt = avpkt;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 1024, TCA_CBQ_RATE, &r, sizeof(r));
addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss));
addattr_l(n, 3024, TCA_CBQ_RTAB, rtab, 1024);
printf("%u ", rtab[i]);
printf("\n");
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
lss.change |= TCF_CBQ_LSS_EWMA;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (lss.change) {
lss.change |= TCF_CBQ_LSS_FLAGS;
addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss));
printf("\n");
}
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
argc--; argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
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;
}
if (ecn_ok)
opt.flags |= TC_RED_ECN;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 1024, TCA_CHOKE_PARMS, &opt, sizeof(opt));
addattr_l(n, 1024, TCA_CHOKE_STAB, sbuf, 256);
max_P = probability * pow(2, 32);
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;
}
argc--; argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (limit)
addattr_l(n, 1024, TCA_CODEL_LIMIT, &limit, sizeof(limit));
if (interval)
addattr_l(n, 1024, TCA_CODEL_CE_THRESHOLD,
&ce_threshold, sizeof(ce_threshold));
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
struct rtattr *tail;
__u32 tmp;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
while (argc > 0) {
if (strcmp(*argv, "quantum") == 0) {
argc--; argv++;
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *)tail;
+ addattr_nest_end(n, tail);
return 0;
}
explain();
return -1;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 1024, TCA_DSMARK_INDICES, &ind, sizeof(ind));
if (dflt != -1) {
__u16 tmp = dflt;
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);
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ if (set_tc_index)
+ addattr_l(n, 1024, TCA_DSMARK_SET_TC_INDEX, NULL, 0);
+ addattr_nest_end(n, tail);
return 0;
}
__u8 tmp;
char *end;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
while (argc > 0) {
if (!strcmp(*argv, "mask")) {
NEXT_ARG();
argc--;
argv++;
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
argc--; argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (buckets) {
unsigned int log = ilog2(buckets);
if (set_orphan_mask)
addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK,
&orphan_mask, sizeof(refill_delay));
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
argc--; argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (limit)
addattr_l(n, 1024, TCA_FQ_CODEL_LIMIT, &limit, sizeof(limit));
if (flows)
addattr_l(n, 1024, TCA_FQ_CODEL_MEMORY_LIMIT,
&memory, sizeof(memory));
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
DPRINTF("TC_GRED: sending DPs=%u def_DP=%u\n", opt.DPs, opt.def_DP);
n->nlmsg_flags |= NLM_F_CREATE;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 1024, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
if (limit)
addattr32(n, 1024, TCA_GRED_LIMIT, limit);
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
/*
}
opt.Scell_log = parm;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 1024, TCA_GRED_PARMS, &opt, sizeof(opt));
addattr_l(n, 1024, TCA_GRED_STAB, sbuf, 256);
max_P = probability * pow(2, 32);
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 -1;
}
- tail = NLMSG_TAIL(n);
-
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (rsc_ok)
addattr_l(n, 1024, TCA_HFSC_RSC, &rsc, sizeof(rsc));
if (fsc_ok)
if (usc_ok)
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;
}
argc--; argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (limit)
addattr_l(n, 1024, TCA_HHF_BACKLOG_LIMIT, &limit,
sizeof(limit));
if (non_hh_weight)
addattr_l(n, 1024, TCA_HHF_NON_HH_WEIGHT, &non_hh_weight,
sizeof(non_hh_weight));
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
}
argc--; argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
if (direct_qlen != ~0U)
addattr_l(n, 2024, TCA_HTB_DIRECT_QLEN,
&direct_qlen, sizeof(direct_qlen));
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_end(n, tail);
return 0;
}
}
opt.cbuffer = tc_calc_xmittime(ceil64, cbuffer);
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (rate64 >= (1ULL << 32))
addattr_l(n, 1124, TCA_HTB_RATE64, &rate64, sizeof(rate64));
addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 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;
}
argc--; argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
+ tail = addattr_nest_compat(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
if (flags & TC_MQPRIO_F_MODE)
addattr_l(n, 1024, TCA_MQPRIO_MODE,
addattr_nest_end(n, start);
}
- tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+ addattr_nest_compat_end(n, tail);
return 0;
}
}
}
- tail = NLMSG_TAIL(n);
-
if (reorder.probability) {
if (opt.latency == 0) {
fprintf(stderr, "reordering not possible without specifying some delay\n");
return -1;
}
- if (addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)) < 0)
- return -1;
+ tail = addattr_nest_compat(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
if (present[TCA_NETEM_CORR] &&
addattr_l(n, 1024, TCA_NETEM_CORR, &cor, sizeof(cor)) < 0)
return -1;
free(dist_data);
}
- tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
+ addattr_nest_compat_end(n, tail);
return 0;
}
argv++;
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
if (limit)
addattr_l(n, 1024, TCA_PIE_LIMIT, &limit, sizeof(limit));
if (tupdate)
addattr_l(n, 1024, TCA_PIE_BYTEMODE, &bytemode,
sizeof(bytemode));
- tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+ addattr_nest_end(n, tail);
return 0;
}
struct rtattr *tail;
__u32 tmp;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 4096, TCA_OPTIONS);
while (argc > 0) {
if (matches(*argv, "weight") == 0) {
argc--; argv++;
}
- tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+ addattr_nest_end(n, tail);
return 0;
}
}
opt.Scell_log = parm;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 1024, TCA_RED_PARMS, &opt, sizeof(opt));
addattr_l(n, 1024, TCA_RED_STAB, sbuf, 256);
max_P = probability * pow(2, 32);
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;
}
if (opt.bin_size == 0)
opt.bin_size = (opt.max * 4 + 3) / 5;
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
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;
}
opt.mtu = tc_calc_xmittime(opt.peakrate.rate, mtu);
}
- tail = NLMSG_TAIL(n);
- addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
+ tail = addattr_nest(n, 1024, TCA_OPTIONS);
addattr_l(n, 2024, TCA_TBF_PARMS, &opt, sizeof(opt));
addattr_l(n, 2124, TCA_TBF_BURST, &buffer, sizeof(buffer));
if (rate64 >= (1ULL << 32))
addattr_l(n, 3224, TCA_TBF_PBURST, &mtu, sizeof(mtu));
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 -1;
}
- tail = NLMSG_TAIL(&req.n);
- addattr_l(&req.n, sizeof(req), TCA_STAB, NULL, 0);
+ tail = addattr_nest(&req.n, sizeof(req), TCA_STAB);
addattr_l(&req.n, sizeof(req), TCA_STAB_BASE, &stab.szopts,
sizeof(stab.szopts));
if (stab.data)
addattr_l(&req.n, sizeof(req), TCA_STAB_DATA, stab.data,
stab.szopts.tsize * sizeof(__u16));
- tail->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)tail;
+ addattr_nest_end(&req.n, tail);
if (stab.data)
free(stab.data);
}