/* vconfig.c - Creates virtual ethernet devices. * * Copyright 2012 Sandeep Sharma * Copyright 2012 Kyungwan Han * * No standard USE_VCONFIG(NEWTOY(vconfig, "<2>4", TOYFLAG_NEEDROOT|TOYFLAG_SBIN)) config VCONFIG bool "vconfig" default y help usage: vconfig COMMAND [OPTIONS] Create and remove virtual ethernet devices add [interface-name] [vlan_id] rem [vlan-name] set_flag [interface-name] [flag-num] [0 | 1] set_egress_map [vlan-name] [skb_priority] [vlan_qos] set_ingress_map [vlan-name] [skb_priority] [vlan_qos] set_name_type [name-type] */ #include "toys.h" #include #include void vconfig_main(void) { struct vlan_ioctl_args request; char *cmd = *toys.optargs; int fd = xsocket(AF_INET, SOCK_STREAM, 0); memset(&request, 0, sizeof(struct vlan_ioctl_args)); if (!strcmp(cmd, "set_name_type")) { char *types[] = {"VLAN_PLUS_VID", "DEV_PLUS_VID", "VLAN_PLUS_VID_NO_PAD", "DEV_PLUS_VID_NO_PAD"}; int i, j = ARRAY_LEN(types); for (i=0; i