Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/networking/tc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 89  static int get_qdisc_handle(__u32 *h, co Line 89  static int get_qdisc_handle(__u32 *h, co
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;
# Line 119  static int get_tc_classid(__u32 *h, cons Line 119  static int get_tc_classid(__u32 *h, cons
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)
# Line 190  static int cbq_print_opt(struct rtattr * Line 191  static int cbq_print_opt(struct rtattr *
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;
# Line 271  static int cbq_print_opt(struct rtattr * Line 272  static int cbq_print_opt(struct rtattr *
272   }   }
273   }   }
274   done:   done:
  RELEASE_CONFIG_BUFFER(buf);  
275   return 0;   return 0;
276  }  }
277    
# Line 284  static int print_qdisc(const struct sock Line 284  static int print_qdisc(const struct sock
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? */
# Line 322  static int print_qdisc(const struct sock Line 322  static int print_qdisc(const struct sock
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);
# Line 342  static int print_class(const struct sock Line 342  static int print_class(const struct sock
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? */
# Line 388  static int print_class(const struct sock Line 388  static int print_class(const struct sock
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
# Line 508  int tc_main(int argc UNUSED_PARAM, char Line 508  int tc_main(int argc UNUSED_PARAM, char
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))
# Line 532  int tc_main(int argc UNUSED_PARAM, char Line 530  int tc_main(int argc UNUSED_PARAM, char
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,

Legend:
Removed from v.983  
changed lines
  Added in v.984