Revision: 425
http://vde.svn.sourceforge.net/vde/?rev=425&view=rev
Author: shammash
Date: 2010-07-03 16:27:37 +0000 (Sat, 03 Jul 2010)
Log Message:
-----------
vde_switch: add port/createauto command
Add a functionality to create a new port with an automatically allocated it AND
print the new port id (didn't change port/create behaviour to avoid backward
compatibility problems). Thanks to Random J. Patcher (a.k.a. anonymous) from
sourceforge bug #2956694 .
Signed-off-by: Luca Bigliardi <[email protected]>
Modified Paths:
--------------
trunk/vde-2/src/vde_switch/port.c
Modified: trunk/vde-2/src/vde_switch/port.c
===================================================================
--- trunk/vde-2/src/vde_switch/port.c 2010-07-03 15:32:16 UTC (rev 424)
+++ trunk/vde-2/src/vde_switch/port.c 2010-07-03 16:27:37 UTC (rev 425)
@@ -791,6 +791,18 @@
return 0;
}
+static int portcreateauto(FILE* fd)
+{
+ int port = alloc_port(0);
+
+ if (port < 0)
+ return ENOSPC;
+
+ portv[port]->flag |= NOTINPOOL;
+ printoutc(fd, "Port %04d", port);
+ return 0;
+}
+
static int epclose(char *arg)
{
int port,id;
@@ -1189,6 +1201,7 @@
/*{"port/setmacaddr","MAC","set the switch MAC
address",setmacaddr,STRARG},*/
{"port/sethub","0/1","1=HUB 0=switch",portsethub,INTARG},
{"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},
{"port/remove","N","remove the port N",portremove,INTARG},
{"port/allocatable","N 0/1","Is the port allocatable as unnamed? 1=Y
0=N",portallocatable,STRARG},
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
vde-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vde-users