Revision: 549 http://vde.svn.sourceforge.net/vde/?rev=549&view=rev Author: rd235 Date: 2012-06-10 16:34:32 +0000 (Sun, 10 Jun 2012) Log Message: ----------- (rd235 experiemental branch) 802.1ad (QinQ) support.
Modified Paths: -------------- branches/rd235/vde-2/src/vde_switch/plugins/dump.c branches/rd235/vde-2/src/vde_switch/port.c Modified: branches/rd235/vde-2/src/vde_switch/plugins/dump.c =================================================================== --- branches/rd235/vde-2/src/vde_switch/plugins/dump.c 2012-05-02 07:26:10 UTC (rev 548) +++ branches/rd235/vde-2/src/vde_switch/plugins/dump.c 2012-06-10 16:34:32 UTC (rev 549) @@ -32,11 +32,11 @@ static int dump(char *arg) { int active=atoi(arg); - int rv; + //int rv; if (active) - rv=eventadd(testevent,"packet",dl); + /*rv=*/eventadd(testevent,"packet",dl); else - rv=eventdel(testevent,"packet",dl); + /*rv=*/eventdel(testevent,"packet",dl); return 0; } Modified: branches/rd235/vde-2/src/vde_switch/port.c =================================================================== --- branches/rd235/vde-2/src/vde_switch/port.c 2012-05-02 07:26:10 UTC (rev 548) +++ branches/rd235/vde-2/src/vde_switch/port.c 2012-06-10 16:34:32 UTC (rev 549) @@ -98,6 +98,7 @@ }; #define NOTINPOOL 0x8000 +#define ALLOWQINQ 0x4000 struct port { struct endpoint *ep; @@ -665,8 +666,14 @@ if (packet->header.proto[0] == 0x81 && packet->header.proto[1] == 0x00) { tagged=1; vlan=((packet->data[0] << 8) + packet->data[1]) & 0xfff; - if (! ba_check(vlant[vlan].table,port)) - return; /*discard unwanted packets*/ + if (! ba_check(vlant[vlan].table,port)) { + if (portv[port]->flag & ALLOWQINQ) { + if ((vlan=portv[port]->vlanuntag) == NOVLAN) + return; /*discard unwanted packets*/ + tagged=0; + } else + return; /*discard unwanted packets*/ + } } else { tagged=0; if ((vlan=portv[port]->vlanuntag) == NOVLAN) @@ -1026,6 +1033,22 @@ return 0; } +static int portallowqinq(char *arg) +{ + int port,value; + if (sscanf(arg,"%i %i",&port,&value) != 2) + return EINVAL; + if (port < 0 || port >= numports) + return EINVAL; + if (portv[port] == NULL) + return ENXIO; + if (value) + portv[port]->flag |= ALLOWQINQ; + else + portv[port]->flag &= ~ALLOWQINQ; + return 0; +} + static int portsetuser(char *arg) { int port; @@ -1488,6 +1511,10 @@ case 't': rv=vlanaddport_nocheck(portno,atoi(++setup)); break; + case 'q': + portv[portno]->flag |= ALLOWQINQ; + ++setup; + break; } if (rv != 0) break; while (*setup && (*setup == ',' || isdigit(*setup))) @@ -1626,6 +1653,7 @@ {"port/create","N","create port N for preconfiguration",portcreate,INTARG}, {"port/remove","N","remove the port N",portremove,INTARG}, {"port/preconfigure","N 0/1","Is the port allocatable as unnamed? 1=Y 0=N",portpreconfigure,STRARG}, + {"port/qinq","N 0/1","Allow QinQ (802.1ad) conversion? 1=Y 0=N",portallowqinq,STRARG}, {"port/setuser","N user","access control: set user",portsetuser,STRARG}, {"port/setgroup","N user","access control: set group",portsetgroup,STRARG}, {"port/epclose","N ID","remove the endpoint port N/id ID",epclose,STRARG}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ vde-users mailing list vde-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vde-users