Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/networking/tc.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/networking/tc.c
r3232 r3621 30 30 31 31 #include "libbb.h" 32 #include "common_bufsiz.h" 32 33 33 34 #include "libiproute/utils.h" … … 64 65 uint32_t filter_proto; 65 66 } FIX_ALIASING; 66 #define G (*(struct globals*)&bb_common_bufsiz1) 67 struct BUG_G_too_big { 68 char BUG_G_too_big[sizeof(G) <= COMMON_BUFSIZE ? 1 : -1]; 69 }; 67 #define G (*(struct globals*)bb_common_bufsiz1) 70 68 #define filter_ifindex (G.filter_ifindex) 71 69 #define filter_qdisc (G.filter_qdisc) … … 73 71 #define filter_prio (G.filter_prio) 74 72 #define filter_proto (G.filter_proto) 75 #define INIT_G() do { } while (0) 73 #define INIT_G() do { \ 74 setup_common_bufsiz(); \ 75 BUILD_BUG_ON(sizeof(G) > COMMON_BUFSIZE); \ 76 } while (0) 76 77 77 78 /* Allocates a buffer containing the name of a class id. … … 152 153 153 154 if (use_iec) { 154 if (tmp >= 1000 .0*1024.0*1024.0)155 snprintf(buf, len, "%.0fMibit", tmp/ 1024.0*1024.0);156 else if (tmp >= 1000 .0*1024)155 if (tmp >= 1000*1024*1024) 156 snprintf(buf, len, "%.0fMibit", tmp/(1024*1024)); 157 else if (tmp >= 1000*1024) 157 158 snprintf(buf, len, "%.0fKibit", tmp/1024); 158 159 else 159 160 snprintf(buf, len, "%.0fbit", tmp); 160 161 } else { 161 if (tmp >= 1000 .0*1000000.0)162 snprintf(buf, len, "%.0fMbit", tmp/1000000 .0);163 else if (tmp >= 1000 .0 * 1000.0)164 snprintf(buf, len, "%.0fKbit", tmp/1000 .0);162 if (tmp >= 1000*1000000) 163 snprintf(buf, len, "%.0fMbit", tmp/1000000); 164 else if (tmp >= 1000*1000) 165 snprintf(buf, len, "%.0fKbit", tmp/1000); 165 166 else 166 167 snprintf(buf, len, "%.0fbit", tmp); … … 419 420 struct nlmsghdr *hdr, void *arg UNUSED_PARAM) 420 421 { 421 struct tcmsg *msg = NLMSG_DATA(hdr);422 int len = hdr->nlmsg_len;423 struct rtattr * tb[TCA_MAX+1];424 422 return 0; 425 423 } … … 464 462 obj = index_in_substrings(objects, *argv++); 465 463 466 if (obj < OBJ_qdisc)464 if (obj < 0) 467 465 bb_show_usage(); 468 466 if (!*argv) … … 471 469 cmd = index_in_substrings(commands, *argv); 472 470 if (cmd < 0) 473 bb_error_msg_and_die(bb_msg_invalid_arg, *argv, applet_name);471 invarg_1_to_2(*argv, argv[-1]); 474 472 argv++; 475 473 } … … 494 492 /* We don't care about duparg2("qdisc handle",*argv) for now */ 495 493 if (get_qdisc_handle(&filter_qdisc, *argv)) 496 invarg (*argv, "qdisc");494 invarg_1_to_2(*argv, "qdisc"); 497 495 } else 498 496 if (obj != OBJ_qdisc … … 504 502 /* nothing */ 505 503 } else { 506 invarg (*argv, "command");504 invarg_1_to_2(*argv, "command"); 507 505 } 508 506 NEXT_ARG(); … … 518 516 duparg(*argv, "parent"); 519 517 if (get_tc_classid(&handle, *argv)) 520 invarg (*argv, "parent");518 invarg_1_to_2(*argv, "parent"); 521 519 msg.tcm_parent = handle; 522 520 if (obj == OBJ_filter) … … 543 541 duparg(*argv, "protocol"); 544 542 if (ll_proto_a2n(&tmp, *argv)) 545 invarg (*argv, "protocol");543 invarg_1_to_2(*argv, "protocol"); 546 544 filter_proto = tmp; 547 545 }
Note:
See TracChangeset
for help on using the changeset viewer.