|
| 1 | +Description: remove CBQ functionality |
| 2 | +Author: Tianon Gravi <tianon@debian.org> |
| 3 | +Origin: https://bugs.busybox.net/attachment.cgi?id=9751&action=edit |
| 4 | + |
| 5 | +See: |
| 6 | +- https://github.com/docker-library/busybox/issues/198 |
| 7 | +- https://bugs.busybox.net/show_bug.cgi?id=15931 |
| 8 | +- https://bugs.debian.org/1071648 |
| 9 | + |
| 10 | +See also: |
| 11 | +- https://github.com/torvalds/linux/commit/33241dca486264193ed68167c8eeae1fb197f3df |
| 12 | +- https://github.com/iproute2/iproute2/commit/07ba0af3fee132eddc1c2eab643ff4910181c993 |
| 13 | + |
| 14 | +diff --git a/networking/tc.c b/networking/tc.c |
| 15 | +index 3a79fd2d9..753efb9ff 100644 |
| 16 | +--- a/networking/tc.c |
| 17 | ++++ b/networking/tc.c |
| 18 | +@@ -31,7 +31,7 @@ |
| 19 | + //usage: "qdisc [handle QHANDLE] [root|"IF_FEATURE_TC_INGRESS("ingress|")"parent CLASSID]\n" |
| 20 | + /* //usage: "[estimator INTERVAL TIME_CONSTANT]\n" */ |
| 21 | + //usage: " [[QDISC_KIND] [help|OPTIONS]]\n" |
| 22 | +-//usage: " QDISC_KIND := [p|b]fifo|tbf|prio|cbq|red|etc.\n" |
| 23 | ++//usage: " QDISC_KIND := [p|b]fifo|tbf|prio|red|etc.\n" |
| 24 | + //usage: "qdisc show [dev STRING]"IF_FEATURE_TC_INGRESS(" [ingress]")"\n" |
| 25 | + //usage: "class [classid CLASSID] [root|parent CLASSID]\n" |
| 26 | + //usage: " [[QDISC_KIND] [help|OPTIONS] ]\n" |
| 27 | +@@ -224,105 +224,6 @@ static int prio_print_opt(struct rtattr *opt) |
| 28 | + return 0; |
| 29 | + } |
| 30 | + |
| 31 | +-#if 0 |
| 32 | +-/* Class Based Queue */ |
| 33 | +-static int cbq_parse_opt(int argc, char **argv, struct nlmsghdr *n) |
| 34 | +-{ |
| 35 | +- return 0; |
| 36 | +-} |
| 37 | +-#endif |
| 38 | +-static int cbq_print_opt(struct rtattr *opt) |
| 39 | +-{ |
| 40 | +- struct rtattr *tb[TCA_CBQ_MAX+1]; |
| 41 | +- struct tc_ratespec *r = NULL; |
| 42 | +- struct tc_cbq_lssopt *lss = NULL; |
| 43 | +- struct tc_cbq_wrropt *wrr = NULL; |
| 44 | +- struct tc_cbq_fopt *fopt = NULL; |
| 45 | +- struct tc_cbq_ovl *ovl = NULL; |
| 46 | +- const char *const error = "CBQ: too short %s opt"; |
| 47 | +- char buf[64]; |
| 48 | +- |
| 49 | +- if (opt == NULL) |
| 50 | +- goto done; |
| 51 | +- parse_rtattr_nested(tb, TCA_CBQ_MAX, opt); |
| 52 | +- |
| 53 | +- if (tb[TCA_CBQ_RATE]) { |
| 54 | +- if (RTA_PAYLOAD(tb[TCA_CBQ_RATE]) < sizeof(*r)) |
| 55 | +- bb_error_msg(error, "rate"); |
| 56 | +- else |
| 57 | +- r = RTA_DATA(tb[TCA_CBQ_RATE]); |
| 58 | +- } |
| 59 | +- if (tb[TCA_CBQ_LSSOPT]) { |
| 60 | +- if (RTA_PAYLOAD(tb[TCA_CBQ_LSSOPT]) < sizeof(*lss)) |
| 61 | +- bb_error_msg(error, "lss"); |
| 62 | +- else |
| 63 | +- lss = RTA_DATA(tb[TCA_CBQ_LSSOPT]); |
| 64 | +- } |
| 65 | +- if (tb[TCA_CBQ_WRROPT]) { |
| 66 | +- if (RTA_PAYLOAD(tb[TCA_CBQ_WRROPT]) < sizeof(*wrr)) |
| 67 | +- bb_error_msg(error, "wrr"); |
| 68 | +- else |
| 69 | +- wrr = RTA_DATA(tb[TCA_CBQ_WRROPT]); |
| 70 | +- } |
| 71 | +- if (tb[TCA_CBQ_FOPT]) { |
| 72 | +- if (RTA_PAYLOAD(tb[TCA_CBQ_FOPT]) < sizeof(*fopt)) |
| 73 | +- bb_error_msg(error, "fopt"); |
| 74 | +- else |
| 75 | +- fopt = RTA_DATA(tb[TCA_CBQ_FOPT]); |
| 76 | +- } |
| 77 | +- if (tb[TCA_CBQ_OVL_STRATEGY]) { |
| 78 | +- if (RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]) < sizeof(*ovl)) |
| 79 | +- bb_error_msg("CBQ: too short overlimit strategy %u/%u", |
| 80 | +- (unsigned) RTA_PAYLOAD(tb[TCA_CBQ_OVL_STRATEGY]), |
| 81 | +- (unsigned) sizeof(*ovl)); |
| 82 | +- else |
| 83 | +- ovl = RTA_DATA(tb[TCA_CBQ_OVL_STRATEGY]); |
| 84 | +- } |
| 85 | +- |
| 86 | +- if (r) { |
| 87 | +- print_rate(buf, sizeof(buf), r->rate); |
| 88 | +- printf("rate %s ", buf); |
| 89 | +- if (show_details) { |
| 90 | +- printf("cell %ub ", 1<<r->cell_log); |
| 91 | +- if (r->mpu) |
| 92 | +- printf("mpu %ub ", r->mpu); |
| 93 | +- if (r->overhead) |
| 94 | +- printf("overhead %ub ", r->overhead); |
| 95 | +- } |
| 96 | +- } |
| 97 | +- if (lss && lss->flags) { |
| 98 | +- bool comma = false; |
| 99 | +- bb_putchar('('); |
| 100 | +- if (lss->flags&TCF_CBQ_LSS_BOUNDED) { |
| 101 | +- printf("bounded"); |
| 102 | +- comma = true; |
| 103 | +- } |
| 104 | +- if (lss->flags&TCF_CBQ_LSS_ISOLATED) { |
| 105 | +- if (comma) |
| 106 | +- bb_putchar(','); |
| 107 | +- printf("isolated"); |
| 108 | +- } |
| 109 | +- printf(") "); |
| 110 | +- } |
| 111 | +- if (wrr) { |
| 112 | +- if (wrr->priority != TC_CBQ_MAXPRIO) |
| 113 | +- printf("prio %u", wrr->priority); |
| 114 | +- else |
| 115 | +- printf("prio no-transmit"); |
| 116 | +- if (show_details) { |
| 117 | +- printf("/%u ", wrr->cpriority); |
| 118 | +- if (wrr->weight != 1) { |
| 119 | +- print_rate(buf, sizeof(buf), wrr->weight); |
| 120 | +- printf("weight %s ", buf); |
| 121 | +- } |
| 122 | +- if (wrr->allot) |
| 123 | +- printf("allot %ub ", wrr->allot); |
| 124 | +- } |
| 125 | +- } |
| 126 | +- done: |
| 127 | +- return 0; |
| 128 | +-} |
| 129 | +- |
| 130 | + static FAST_FUNC int print_qdisc( |
| 131 | + const struct sockaddr_nl *who UNUSED_PARAM, |
| 132 | + struct nlmsghdr *hdr, |
| 133 | +@@ -368,12 +269,10 @@ static FAST_FUNC int print_qdisc( |
| 134 | + if (msg->tcm_info != 1) |
| 135 | + printf("refcnt %d ", msg->tcm_info); |
| 136 | + if (tb[TCA_OPTIONS]) { |
| 137 | +- static const char _q_[] ALIGN1 = "pfifo_fast\0""cbq\0"; |
| 138 | ++ static const char _q_[] ALIGN1 = "pfifo_fast\0"; |
| 139 | + int qqq = index_in_strings(_q_, name); |
| 140 | + if (qqq == 0) { /* pfifo_fast aka prio */ |
| 141 | + prio_print_opt(tb[TCA_OPTIONS]); |
| 142 | +- } else if (qqq == 1) { /* class based queuing */ |
| 143 | +- cbq_print_opt(tb[TCA_OPTIONS]); |
| 144 | + } else { |
| 145 | + /* don't know how to print options for this qdisc */ |
| 146 | + printf("(options for %s)", name); |
| 147 | +@@ -438,13 +337,10 @@ static FAST_FUNC int print_class( |
| 148 | + printf("leaf %x ", msg->tcm_info >> 16); |
| 149 | + /* Do that get_qdisc_kind(RTA_DATA(tb[TCA_KIND])). */ |
| 150 | + if (tb[TCA_OPTIONS]) { |
| 151 | +- static const char _q_[] ALIGN1 = "pfifo_fast\0""cbq\0"; |
| 152 | ++ static const char _q_[] ALIGN1 = "pfifo_fast\0"; |
| 153 | + int qqq = index_in_strings(_q_, name); |
| 154 | + if (qqq == 0) { /* pfifo_fast aka prio */ |
| 155 | + /* nothing. */ /*prio_print_opt(tb[TCA_OPTIONS]);*/ |
| 156 | +- } else if (qqq == 1) { /* class based queuing */ |
| 157 | +- /* cbq_print_copt() is identical to cbq_print_opt(). */ |
| 158 | +- cbq_print_opt(tb[TCA_OPTIONS]); |
| 159 | + } else { |
| 160 | + /* don't know how to print options for this class */ |
| 161 | + printf("(options for %s)", name); |
0 commit comments