Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/networking/vconfig.c

    r821 r1765  
    1010/* BB_AUDIT SUSv3 N/A */
    1111
    12 #include <stdlib.h>
    13 #include <unistd.h>
    14 #include <fcntl.h>
    15 #include <sys/ioctl.h>
     12#include "libbb.h"
    1613#include <net/if.h>
    17 #include <string.h>
    18 #include <limits.h>
    19 #include "busybox.h"
    2014
    2115/* Stuff from linux/if_vlan.h, kernel version 2.4.23 */
     
    7064}
    7165
    72 static const char cmds[] = {
     66static const char cmds[] ALIGN1 = {
    7367    4, ADD_VLAN_CMD, 7,
    7468    'a', 'd', 'd', 0,
     
    7973    'n', 'a', 'm', 'e', '_',
    8074    't', 'y', 'p', 'e', 0,
    81     4, SET_VLAN_FLAG_CMD, 12,
     75    5, SET_VLAN_FLAG_CMD, 12,
    8276    's', 'e', 't', '_',
    8377    'f', 'l', 'a', 'g', 0,
     
    9286};
    9387
    94 static const char name_types[] = {
     88static const char name_types[] ALIGN1 = {
    9589    VLAN_NAME_TYPE_PLUS_VID, 16,
    9690    'V', 'L', 'A', 'N',
     
    111105};
    112106
    113 static const char conf_file_name[] = "/proc/net/vlan/config";
     107static const char conf_file_name[] ALIGN1 = "/proc/net/vlan/config";
    114108
     109int vconfig_main(int argc, char **argv);
    115110int vconfig_main(int argc, char **argv)
    116111{
     
    125120    /* Don't bother closing the filedes.  It will be closed on cleanup. */
    126121    /* Will die if 802.1q is not present */
    127     bb_xopen3(conf_file_name, O_RDONLY, 0);
     122    xopen(conf_file_name, O_RDONLY);
    128123
    129124    memset(&ifr, 0, sizeof(struct vlan_ioctl_args));
     
    140135    } else {
    141136        if (strlen(argv[1]) >= IF_NAMESIZE) {
    142             bb_error_msg_and_die("if_name >= %d chars\n", IF_NAMESIZE);
     137            bb_error_msg_and_die("if_name >= %d chars", IF_NAMESIZE);
    143138        }
    144139        strcpy(ifr.device1, argv[1]);
     
    151146         * more of a pain. */
    152147        if (ifr.cmd == SET_VLAN_FLAG_CMD) { /* set_flag */
    153             ifr.u.flag = bb_xgetularg10_bnd(p, 0, 1);
     148            ifr.u.flag = xatoul_range(p, 0, 1);
     149            /* DM: in order to set reorder header, qos must be set */
     150            ifr.vlan_qos = xatoul_range(argv[3], 0, 7);
    154151        } else if (ifr.cmd == ADD_VLAN_CMD) { /* add */
    155             ifr.u.VID = bb_xgetularg10_bnd(p, 0, VLAN_GROUP_ARRAY_LEN-1);
     152            ifr.u.VID = xatoul_range(p, 0, VLAN_GROUP_ARRAY_LEN-1);
    156153        } else if (ifr.cmd != DEL_VLAN_CMD) { /* set_{egress|ingress}_map */
    157             ifr.u.skb_priority = bb_xgetularg10_bnd(p, 0, ULONG_MAX);
    158             ifr.vlan_qos = bb_xgetularg10_bnd(argv[3], 0, 7);
     154            ifr.u.skb_priority = xatou(p);
     155            ifr.vlan_qos = xatoul_range(argv[3], 0, 7);
    159156        }
    160157    }
    161158
    162     fd = bb_xsocket(AF_INET, SOCK_STREAM, 0);
    163     if (ioctl(fd, SIOCSIFVLAN, &ifr) < 0) {
    164         bb_perror_msg_and_die("ioctl error for %s", *argv);
    165     }
     159    fd = xsocket(AF_INET, SOCK_STREAM, 0);
     160    ioctl_or_perror_and_die(fd, SIOCSIFVLAN, &ifr,
     161                        "ioctl error for %s", *argv);
    166162
    167163    return 0;
    168164}
    169 
Note: See TracChangeset for help on using the changeset viewer.