89 |
if (p == str) |
if (p == str) |
90 |
return 1; |
return 1; |
91 |
maj <<= 16; |
maj <<= 16; |
92 |
if (*p != ':' && *p!=0) |
if (*p != ':' && *p != '\0') |
93 |
return 1; |
return 1; |
94 |
ok: |
ok: |
95 |
*h = maj; |
*h = maj; |
119 |
maj <<= 16; |
maj <<= 16; |
120 |
str = p + 1; |
str = p + 1; |
121 |
min = strtoul(str, &p, 16); |
min = strtoul(str, &p, 16); |
122 |
if (*p != 0 || min >= (1<<16)) |
//FIXME: check for "" too? |
123 |
|
if (*p != '\0' || min >= (1<<16)) |
124 |
return 1; |
return 1; |
125 |
maj |= min; |
maj |= min; |
126 |
} else if (*p != 0) |
} else if (*p != 0) |
191 |
struct tc_cbq_wrropt *wrr = NULL; |
struct tc_cbq_wrropt *wrr = NULL; |
192 |
struct tc_cbq_fopt *fopt = NULL; |
struct tc_cbq_fopt *fopt = NULL; |
193 |
struct tc_cbq_ovl *ovl = NULL; |
struct tc_cbq_ovl *ovl = NULL; |
194 |
const char * const error = "CBQ: too short %s opt"; |
const char *const error = "CBQ: too short %s opt"; |
195 |
RESERVE_CONFIG_BUFFER(buf, 64); |
char buf[64]; |
196 |
|
|
197 |
if (opt == NULL) |
if (opt == NULL) |
198 |
goto done; |
goto done; |
272 |
} |
} |
273 |
} |
} |
274 |
done: |
done: |
|
RELEASE_CONFIG_BUFFER(buf); |
|
275 |
return 0; |
return 0; |
276 |
} |
} |
277 |
|
|
284 |
char *name; |
char *name; |
285 |
|
|
286 |
if (hdr->nlmsg_type != RTM_NEWQDISC && hdr->nlmsg_type != RTM_DELQDISC) { |
if (hdr->nlmsg_type != RTM_NEWQDISC && hdr->nlmsg_type != RTM_DELQDISC) { |
287 |
/* bb_error_msg("Not a qdisc"); */ |
/* bb_error_msg("not a qdisc"); */ |
288 |
return 0; /* ??? mimic upstream; should perhaps return -1 */ |
return 0; /* ??? mimic upstream; should perhaps return -1 */ |
289 |
} |
} |
290 |
len -= NLMSG_LENGTH(sizeof(*msg)); |
len -= NLMSG_LENGTH(sizeof(*msg)); |
291 |
if (len < 0) { |
if (len < 0) { |
292 |
/* bb_error_msg("Wrong len %d", len); */ |
/* bb_error_msg("wrong len %d", len); */ |
293 |
return -1; |
return -1; |
294 |
} |
} |
295 |
/* not the desired interface? */ |
/* not the desired interface? */ |
322 |
int qqq = index_in_strings(_q_, name); |
int qqq = index_in_strings(_q_, name); |
323 |
if (qqq == 0) { /* pfifo_fast aka prio */ |
if (qqq == 0) { /* pfifo_fast aka prio */ |
324 |
prio_print_opt(tb[TCA_OPTIONS]); |
prio_print_opt(tb[TCA_OPTIONS]); |
325 |
} else if (qqq == 1) { /* class based queueing */ |
} else if (qqq == 1) { /* class based queuing */ |
326 |
cbq_print_opt(tb[TCA_OPTIONS]); |
cbq_print_opt(tb[TCA_OPTIONS]); |
327 |
} else |
} else |
328 |
bb_error_msg("unknown %s", name); |
bb_error_msg("unknown %s", name); |
342 |
/*XXX Eventually factor out common code */ |
/*XXX Eventually factor out common code */ |
343 |
|
|
344 |
if (hdr->nlmsg_type != RTM_NEWTCLASS && hdr->nlmsg_type != RTM_DELTCLASS) { |
if (hdr->nlmsg_type != RTM_NEWTCLASS && hdr->nlmsg_type != RTM_DELTCLASS) { |
345 |
/* bb_error_msg("Not a class"); */ |
/* bb_error_msg("not a class"); */ |
346 |
return 0; /* ??? mimic upstream; should perhaps return -1 */ |
return 0; /* ??? mimic upstream; should perhaps return -1 */ |
347 |
} |
} |
348 |
len -= NLMSG_LENGTH(sizeof(*msg)); |
len -= NLMSG_LENGTH(sizeof(*msg)); |
349 |
if (len < 0) { |
if (len < 0) { |
350 |
/* bb_error_msg("Wrong len %d", len); */ |
/* bb_error_msg("wrong len %d", len); */ |
351 |
return -1; |
return -1; |
352 |
} |
} |
353 |
/* not the desired interface? */ |
/* not the desired interface? */ |
388 |
int qqq = index_in_strings(_q_, name); |
int qqq = index_in_strings(_q_, name); |
389 |
if (qqq == 0) { /* pfifo_fast aka prio */ |
if (qqq == 0) { /* pfifo_fast aka prio */ |
390 |
/* nothing. */ /*prio_print_opt(tb[TCA_OPTIONS]);*/ |
/* nothing. */ /*prio_print_opt(tb[TCA_OPTIONS]);*/ |
391 |
} else if (qqq == 1) { /* class based queueing */ |
} else if (qqq == 1) { /* class based queuing */ |
392 |
/* cbq_print_copt() is identical to cbq_print_opt(). */ |
/* cbq_print_copt() is identical to cbq_print_opt(). */ |
393 |
cbq_print_opt(tb[TCA_OPTIONS]); |
cbq_print_opt(tb[TCA_OPTIONS]); |
394 |
} else |
} else |
508 |
if ((slash = strchr(handle, '/')) != NULL) |
if ((slash = strchr(handle, '/')) != NULL) |
509 |
*slash = '\0'; |
*slash = '\0'; |
510 |
*/ |
*/ |
511 |
if (get_u32(&msg.tcm_handle, *argv, 0)) |
msg.tcm_handle = get_u32(*argv, "handle"); |
512 |
invarg(*argv, "handle"); |
/* if (slash) {if (get_u32(__u32 &mask, slash+1, NULL)) inv mask; addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */ |
|
/* if (slash) {if (get_u32(__u32 &mask, slash+1,0)) inv mask;addattr32(n, MAX_MSG, TCA_FW_MASK, mask); */ |
|
513 |
} else if (arg == ARG_classid && obj == OBJ_class && cmd == CMD_change){ |
} else if (arg == ARG_classid && obj == OBJ_class && cmd == CMD_change){ |
514 |
} else if (arg == ARG_pref || arg == ARG_prio) { /* filter::list */ |
} else if (arg == ARG_pref || arg == ARG_prio) { /* filter::list */ |
515 |
if (filter_prio) |
if (filter_prio) |
516 |
duparg(*argv, "priority"); |
duparg(*argv, "priority"); |
517 |
if (get_u32(&filter_prio, *argv, 0)) |
filter_prio = get_u32(*argv, "priority"); |
|
invarg(*argv, "priority"); |
|
518 |
} else if (arg == ARG_proto) { /* filter::list */ |
} else if (arg == ARG_proto) { /* filter::list */ |
519 |
__u16 tmp; |
uint16_t tmp; |
520 |
if (filter_proto) |
if (filter_proto) |
521 |
duparg(*argv, "protocol"); |
duparg(*argv, "protocol"); |
522 |
if (ll_proto_a2n(&tmp, *argv)) |
if (ll_proto_a2n(&tmp, *argv)) |
530 |
if (rtnl_dump_request(&rth, obj == OBJ_qdisc ? RTM_GETQDISC : |
if (rtnl_dump_request(&rth, obj == OBJ_qdisc ? RTM_GETQDISC : |
531 |
obj == OBJ_class ? RTM_GETTCLASS : RTM_GETTFILTER, |
obj == OBJ_class ? RTM_GETTCLASS : RTM_GETTFILTER, |
532 |
&msg, sizeof(msg)) < 0) |
&msg, sizeof(msg)) < 0) |
533 |
bb_simple_perror_msg_and_die("cannot send dump request"); |
bb_simple_perror_msg_and_die("can't send dump request"); |
534 |
|
|
535 |
xrtnl_dump_filter(&rth, obj == OBJ_qdisc ? print_qdisc : |
xrtnl_dump_filter(&rth, obj == OBJ_qdisc ? print_qdisc : |
536 |
obj == OBJ_class ? print_class : print_filter, |
obj == OBJ_class ? print_class : print_filter, |