Repository : ssh://git@open-mesh.org/doc
On branches: backup-redmine/2017-07-13,master
>---------------------------------------------------------------
commit 63da457ec7f3e94b5c7b9afe65bd5c384aae5393
Author: Martin Hundebøll <martin(a)hundeboll.net>
Date: Wed Jan 11 10:28:04 2012 +0000
doc: attachments/vde2-2.3.2_colour.patch
>---------------------------------------------------------------
63da457ec7f3e94b5c7b9afe65bd5c384aae5393
...-2.3.1_colour.patch => vde2-2.3.2_colour.patch} | 133 +++++++++++++++------
1 file changed, 98 insertions(+), 35 deletions(-)
diff --git a/attachments/vde2-2.3.1_colour.patch b/attachments/vde2-2.3.2_colour.patch
similarity index 53%
copy from attachments/vde2-2.3.1_colour.patch
copy to attachments/vde2-2.3.2_colour.patch
index 9aee63e0..260ad790 100644
--- a/attachments/vde2-2.3.1_colour.patch
+++ b/attachments/vde2-2.3.2_colour.patch
@@ -1,34 +1,40 @@
-diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
---- vde2-2.3.1-orig/src/vde_switch/port.c 2010-07-25 19:48:01.000000000 +0200
-+++ vde2-2.3.1/src/vde_switch/port.c 2011-03-17 11:54:46.000000000 +0100
-@@ -91,6 +91,7 @@ struct port {
- int fd_data;
+diff -urp vde2-2.3.2-orig/src/vde_switch/port.c vde2-2.3.2/src/vde_switch/port.c
+--- vde2-2.3.2-orig/src/vde_switch/port.c 2011-11-23 17:41:17.000000000 +0100
++++ vde2-2.3.2/src/vde_switch/port.c 2012-01-11 10:00:17.763662681 +0100
+@@ -96,6 +96,7 @@ struct endpoint {
+ struct port {
struct endpoint *ep;
int flag;
-+ int colour;
++ int colour;
/* sender is already inside ms, but it needs one more memaccess */
- int (*sender)(int fd, int fd_ctl, void *packet, int len, void *data, int port);
+ int (*sender)(int fd_ctl, int fd_data, void *packet, int len, int port);
struct mod_support *ms;
-@@ -148,6 +149,7 @@ static int alloc_port(unsigned int portn
+@@ -153,6 +154,7 @@ static int alloc_port(unsigned int portn
EVENTOUT(DBGPORTNEW,i);
portv[i]=port;
+ port->colour=0;
- port->fd_data=-1;
port->ep=NULL;
port->user=port->group=port->curuser=-1;
-@@ -552,7 +554,7 @@ void handle_in_packet(int port, struct
- if (pflag & HUB_TAG) { /* this is a HUB */
+ #ifdef FSTP
+@@ -589,12 +591,12 @@ void handle_in_packet(struct endpoint *e
register int i;
+ #ifndef VDE_PQ2
for(i = 1; i < numports; i++)
- if((i != port) && (portv[i] != NULL))
+ if((i != port) && (portv[i] != NULL) && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour))
SEND_PACKET_PORT(portv[i],i,packet,len);
+ #else
+ void *tmpbuf=NULL;
+ for(i = 1; i < numports; i++)
+- if((i != port) && (portv[i] != NULL))
++ if((i != port) && (portv[i] != NULL) && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour))
+ SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbuf);
+ #endif
} else { /* This is a switch, not a HUB! */
- if (packet->header.proto[0] == 0x81 && packet->header.proto[1] == 0x00) {
-@@ -595,17 +597,17 @@ void handle_in_packet(int port, struct
- if (tagged) {
+@@ -639,35 +641,35 @@ void handle_in_packet(struct endpoint *e
register int i;
+ #ifndef VDE_PQ2
ba_FORALL(vlant[vlan].bctag,numports,
- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
+ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
@@ -36,8 +42,20 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
ba_FORALL(vlant[vlan].bcuntag,numports,
- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
+ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
+ #else
+ void *tmpbuft=NULL;
+ void *tmpbufu=NULL;
+ ba_FORALL(vlant[vlan].bctag,numports,
+- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbuft);}),i);
++ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbuft);}),i);
+ packet=TAG2UNTAG(packet,len);
+ ba_FORALL(vlant[vlan].bcuntag,numports,
+- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbufu);}),i);
++ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbufu);}),i);
+ #endif
} else { /* untagged */
register int i;
+ #ifndef VDE_PQ2
ba_FORALL(vlant[vlan].bcuntag,numports,
- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
+ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
@@ -45,11 +63,21 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
ba_FORALL(vlant[vlan].bctag,numports,
- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
+ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len);}),i);
+ #else
+ void *tmpbufu=NULL;
+ void *tmpbuft=NULL;
+ ba_FORALL(vlant[vlan].bcuntag,numports,
+- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbufu);}),i);
++ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbufu);}),i);
+ packet=UNTAG2TAG(packet,vlan,len);
+ ba_FORALL(vlant[vlan].bctag,numports,
+- ({if (i != port) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbuft);}),i);
++ ({if (i != port && (!(pflag & COLOURFUL_TAG) || portv[i]->colour != portv[port]->colour)) SEND_PACKET_PORT(portv[i],i,packet,len,&tmpbuft);}),i);
+ #endif
}
}
- else {
-@@ -615,17 +617,23 @@ void handle_in_packet(int port, struct
- return; /*do not loop!*/
+@@ -679,35 +681,47 @@ void handle_in_packet(struct endpoint *e
+ #ifndef VDE_PQ2
if (tagged) {
if (portv[tarport]->vlanuntag==vlan) { /* TAG->UNTAG */
- packet = TAG2UNTAG(packet,len);
@@ -77,8 +105,38 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
+ }
}
}
- } /* if(BROADCAST) */
-@@ -639,6 +647,7 @@ static int showinfo(FILE *fd)
+ #else
+ if (tagged) {
+ void *tmpbuf=NULL;
+ if (portv[tarport]->vlanuntag==vlan) { /* TAG->UNTAG */
+- packet = TAG2UNTAG(packet,len);
+- SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
++ if (!(pflag & COLOURFUL_TAG) || portv[tarport]->colour != portv[port]->colour) {
++ packet = TAG2UNTAG(packet,len);
++ SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
++ }
+ } else { /* TAG->TAG */
+- SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
++ if (!(pflag & COLOURFUL_TAG) || portv[tarport]->colour != portv[port]->colour)
++ SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
+ }
+ } else {
+ void *tmpbuf=NULL;
+ if (portv[tarport]->vlanuntag==vlan) { /* UNTAG->UNTAG */
+- SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
++ if (!(pflag & COLOURFUL_TAG) || portv[tarport]->colour != portv[port]->colour)
++ SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
+ } else { /* UNTAG->TAG */
+- packet = UNTAG2TAG(packet,vlan,len);
+- SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
++ if (!(pflag & COLOURFUL_TAG) || portv[tarport]->colour != portv[port]->colour) {
++ packet = UNTAG2TAG(packet,vlan,len);
++ SEND_PACKET_PORT(portv[tarport],tarport,packet,len,&tmpbuf);
++ }
+ }
+ }
+ #endif
+@@ -722,6 +736,7 @@ static int showinfo(FILE *fd)
{
printoutc(fd,"Numports=%d",numports);
printoutc(fd,"HUB=%s",(pflag & HUB_TAG)?"true":"false");
@@ -86,9 +144,9 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
#ifdef PORTCOUNTERS
printoutc(fd,"counters=true");
#else
-@@ -814,6 +823,19 @@ static int epclose(char *arg)
- return close_ep(port,id);
+@@ -921,6 +936,19 @@ static int epqlen(char *arg)
}
+ #endif
+static int portsetcolour(char *arg)
+{
@@ -106,22 +164,29 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
static char *port_getuser(uid_t uid)
{
static char buf[6];
-@@ -864,6 +886,7 @@ static int print_port(FILE *fd,int i,int
+@@ -971,6 +999,7 @@ static int print_port(FILE *fd,int i,int
printoutc(fd," IN: pkts %10lld bytes %20lld",portv[i]->pktsin,portv[i]->bytesin);
printoutc(fd," OUT: pkts %10lld bytes %20lld",portv[i]->pktsout,portv[i]->bytesout);
#endif
+ printoutc(fd," colour: %10d",portv[i]->colour);
- for (ep=portv[i]->ep; ep != NULL; ep=ep->next)
+ for (ep=portv[i]->ep; ep != NULL; ep=ep->next) {
printoutc(fd," -- endpoint ID %04d module %-12s: %s",ep->fd_ctl,
portv[i]->ms->modname,(ep->descr)?ep->descr:"no endpoint description");
-@@ -948,6 +971,15 @@ static int portsethub(int val)
+@@ -1053,12 +1082,21 @@ static int portsethub(int val)
+ #ifdef FSTP
+ fstpshutdown();
+ #endif
+- portflag(P_SETFLAG,HUB_TAG);
++ portflag(P_ADDFLAG,HUB_TAG);
+ } else
+ portflag(P_CLRFLAG,HUB_TAG);
return 0;
}
+static int portsetcolourful(int val)
+{
+ if (val) {
-+ portflag(P_SETFLAG,COLOURFUL_TAG);
++ portflag(P_ADDFLAG,COLOURFUL_TAG);
+ } else
+ portflag(P_CLRFLAG,COLOURFUL_TAG);
+ return 0;
@@ -130,7 +195,7 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
static int portsetvlan(char *arg)
{
int port,vlan;
-@@ -1202,6 +1234,7 @@ static struct comlist cl[]={
+@@ -1339,6 +1377,7 @@ static struct comlist cl[]={
{"port/setnumports","N","set the number of ports",portsetnumports,INTARG},
/*{"port/setmacaddr","MAC","set the switch MAC address",setmacaddr,STRARG},*/
{"port/sethub","0/1","1=HUB 0=switch",portsethub,INTARG},
@@ -138,18 +203,18 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.c vde2-2.3.1/src/vde_switch/port.c
{"port/setvlan","N VLAN","set port VLAN (untagged)",portsetvlan,STRARG},
{"port/createauto","","create a port with an automatically allocated id (inactive|notallocatable)",portcreateauto,NOARG|WITHFILE},
{"port/create","N","create the port N (inactive|notallocatable)",portcreate,INTARG},
-@@ -1209,6 +1242,7 @@ static struct comlist cl[]={
+@@ -1346,6 +1385,7 @@ static struct comlist cl[]={
{"port/allocatable","N 0/1","Is the port allocatable as unnamed? 1=Y 0=N",portallocatable,STRARG},
{"port/setuser","N user","access control: set user",portsetuser,STRARG},
{"port/setgroup","N user","access control: set group",portsetgroup,STRARG},
+ {"port/setcolour","N COLOUR","change colour of port",portsetcolour,STRARG},
{"port/epclose","N ID","remove the endpoint port N/id ID",epclose,STRARG},
- #ifdef PORTCOUNTERS
- {"port/resetcounter","[N]","reset the port (N) counters",portresetcounters,STRARG},
-diff -urp vde2-2.3.1-orig/src/vde_switch/port.h vde2-2.3.1/src/vde_switch/port.h
---- vde2-2.3.1-orig/src/vde_switch/port.h 2010-07-25 19:48:01.000000000 +0200
-+++ vde2-2.3.1/src/vde_switch/port.h 2011-03-17 11:54:46.000000000 +0100
-@@ -62,6 +62,7 @@ int portflag(int op, int f);
+ #ifdef VDE_PQ2
+ {"port/defqlen","LEN","set the default queue length for new ports",defqlen,INTARG},
+diff -urp vde2-2.3.2-orig/src/vde_switch/port.h vde2-2.3.2/src/vde_switch/port.h
+--- vde2-2.3.2-orig/src/vde_switch/port.h 2011-11-23 17:41:17.000000000 +0100
++++ vde2-2.3.2/src/vde_switch/port.h 2012-01-11 09:57:54.080058808 +0100
+@@ -68,6 +68,7 @@ int portflag(int op, int f);
#define P_CLRFLAG 3
#define HUB_TAG 0x1
@@ -157,5 +222,3 @@ diff -urp vde2-2.3.1-orig/src/vde_switch/port.h vde2-2.3.1/src/vde_switch/port.h
void port_init(int numports);
-Only in vde2-2.3.1/src/vde_switch: port.h.orig
-Only in vde2-2.3.1/src/vde_switch: port.o