X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cli%2Fcommands.c;h=552d18e03b4e9fd8430f9fd30148828e5239c50e;hb=602baa14950a0a9144df0893a3db2cb711a52272;hp=a35b8bf2356d30829b646096523fbdd1bed5921f;hpb=0eb28539a42fcb01078c7bca793c741317656f14;p=ngadmin diff --git a/cli/commands.c b/cli/commands.c index a35b8bf..552d18e 100644 --- a/cli/commands.c +++ b/cli/commands.c @@ -4,1326 +4,103 @@ -// ============================================================================= // bitrate +bool do_bitrate_set (int nb, const char **com, struct ngadmin *nga); +bool do_bitrate_show (int nb, const char **com, struct ngadmin *nga); -// helper function to analyse bitrate speed specifications -static int bitrate_analyse (int nb, const char **com, int *ports) { - - int i=0, s; - - - while ( i SPEEDSPEC [ SPEEDSPEC ...]\n"); - printf("SPEEDSPEC: [inout ] [in ] [out ]\n"); - ret=false; - goto end; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - ports=malloc(2*sa->ports*sizeof(int)); - - // get defaults if present - if ( strcmp(com[k], "all")==0 ) { - ++k; - k+=bitrate_analyse(nb-k, &com[k], defs); - } - - // apply defaults - for (i=0; iports; ++i) { - memcpy(&ports[2*i], defs, sizeof(defs)); - } - - // get ports specifics - while ( k=0 && pports ) { - k+=bitrate_analyse(nb-k, &com[k], &ports[2*p]); - } - } - - // send it to the switch - i=ngadmin_setBitrateLimits(nga, ports); - printErrCode(i); - - - end: - free(ports); - - return ret; - -} - - - -static bool do_bitrate_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i, ret=true, *ports=NULL; - const struct swi_attr *sa; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - - ports=malloc(2*sa->ports*sizeof(int)); - if ( (i=ngadmin_getBitrateLimits(nga, ports))!=ERR_OK ) { - printErrCode(i); - ret=false; - goto end; - } - - for (i=0; iports; ++i) { - printf("port %i: in %s, out %s\n", i+1, bitrates[ports[2*i+0]], bitrates[ports[2*i+1]]); - } - - end: - free(ports); - - return ret; - -} - - - -// ============================================================================= // cabletest +bool do_cabletest (int nb, const char **com, struct ngadmin *nga); -static bool do_cabletest (int nb, const char **com, struct ngadmin *nga) { - - bool ret=true; - const struct swi_attr *sa; - struct cabletest *ct=NULL; - int i, j=0, k=0; - - - if ( nb<1 ) { - printf("Usage: cabletest [ ...]\n"); - goto end; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - ct=malloc(sa->ports*sizeof(struct cabletest)); - memset(ct, 0, sa->ports*sizeof(struct cabletest)); - - while ( k=1 && ct[j].port<=sa->ports ) ++j; - } - - i=ngadmin_cabletest(nga, ct, j); - if ( i<0 ) { - printErrCode(i); - ret=false; - goto end; - } - - - for (i=0; ifirmware); - - - end: - - return ret; - -} - - - -static bool do_firmware_upgrade (int nb, const char **com UNUSED, struct ngadmin *nga) { - - const struct swi_attr *sa; - bool ret=true; - - - if ( nb!=1 ) { - printf("Usage: firmware upgrade \n"); - ret=false; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - printf("not implemented yet\n"); - - - end: - - return ret; - -} - - - -// ============================================================================= // igmp +bool do_igmp_set (int nb, const char **com, struct ngadmin *nga); +bool do_igmp_show (int nb, const char **com, struct ngadmin *nga); -static bool do_igmp_set (int nb, const char **com, struct ngadmin *nga) { - - int i; - struct igmp_conf ic; - - - if ( nb!=4 ) { - printf("Usage: igmp set \n"); - return false; - } - - if ( ngadmin_getCurrentSwitch(nga)==NULL ) { - printf("must be logged\n"); - return false; - } - - ic.enable=strtol(com[0], NULL, 0); - ic.vlan=strtol(com[1], NULL, 0); - ic.validate=strtol(com[2], NULL, 0); - ic.block=strtol(com[3], NULL, 0); - - i=ngadmin_setIGMPConf(nga, &ic); - printErrCode(i); - - - return true; - -} - - - -static bool do_igmp_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - struct igmp_conf ic; - bool ret=true; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - i=ngadmin_getIGMPConf(nga, &ic); - if ( i!=ERR_OK ) { - printErrCode(i); - ret=false; - goto end; - } - - - printf("IGMP snooping enabled: %s\n", ic.enable ? "yes" : "no" ); - printf("IGMP snooping vlan: %u\n", ic.vlan); - printf("Validate IGMPv3 headers: %s\n", ic.validate ? "yes" : "no" ); - printf("Block unknown multicast addresses: %s\n", ic.block ? "yes" : "no" ); - - - - end: - - return ret; - -} - - - -// ============================================================================= // list +bool do_list (int nb, const char **com, struct ngadmin *nga); -static bool do_list (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int n; - const struct swi_attr *sa; - - - sa=ngadmin_getSwitchTab(nga, &n); - displaySwitchTab(sa, n); - - - return true; - -} - - - -// ============================================================================= // login +bool do_login (int nb, const char **com, struct ngadmin *nga); -static bool do_login (int nb, const char **com, struct ngadmin *nga) { - - int i; - - - if ( nb!=1 ) { - printf("Usage: login \n"); - return false; - } - - - i=strtol(com[0], NULL, 0); - i=ngadmin_login(nga, i); - printErrCode(i); - - - return true; - -} - - - -// ============================================================================= // mirror +bool do_mirror_disable (int nb, const char **com, struct ngadmin *nga); +bool do_mirror_set (int nb, const char **com, struct ngadmin *nga); +bool do_mirror_show (int nb, const char **com, struct ngadmin *nga); -static bool do_mirror_disable (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - - - if ( ngadmin_getCurrentSwitch(nga)==NULL ) { - printf("must be logged\n"); - return false; - } - - - i=ngadmin_setMirror(nga, NULL); - printErrCode(i); - - - return true; - -} - - - -static bool do_mirror_set (int nb, const char **com, struct ngadmin *nga) { - - const struct swi_attr *sa; - char *ports=NULL; - bool ret=true; - int i, k=0; - - - if ( nb<3 ) { - printf("Usage: mirror set clone [ ...]\n"); - goto end; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - - ports=malloc((sa->ports+1)*sizeof(char)); - memset(ports, 0, sa->ports+1); - - ports[0]=strtol(com[k++], NULL, 0); - if ( ports[0]<1 || ports[0]>sa->ports || strcasecmp(com[k++], "clone")!=0 ) { - printf("syntax error\n"); - ret=false; - goto end; - } - - - while ( ksa->ports ) { - printf("port out of range\n"); - ret=false; - goto end; - } else if ( i==ports[0] ) { - printf("destination port cannot be in port list\n"); - ret=false; - goto end; - } - ports[i]=1; - } - - - i=ngadmin_setMirror(nga, ports); - printErrCode(i); - - - end: - free(ports); - - return ret; - -} - - - -static bool do_mirror_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - const struct swi_attr *sa; - char *ports=NULL; - int i; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - - ports=malloc((sa->ports+1)*sizeof(char)); - - i=ngadmin_getMirror(nga, ports); - if ( i!=ERR_OK ) { - printErrCode(i); - goto end; - } - - if ( ports[0]==0 ) { - printf("port mirroring is disabled\n"); - goto end; - } - - printf("destination: %i\n", ports[0]); - printf("ports: "); - for (i=1; i<=sa->ports; ++i) { - if ( ports[i] ) { - printf("%i ", i); - } - } - printf("\n"); - - - - end: - free(ports); - - return true; - -} - - - -// ============================================================================= // name +bool do_name_show (int nb, const char **com, struct ngadmin *nga); +bool do_name_set (int nb, const char **com, struct ngadmin *nga); +bool do_name_clear (int nb, const char **com, struct ngadmin *nga); -static bool do_name_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - const struct swi_attr *sa; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - puts(sa->name); - - - return true; - -} - - - -static bool do_name_set (int nb, const char **com, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - - - if ( nb!=1 ) { - printf("Usage: name set \n"); - return false; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - i=ngadmin_setName(nga, com[0]); - printErrCode(i); - - - return true; - -} - - - -static bool do_name_clear (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - i=ngadmin_setName(nga, NULL); - printErrCode(i); - - - return true; - -} - - - -// ============================================================================= // netconf +bool do_netconf_set (int nb, const char **com, struct ngadmin *nga); -static bool do_netconf_set (int nb, const char **com, struct ngadmin *nga) { - - int i, k; - const struct swi_attr *sa; - struct net_conf nc; - bool ret=true; - - - if ( nb==0 ) { - printf("Usage: netconf set [dhcp yes|no] [ip ] [mask ] [gw ]\n"); - return false; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - - memset(&nc, 0, sizeof(struct net_conf)); - - for (k=0; k\n"); - return false; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - i=ngadmin_changePassword(nga, com[0]); - printErrCode(i); - - - return true; - -} - - - -static bool do_password_set (int nb, const char **com, struct ngadmin *nga) { - - int i; - - - if ( nb!=1 ) { - printf("Usage: password set \n"); - return false; - } - - i=ngadmin_setPassword(nga, com[0]); - printErrCode(i); - - - return true; - -} - - - -// ============================================================================= // ports +bool do_ports_state (int nb, const char **com, struct ngadmin *nga); +bool do_ports_statistics_reset (int nb, const char **com, struct ngadmin *nga); +bool do_ports_statistics_show (int nb, const char **com, struct ngadmin *nga); -static bool do_ports_state (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - unsigned char *ports=NULL; - bool ret=true; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - - ports=malloc(sa->ports*sizeof(unsigned char)); - if ( (i=ngadmin_getPortsStatus(nga, ports))<0 ) { - printErrCode(i); - ret=false; - goto end; - } - - for (i=0; iports; i++) { - printf("port %i: ", i+1); - switch ( ports[i] ) { - case 0: printf("down"); break; - case SPEED_10: printf("up, 10M"); break; - case SPEED_100: printf("up, 100M"); break; - case SPEED_1000: printf("up, 1000M"); break; - default: printf("unknown (%i)", ports[i]); - } - putchar('\n'); - } - - end: - free(ports); - - - return ret; - -} - - - -static bool do_ports_statistics_reset (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - - - if ( ngadmin_getCurrentSwitch(nga)==NULL ) { - printf("must be logged\n"); - return false; - } - - i=ngadmin_resetPortsStatistics(nga); - printErrCode(i); - - - return true; - -} - - - -static bool do_ports_statistics_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - bool ret=true; - struct port_stats *ps=NULL; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - ps=calloc(sa->ports, sizeof(struct port_stats)); - if ( (i=ngadmin_getPortsStatistics(nga, ps))<0 ) { - printErrCode(i); - ret=false; - goto end; - } - - printf("Port\tReceived\tSent\tCRC errors\n"); - for (i=0; iports; ++i) { - printf("% 4i%12llu%12llu%14llu\n", i+1, ps[i].recv, ps[i].sent, ps[i].crc); - } - - end: - free(ps); - - - return ret; - -} - - - - -// ============================================================================= // qos +bool do_qos_mode (int nb, const char **com, struct ngadmin *nga); +bool do_qos_set (int nb, const char **com, struct ngadmin *nga); +bool do_qos_show (int nb, const char **com, struct ngadmin *nga); - -static bool do_qos_mode (int nb, const char **com, struct ngadmin *nga) { - - int i, s, ret=true; - const struct swi_attr *sa; - - - if ( nb==0 ) { - printf("Usage: qos mode port|802.1p\n"); - goto end; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - - if ( strcasecmp(com[0], "port")==0 ) { - s=QOS_PORT; - } else if ( strcasecmp(com[0], "802.1p")==0 ) { - s=QOS_DOT; - } else { - printf("Unknown QOS mode\n"); - ret=false; - goto end; - } - - - i=ngadmin_setQOSMode(nga, s); - printErrCode(i); - - - end: - - return ret; - -} - - - -static bool do_qos_set (int nb, const char **com, struct ngadmin *nga) { - - int i, p; - const struct swi_attr *sa; - bool ret=true; - char d=PRIO_UNSPEC, *ports=NULL; - - - if ( nb<2 ) { - printf("Usage: qos set (all )|( [ ...])\n"); - ret=false; - goto end; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - - ports=malloc(sa->ports*sizeof(char)); - - if ( strcmp(com[0], "all")==0 ) { - d=parsePrio(com[1]); - com+=2; - nb-=2; - } - - for (i=0; iports; ++i) { - ports[i]=d; - } - - for (i=0; isa->ports ) continue; - ports[p-1]=parsePrio(com[i+1]); - } - - - i=ngadmin_setQOSValues(nga, ports); - printErrCode(i); - - - end: - free(ports); - - return ret; - -} - - - -static bool do_qos_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i, s=0, ret=true; - const struct swi_attr *sa; - char *ports=NULL; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - if ( (i=ngadmin_getQOSMode(nga, &s))!=ERR_OK ) { - printErrCode(i); - ret=false; - goto end; - } - - - printf("QOS mode: "); - - if ( s==QOS_DOT ) { - printf("802.1p\n"); - goto end; - } else if ( s!=QOS_PORT ) { - printf("unknown (%i)\n", s); - goto end; - } - - printf("port based\n"); - - ports=malloc(sa->ports*sizeof(char)); - - if ( (i=ngadmin_getQOSValues(nga, ports))!=ERR_OK ) { - printErrCode(i); - ret=false; - goto end; - } - - for (i=0; iports; ++i) { - printf("port %i: %s\n", i+1, prio[(int)ports[i]]); - } - - - end: - free(ports); - - return ret; - -} - - - -// ============================================================================= // quit +bool do_quit (int nb, const char **com, struct ngadmin *nga); -static bool do_quit (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga UNUSED) { - - cont=0; - - return true; - -} - - - -// ============================================================================= // restart +bool do_restart (int nb, const char **com, struct ngadmin *nga); -static bool do_restart (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga UNUSED) { - - int i, ret=true; - const struct swi_attr *sa; - char line[16]; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - - printf("The switch will be restarted. Continue ? [y/N]: "); - fflush(stdout); - - if ( fgets(line, sizeof(line), stdin)!=NULL && strcasecmp(line, "y\n")==0 ) { - i=ngadmin_restart(nga); - printErrCode(i); - } - - - end: - - return ret; - -} - - - -// ============================================================================= // scan +bool do_scan (int nb, const char **com, struct ngadmin *nga); -static bool do_scan (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - - - if ( (i=ngadmin_scan(nga))<0 ) { - printErrCode(i); - return false; - } - - sa=ngadmin_getSwitchTab(nga, &nb); - displaySwitchTab(sa, nb); - - - return true; - -} - - - -// ============================================================================= // stormfilter +bool do_stormfilter_enable (int nb, const char **com, struct ngadmin *nga); +bool do_stormfilter_disable (int nb, const char **com, struct ngadmin *nga); +bool do_stormfilter_set (int nb, const char **com, struct ngadmin *nga); +bool do_stormfilter_show (int nb, const char **com, struct ngadmin *nga); -static bool do_stormfilter_enable (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - i=ngadmin_setStormFilterState(nga, 1); - printErrCode(i); - - - return true; - -} - - - -static bool do_stormfilter_disable (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i; - const struct swi_attr *sa; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - return false; - } - - i=ngadmin_setStormFilterState(nga, 0); - printErrCode(i); - - - return true; - -} - - - -static bool do_stormfilter_set (int nb, const char **com, struct ngadmin *nga) { - - int i, d=BITRATE_UNSPEC, p, *ports=NULL; - const struct swi_attr *sa; - bool ret=true; - - - if ( nb<2 ) { - printf("Usage: stormfilt set (all )|( [ ...])\n"); - ret=false; - goto end; - } - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - - ports=malloc(sa->ports*sizeof(int)); - - if ( strcmp(com[0], "all")==0 ) { - d=parseBitrate(com[1]); - com+=2; - nb-=2; - } - - for (i=0; iports; ++i) { - ports[i]=d; - } - - for (i=0; isa->ports ) continue; - ports[p-1]=parseBitrate(com[i+1]); - } - - - i=ngadmin_setStormFilterValues(nga, ports); - printErrCode(i); - - - end: - free(ports); - - return ret; - -} - - - -static bool do_stormfilter_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i, s, ret=true, *ports=NULL; - const struct swi_attr *sa; - - - if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - if ( (i=ngadmin_getStormFilterState(nga, &s))!=ERR_OK ) { - printErrCode(i); - ret=false; - goto end; - } - - - if ( !s ) { - printf("storm filter is disabled\n"); - goto end; - } - - printf("storm filter is enabled\n"); - - ports=malloc(sa->ports*sizeof(int)); - if ( (i=ngadmin_getStormFilterValues(nga, ports))!=ERR_OK ) { - printErrCode(i); - ret=false; - goto end; - } - - for (i=0; iports; ++i) { - printf("port %i: %s\n", i+1, bitrates[ports[i]]); - } - - end: - free(ports); - - return ret; - -} - - - -// ============================================================================= // tree +bool do_tree (int nb, const char **com, struct ngadmin *nga); -static void display_node (const struct TreeNode *tn, int depth) { - - int i; - const struct TreeNode *s; - - - for (i=0; iname); - - if ( tn->sub==NULL ) return; - - for (s=tn->sub; s->name!=NULL; ++s) { - display_node(s, depth+1); - } - - -} - - -static bool do_tree (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga UNUSED) { - - - display_node(&coms, 0); - - - return true; - -} - - - -// ============================================================================= // vlan +bool do_vlan_8021q_show (int nb, const char **com, struct ngadmin *nga); +bool do_vlan_8021q_vlan_del (int nb, const char **com, struct ngadmin *nga); +bool do_vlan_mode_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga); +bool do_vlan_pvid_set (int nb, const char **com, struct ngadmin *nga); +bool do_vlan_pvid_show (int nb, const char **com, struct ngadmin *nga); -static char vlan_char (int t) { - - switch ( t ) { - case VLAN_TAGGED: return 'T'; - case VLAN_UNTAGGED: return 'U'; - case VLAN_NO: return ' '; - default: return '?'; - } - -} - - -static bool print_vlan_dot_adv (struct ngadmin *nga) { - - char buffer[512], *b=buffer; - const struct swi_attr *sa; - int i, t; - - - sa=ngadmin_getCurrentSwitch(nga); - - t=sizeof(buffer); - i=ngadmin_getVLANDotConf(nga, buffer, &t); - if ( i!=ERR_OK ) { - printErrCode(i); - return false; - } - - printf("Ports configuration: \n"); - printf("VLAN\t"); - for (i=1; i<=sa->ports; ++i) { - printf("%i\t", i); - } - putchar('\n'); - - while ( b-bufferports; ++i) { - printf("%c\t", vlan_char(*b++)); - } - putchar('\n'); - } - - - return true; - -} - - -static bool do_vlan_show (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) { - - int i, t, ret=true; - - - if ( ngadmin_getCurrentSwitch(nga)==NULL ) { - printf("must be logged\n"); - ret=false; - goto end; - } - - if ( (i=ngadmin_getVLANType(nga, &t))!=ERR_OK ) { - printErrCode(i); - ret=false; - goto end; - } - - - printf("VLAN type: "); - switch ( t ) { - case VLAN_DISABLED: printf("disabled\n"); break; - case VLAN_PORT_BASIC: printf("port basic\n"); break; - case VLAN_PORT_ADV: printf("port advanced\n"); break; - case VLAN_DOT_BASIC: printf("802.1Q basic\n"); break; - - case VLAN_DOT_ADV: - printf("802.1Q advanced\n\n"); - ret=print_vlan_dot_adv(nga); - break; - - default: printf("unknown (%i)\n", t); - } - - - - end: - - return ret; - -} - - - -// ============================================================================= - +// commands structure COM_ROOT_START(coms) COM_START(bitrate) @@ -1400,8 +177,28 @@ COM_ROOT_START(coms) COM_TERM(tree, do_tree, false) COM_START(vlan) - COM_TERM(show, do_vlan_show, false) - COM_TERM(mode, NULL, true) + COM_START(802.1q) + COM_START(port) + COM_TERM(add, NULL, true) + COM_TERM(del, NULL, true) + COM_END + COM_TERM(show, do_vlan_8021q_show, true) + COM_START(vlan) + COM_TERM(add, NULL, true) + COM_TERM(del, do_vlan_8021q_vlan_del, true) + COM_TERM(flush, NULL, true) + COM_END + COM_END + COM_START(mode) + COM_TERM(set, NULL, true) + COM_TERM(show, do_vlan_mode_show, false) + COM_END + COM_START(port) + COM_END + COM_START(pvid) + COM_TERM(set, do_vlan_pvid_set, true) + COM_TERM(show, do_vlan_pvid_show, false) + COM_END COM_END COM_ROOT_END