Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/networking/libiproute/iproute.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 78  static unsigned get_hz(void) Line 78  static unsigned get_hz(void)
78   return hz_internal;   return hz_internal;
79  }  }
80    
81  static int print_route(const struct sockaddr_nl *who UNUSED_PARAM,  static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
82   struct nlmsghdr *n, void *arg UNUSED_PARAM)   struct nlmsghdr *n, void *arg UNUSED_PARAM)
83  {  {
84   struct rtmsg *r = NLMSG_DATA(n);   struct rtmsg *r = NLMSG_DATA(n);
# Line 196  static int print_route(const struct sock Line 196  static int print_route(const struct sock
196   printf("Deleted ");   printf("Deleted ");
197   }   }
198   if (r->rtm_type != RTN_UNICAST && !filter.type) {   if (r->rtm_type != RTN_UNICAST && !filter.type) {
199   printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1, sizeof(b1)));   printf("%s ", rtnl_rtntype_n2a(r->rtm_type, b1));
200   }   }
201    
202   if (tb[RTA_DST]) {   if (tb[RTA_DST]) {
203   if (r->rtm_dst_len != host_len) {   if (r->rtm_dst_len != host_len) {
204   printf("%s/%u ", rt_addr_n2a(r->rtm_family,   printf("%s/%u ", rt_addr_n2a(r->rtm_family,
  RTA_PAYLOAD(tb[RTA_DST]),  
205   RTA_DATA(tb[RTA_DST]),   RTA_DATA(tb[RTA_DST]),
206   abuf, sizeof(abuf)),   abuf, sizeof(abuf)),
207   r->rtm_dst_len   r->rtm_dst_len
# Line 222  static int print_route(const struct sock Line 221  static int print_route(const struct sock
221   if (tb[RTA_SRC]) {   if (tb[RTA_SRC]) {
222   if (r->rtm_src_len != host_len) {   if (r->rtm_src_len != host_len) {
223   printf("from %s/%u ", rt_addr_n2a(r->rtm_family,   printf("from %s/%u ", rt_addr_n2a(r->rtm_family,
  RTA_PAYLOAD(tb[RTA_SRC]),  
224   RTA_DATA(tb[RTA_SRC]),   RTA_DATA(tb[RTA_SRC]),
225   abuf, sizeof(abuf)),   abuf, sizeof(abuf)),
226   r->rtm_src_len   r->rtm_src_len
# Line 252  static int print_route(const struct sock Line 250  static int print_route(const struct sock
250     and symbolic name will not be useful.     and symbolic name will not be useful.
251   */   */
252   printf(" src %s ", rt_addr_n2a(r->rtm_family,   printf(" src %s ", rt_addr_n2a(r->rtm_family,
  RTA_PAYLOAD(tb[RTA_PREFSRC]),  
253   RTA_DATA(tb[RTA_PREFSRC]),   RTA_DATA(tb[RTA_PREFSRC]),
254   abuf, sizeof(abuf)));   abuf, sizeof(abuf)));
255   }   }
# Line 290  static int print_route(const struct sock Line 287  static int print_route(const struct sock
287  static int iproute_modify(int cmd, unsigned flags, char **argv)  static int iproute_modify(int cmd, unsigned flags, char **argv)
288  {  {
289   static const char keywords[] ALIGN1 =   static const char keywords[] ALIGN1 =
290   "src\0""via\0""mtu\0""lock\0""protocol\0"USE_FEATURE_IP_RULE("table\0")   "src\0""via\0""mtu\0""lock\0""protocol\0"IF_FEATURE_IP_RULE("table\0")
291   "dev\0""oif\0""to\0""metric\0";   "dev\0""oif\0""to\0""metric\0";
292   enum {   enum {
293   ARG_src,   ARG_src,
294   ARG_via,   ARG_via,
295   ARG_mtu, PARM_lock,   ARG_mtu, PARM_lock,
296   ARG_protocol,   ARG_protocol,
297  USE_FEATURE_IP_RULE(ARG_table,)  IF_FEATURE_IP_RULE(ARG_table,)
298   ARG_dev,   ARG_dev,
299   ARG_oif,   ARG_oif,
300   ARG_to,   ARG_to,
# Line 367  USE_FEATURE_IP_RULE(ARG_table,) Line 364  USE_FEATURE_IP_RULE(ARG_table,)
364   mxlock |= (1 << RTAX_MTU);   mxlock |= (1 << RTAX_MTU);
365   NEXT_ARG();   NEXT_ARG();
366   }   }
367   if (get_unsigned(&mtu, *argv, 0))   mtu = get_unsigned(*argv, "mtu");
  invarg(*argv, "mtu");  
368   rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);   rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu);
369   } else if (arg == ARG_protocol) {   } else if (arg == ARG_protocol) {
370   uint32_t prot;   uint32_t prot;
# Line 391  USE_FEATURE_IP_RULE(ARG_table,) Line 387  USE_FEATURE_IP_RULE(ARG_table,)
387   } else if (arg == ARG_metric) {   } else if (arg == ARG_metric) {
388   uint32_t metric;   uint32_t metric;
389   NEXT_ARG();   NEXT_ARG();
390   if (get_u32(&metric, *argv, 0))   metric = get_u32(*argv, "metric");
  invarg(*argv, "metric");  
391   addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric);   addattr32(&req.n, sizeof(req), RTA_PRIORITY, metric);
392   } else {   } else {
393   int type;   int type;
# Line 504  static void iproute_flush_cache(void) Line 499  static void iproute_flush_cache(void)
499   }   }
500    
501   if (write(flush_fd, "-1", 2) < 2) {   if (write(flush_fd, "-1", 2) < 2) {
502   bb_perror_msg("cannot flush routing cache");   bb_perror_msg("can't flush routing cache");
503   return;   return;
504   }   }
505   close(flush_fd);   close(flush_fd);
# Line 686  static int iproute_list_or_flush(char ** Line 681  static int iproute_list_or_flush(char **
681   if (filter.tb != -1) {   if (filter.tb != -1) {
682   xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE);   xrtnl_wilddump_request(&rth, do_ipv6, RTM_GETROUTE);
683   } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) {   } else if (rtnl_rtcache_request(&rth, do_ipv6) < 0) {
684   bb_perror_msg_and_die("cannot send dump request");   bb_perror_msg_and_die("can't send dump request");
685   }   }
686   xrtnl_dump_filter(&rth, print_route, NULL);   xrtnl_dump_filter(&rth, print_route, NULL);
687    

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