Use parse_rtattr_nested

(Logical change 1.129)
This commit is contained in:
4!tgraf 2005-01-18 22:11:58 +00:00
parent 5cb5ee34d3
commit 3b3ecd31c1
8 changed files with 15 additions and 22 deletions

View File

@ -143,9 +143,7 @@ static int route_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
if (opt == NULL)
return 0;
memset(tb, 0, sizeof(tb));
if (opt)
parse_rtattr(tb, TCA_ROUTE4_MAX, RTA_DATA(opt), RTA_PAYLOAD(opt));
parse_rtattr_nested(tb, TCA_ROUTE4_MAX, opt);
if (handle)
fprintf(f, "fh 0x%08x ", handle);

View File

@ -322,9 +322,7 @@ static int rsvp_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt, _
if (opt == NULL)
return 0;
memset(tb, 0, sizeof(tb));
if (opt)
parse_rtattr(tb, TCA_RSVP_MAX, RTA_DATA(opt), RTA_PAYLOAD(opt));
parse_rtattr_nested(tb, TCA_RSVP_MAX, opt);
if (handle)
fprintf(f, "fh 0x%08x ", handle);

View File

@ -43,7 +43,7 @@ static int tcindex_parse_opt(struct filter_util *qu, char *handle, int argc,
}
}
if (!argc) 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) {
if (!strcmp(*argv,"hash")) {
@ -117,7 +117,7 @@ static int tcindex_parse_opt(struct filter_util *qu, char *handle, int argc,
argc--;
argv++;
}
tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
return 0;
}
@ -127,10 +127,10 @@ static int tcindex_print_opt(struct filter_util *qu, FILE *f,
{
struct rtattr *tb[TCA_TCINDEX_MAX+1];
if (!opt) return 0;
if (opt == NULL)
return 0;
memset(tb, 0, sizeof(tb));
parse_rtattr(tb, TCA_TCINDEX_MAX, RTA_DATA(opt), RTA_PAYLOAD(opt));
parse_rtattr_nested(tb, TCA_TCINDEX_MAX, opt);
if (handle != ~0) fprintf(f,"handle 0x%04x ",handle);
if (tb[TCA_TCINDEX_HASH]) {

View File

@ -207,8 +207,7 @@ print_gact(struct action_util *au,FILE * f, struct rtattr *arg)
if (arg == NULL)
return -1;
memset(tb, 0, sizeof (tb));
parse_rtattr(tb, TCA_GACT_MAX, RTA_DATA(arg), RTA_PAYLOAD(arg));
parse_rtattr_nested(tb, TCA_GACT_MAX, arg);
if (tb[TCA_GACT_PARMS] == NULL) {
fprintf(f, "[NULL gact parameters]");

View File

@ -195,9 +195,10 @@ static int atm_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
struct rtattr *tb[TCA_ATM_MAX+1];
char buffer[MAX_ATM_ADDR_LEN+1];
if (!opt) return 0;
memset(tb, 0, sizeof(tb));
parse_rtattr(tb, TCA_ATM_MAX, RTA_DATA(opt), RTA_PAYLOAD(opt));
if (opt == NULL)
return 0;
parse_rtattr_nested(tb, TCA_ATM_MAX, opt);
if (tb[TCA_ATM_ADDR]) {
if (RTA_PAYLOAD(tb[TCA_ATM_ADDR]) <
sizeof(struct sockaddr_atmpvc))

View File

@ -273,8 +273,7 @@ static int gred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (opt == NULL)
return 0;
memset(tb, 0, sizeof(tb));
parse_rtattr(tb, TCA_GRED_STAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
parse_rtattr_nested(tb, TCA_GRED_STAB, opt);
if (tb[TCA_GRED_PARMS] == NULL)
return -1;

View File

@ -168,8 +168,7 @@ static int red_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (opt == NULL)
return 0;
memset(tb, 0, sizeof(tb));
parse_rtattr(tb, TCA_RED_STAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
parse_rtattr_nested(tb, TCA_RED_STAB, opt);
if (tb[TCA_RED_PARMS] == NULL)
return -1;

View File

@ -209,8 +209,7 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
if (opt == NULL)
return 0;
memset(tb, 0, sizeof(tb));
parse_rtattr(tb, TCA_TBF_PTAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
parse_rtattr_nested(tb, TCA_TBF_PTAB, opt);
if (tb[TCA_TBF_PARMS] == NULL)
return -1;