mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 22:15:13 +08:00
Use parse_rtattr_nested
(Logical change 1.129)
This commit is contained in:
parent
5cb5ee34d3
commit
3b3ecd31c1
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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]) {
|
||||
|
@ -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]");
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user