tc: use rta_getattr_u32

Don't cast RTA_DATA use newish accessors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2017-02-24 15:24:05 -08:00
parent 84da4099e9
commit a59b616200
2 changed files with 3 additions and 3 deletions

View File

@ -150,7 +150,7 @@ static int tcindex_print_opt(struct filter_util *qu, FILE *f,
if (RTA_PAYLOAD(tb[TCA_TCINDEX_SHIFT]) < sizeof(shift))
return -1;
shift = *(int *) RTA_DATA(tb[TCA_TCINDEX_SHIFT]);
shift = rta_getattr_u32(tb[TCA_TCINDEX_SHIFT]);
fprintf(f, "shift %d ", shift);
}
if (tb[TCA_TCINDEX_FALL_THROUGH]) {
@ -159,7 +159,7 @@ static int tcindex_print_opt(struct filter_util *qu, FILE *f,
if (RTA_PAYLOAD(tb[TCA_TCINDEX_FALL_THROUGH]) <
sizeof(fall_through))
return -1;
fall_through = *(int *) RTA_DATA(tb[TCA_TCINDEX_FALL_THROUGH]);
fall_through = rta_getattr_u32(tb[TCA_TCINDEX_FALL_THROUGH]);
fprintf(f, fall_through ? "fall_through " : "pass_on ");
}
if (tb[TCA_TCINDEX_CLASSID]) {

View File

@ -230,7 +230,7 @@ static int atm_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (RTA_PAYLOAD(tb[TCA_ATM_STATE]) < sizeof(state))
fprintf(stderr, "ATM: state field too short\n");
else {
state = *(int *) RTA_DATA(tb[TCA_ATM_STATE]);
state = rta_getattr_u32(tb[TCA_ATM_STATE]);
fprintf(f, "%s ", map[state]);
}
}