]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Use NLMSG_TAIL
author2!tgraf <2!tgraf>
Tue, 18 Jan 2005 01:24:18 +0000 (01:24 +0000)
committer2!tgraf <2!tgraf>
Tue, 18 Jan 2005 01:24:18 +0000 (01:24 +0000)
(Logical change 1.127)

tc/m_ipt.c
tc/m_pedit.c

index 24f3979c65b70a3d367407bcfb5eefda5c11712c..ec33f8fe41591f09ed18639ee2737151804bec58 100644 (file)
@@ -547,7 +547,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
                }
        }
 
-       tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len));
+       tail = NLMSG_TAIL(n);
        addattr_l(n, MAX_MSG, tca_id, NULL, 0);
        fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
        fprintf(stdout, "\ttarget: ");
@@ -569,8 +569,7 @@ static int parse_ipt(struct action_util *a,int *argc_p,
        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 *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail;
+       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 
        argc -= optind;
        argv += optind;
index f3cec6fe7cff76f08694d7b5481405d06b83ea34..8d7a60b0d32dab2eab7bf1746c8dc7f83a7b7b64 100644 (file)
@@ -534,11 +534,10 @@ parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, stru
                }
        }
 
-       tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len));
+       tail = NLMSG_TAIL(n);
        addattr_l(n, MAX_MSG, tca_id, NULL, 0);
        addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS,&sel, sizeof(sel.sel)+sel.sel.nkeys*sizeof(struct tc_pedit_key));
-       tail->rta_len =
-           (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail;
+       tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 
        *argc_p = argc;
        *argv_p = argv;