Magellan Linux

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

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

revision 532 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 9  Line 9 
9    
10  /* BB_AUDIT SUSv3 N/A */  /* BB_AUDIT SUSv3 N/A */
11    
12  #include "busybox.h"  #include "libbb.h"
13  #include <net/if.h>  #include <net/if.h>
14    
15  /* Stuff from linux/if_vlan.h, kernel version 2.4.23 */  /* Stuff from linux/if_vlan.h, kernel version 2.4.23 */
# Line 63  static const char *xfind_str(const char Line 63  static const char *xfind_str(const char
63   return table - 1;   return table - 1;
64  }  }
65    
66  static const char cmds[] = {  static const char cmds[] ALIGN1 = {
67   4, ADD_VLAN_CMD, 7,   4, ADD_VLAN_CMD, 7,
68   'a', 'd', 'd', 0,   'a', 'd', 'd', 0,
69   3, DEL_VLAN_CMD, 7,   3, DEL_VLAN_CMD, 7,
# Line 85  static const char cmds[] = { Line 85  static const char cmds[] = {
85   'm', 'a', 'p', 0,   'm', 'a', 'p', 0,
86  };  };
87    
88  static const char name_types[] = {  static const char name_types[] ALIGN1 = {
89   VLAN_NAME_TYPE_PLUS_VID, 16,   VLAN_NAME_TYPE_PLUS_VID, 16,
90   'V', 'L', 'A', 'N',   'V', 'L', 'A', 'N',
91   '_', 'P', 'L', 'U', 'S', '_', 'V', 'I', 'D',   '_', 'P', 'L', 'U', 'S', '_', 'V', 'I', 'D',
# Line 104  static const char name_types[] = { Line 104  static const char name_types[] = {
104   '_', 'N', 'O', '_', 'P', 'A', 'D', 0,   '_', 'N', 'O', '_', 'P', 'A', 'D', 0,
105  };  };
106    
107  static const char conf_file_name[] = "/proc/net/vlan/config";  static const char conf_file_name[] ALIGN1 = "/proc/net/vlan/config";
108    
109    int vconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
110  int vconfig_main(int argc, char **argv)  int vconfig_main(int argc, char **argv)
111  {  {
112   struct vlan_ioctl_args ifr;   struct vlan_ioctl_args ifr;
# Line 132  int vconfig_main(int argc, char **argv) Line 133  int vconfig_main(int argc, char **argv)
133   if (ifr.cmd == SET_VLAN_NAME_TYPE_CMD) { /* set_name_type */   if (ifr.cmd == SET_VLAN_NAME_TYPE_CMD) { /* set_name_type */
134   ifr.u.name_type = *xfind_str(name_types+1, argv[1]);   ifr.u.name_type = *xfind_str(name_types+1, argv[1]);
135   } else {   } else {
136   if (strlen(argv[1]) >= IF_NAMESIZE) {   strncpy(ifr.device1, argv[1], IFNAMSIZ);
  bb_error_msg_and_die("if_name >= %d chars", IF_NAMESIZE);  
  }  
  strcpy(ifr.device1, argv[1]);  
137   p = argv[2];   p = argv[2];
138    
139   /* I suppose one could try to combine some of the function calls below,   /* I suppose one could try to combine some of the function calls below,
# Line 156  int vconfig_main(int argc, char **argv) Line 154  int vconfig_main(int argc, char **argv)
154   }   }
155    
156   fd = xsocket(AF_INET, SOCK_STREAM, 0);   fd = xsocket(AF_INET, SOCK_STREAM, 0);
157   if (ioctl(fd, SIOCSIFVLAN, &ifr) < 0) {   ioctl_or_perror_and_die(fd, SIOCSIFVLAN, &ifr,
158   bb_perror_msg_and_die("ioctl error for %s", *argv);   "ioctl error for %s", *argv);
  }  
159    
160   return 0;   return 0;
161  }  }

Legend:
Removed from v.532  
changed lines
  Added in v.816