diff --git a/tc/f_fw.c b/tc/f_fw.c index 64084bbf..b8134be4 100644 --- a/tc/f_fw.c +++ b/tc/f_fw.c @@ -50,7 +50,7 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a if (argc == 0) return 0; - tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len)); + tail = NLMSG_TAIL(n); addattr_l(n, 4096, TCA_OPTIONS, NULL, 0); while (argc > 0) { @@ -98,7 +98,7 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a } argc--; argv++; } - tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail; + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; return 0; } diff --git a/tc/q_cbq.c b/tc/q_cbq.c index 82a69ee2..3a10175d 100644 --- a/tc/q_cbq.c +++ b/tc/q_cbq.c @@ -151,7 +151,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.avpkt = avpkt; - tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len)); + tail = NLMSG_TAIL(n); addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); addattr_l(n, 1024, TCA_CBQ_RATE, &r, sizeof(r)); addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss)); @@ -162,7 +162,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl printf("%u ", rtab[i]); printf("\n"); } - tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail; + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; return 0; } @@ -385,7 +385,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str lss.change |= TCF_CBQ_LSS_EWMA; } - tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len)); + tail = NLMSG_TAIL(n); addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); if (lss.change) { lss.change |= TCF_CBQ_LSS_FLAGS; @@ -405,7 +405,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str printf("\n"); } } - tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail; + tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; return 0; }