[vde-users] SF.net SVN: vde:[480] branches/rd235/vde-2/src/vde_switch

2011-03-27 Thread rd235
Revision: 480
  http://vde.svn.sourceforge.net/vde/?rev=480&view=rev
Author:   rd235
Date: 2011-03-27 09:07:52 + (Sun, 27 Mar 2011)

Log Message:
---
Step two towards a new management of packetq: fd->poll structure permutation 
array (O(1) access
to poll events), endpoint as an opaque identifier for upper 
layers.

Modified Paths:
--
branches/rd235/vde-2/src/vde_switch/consmgmt.c
branches/rd235/vde-2/src/vde_switch/datasock.c
branches/rd235/vde-2/src/vde_switch/port.c
branches/rd235/vde-2/src/vde_switch/port.h
branches/rd235/vde-2/src/vde_switch/switch.h
branches/rd235/vde-2/src/vde_switch/tuntap.c
branches/rd235/vde-2/src/vde_switch/vde_switch.c

Modified: branches/rd235/vde-2/src/vde_switch/consmgmt.c
===
--- branches/rd235/vde-2/src/vde_switch/consmgmt.c  2011-03-25 18:08:57 UTC 
(rev 479)
+++ branches/rd235/vde-2/src/vde_switch/consmgmt.c  2011-03-27 09:07:52 UTC 
(rev 480)
@@ -370,7 +370,7 @@
return;
}
 
-   add_fd(new,mgmt_data,-1);
+   add_fd(new,mgmt_data,NULL);
EVENTOUT(MGMTPORTNEW,new);
snprintf(buf,MAXCMD,header,PACKAGE_VERSION);
write(new,buf,strlen(buf));
@@ -381,7 +381,7 @@
 static int debugdel(int fd,char *arg);
 #endif
 static char *EOS=" END OF SESSION";
-static void handle_input(unsigned char type,int fd,int revents,int *unused)
+static void handle_input(unsigned char type,int fd,int revents,void 
*private_data)
 {
char buf[MAXCMD];
if (type != mgmt_ctl) {
@@ -393,7 +393,7 @@
printlog(LOG_WARNING,"Reading from mgmt 
%s",strerror(errno));
}
}
-   if (n==0) { /*EOF*/
+   if (n==0) { /*EOF || POLLHUP*/
if (type == console_type) {
printlog(LOG_WARNING,"EOF on stdin, cleaning up 
and exiting");
exit(0);
@@ -440,7 +440,7 @@
return;
}
 
-   add_fd(new,mgmt_data,-1);
+   add_fd(new,mgmt_data,NULL);
EVENTOUT(MGMTPORTNEW,new);
snprintf(buf,MAXCMD,header,PACKAGE_VERSION);
write(new,buf,strlen(buf));
@@ -478,7 +478,7 @@
fclose(f);
 }
 
-static void cleanup(unsigned char type,int fd,int arg)
+static void cleanup(unsigned char type,int fd,void *private_data)
 {
if (fd < 0) {
if((pidfile != NULL) && unlink(pidfile_path) < 0) {
@@ -572,7 +572,7 @@
if(isatty(0) && !daemonize)
{
console_type=add_type(&swmi,0);
-   add_fd(0,console_type,-1);
+   add_fd(0,console_type,NULL);
}
 
/* saves current path in pidfile_path, because otherwise with 
daemonize() we
@@ -625,7 +625,7 @@
}
mgmt_ctl=add_type(&swmi,0);
mgmt_data=add_type(&swmi,0);
-   add_fd(mgmtconnfd,mgmt_ctl,-1);
+   add_fd(mgmtconnfd,mgmt_ctl,NULL);
}
 }
 

Modified: branches/rd235/vde-2/src/vde_switch/datasock.c
===
--- branches/rd235/vde-2/src/vde_switch/datasock.c  2011-03-25 18:08:57 UTC 
(rev 479)
+++ branches/rd235/vde-2/src/vde_switch/datasock.c  2011-03-27 09:07:52 UTC 
(rev 480)
@@ -106,10 +106,11 @@
(stat((PATH),&s)?-1:s.st_uid); \
})
 
-static int new_port_v1_v3(int fd_ctl, int type_port,
+static struct endpoint *new_port_v1_v3(int fd_ctl, int type_port,
struct sockaddr_un *sun_out)
 {
int n, portno;
+   struct endpoint *ep;
enum request_type type = type_port & 0xff;
int port_request=type_port >> 8;
uid_t user=-1;
@@ -127,7 +128,7 @@
if (sun_out->sun_path[0] != 0) { //not for unnamed 
sockets
if (access(sun_out->sun_path,R_OK | W_OK) != 0) 
{ //socket error
remove_fd(fd_ctl);
-   return -1;
+   return NULL;
}
user=GETFILEOWNER(sun_out->sun_path);
}
@@ -135,13 +136,13 @@
if((fd_data = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0){
printlog(LOG_ERR,"socket: %s",strerror(errno));
remove_fd(fd_ctl);
-   return -1;
+   return NULL;
}
if(fcntl(fd_data, F_SETFL, O_NONBLOCK) < 0){
printlog(LOG_ERR,"Setting O_NONBLOCK on data fd 
%s",strerror(errno));
close(fd_data);
remove_fd(f

Re: [vde-users] qemu guess OS creating VLAN

2011-03-27 Thread Renzo Davoli
On Sat, Mar 26, 2011 at 03:50:03AM -0700, Ming-Ching Tiew wrote:
> 
> I have been using vde and qemu for a long while to connect multiple qemu 
> guest OSes together, I am finding it extremely useful to testing out certain 
> networking features. They have been working fine without any problem. This is 
> a example of set up of mine :-
> 
> #!/bin/sh
> for i in 1 2 3 4 5
> do
> vde_switch -sock /tmp/vde.ctl${i} -tap tap${i} -daemon
> done
> 
> 
> Example of a guest OS 1 using qemu :-
> 
> #!/bin/sh
> qemu-system-x86_64 \
> -net nic,model=rtl8139,vlan=0,macaddr=12:34:56:78:90:ac \
> -m 128 -boot c -hda guest.lan.img \
> -enable-kvm \
> -net vde,vlan=0,sock=/tmp/vde.ctl1
> 
> Guest OS 2 :-
> #!/bin/sh
> qemu-system-x86_64 \
> -net nic,model=rtl8139,vlan=0,macaddr=00:00:00:00:00:88 \
> -net nic,model=rtl8139,vlan=1,macaddr=00:00:00:00:00:89 \
> -net vde,vlan=0,sock=/tmp/vde.ctl1 \
> -net vde,vlan=1,sock=/tmp/vde.ctl2 \
> -enable-kvm \
> -m 96 -boot c -hda guest.nat.img
> 
> In this example, guest OS 1 eth0 will then be connected to guest OS 2 eth0. 
> Pinging each other without problem.
> 
> However if I setup VLAN in guest OS 1 and VLAN in guest OS 2, they can't ping 
> each other :-
> 
> Guest OS 1:-
> # vconfig add eth0 150
> # ifconfig eth0.150 192.168.200.1 up
> Guess OS 2:-
> # vconfig add eth0 150
> # ifconfig eth0.150 192.168.200.2 up
> 
> I can't ping each other.
> 
> I tried changing vde_switch adding '-hub' flag, it did not make any 
> difference. 
> 
> What am I doing wrong ? Has anyone tried this kind of configuration before ? 

A switch needs to be configured to manage 802.1Q. This is true both for real 
and for virtual
switches.

Your example will run if you define the VLAN 150 and you add the ports of the 
two qemu
machines to that vlan (tagged mode).

the commands are:

vlan/create 150
vlan/addport 150 1
vlan/addport 150 2

(if the qemu machines were connected to different ports, not 1 and 2, change 
the arguments
of vlan/addport commands).

renzo davoli

--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
___
vde-users mailing list
vde-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vde-users


[vde-users] SF.net SVN: vde:[481] branches/rd235/vde-2/src

2011-03-27 Thread rd235
Revision: 481
  http://vde.svn.sourceforge.net/vde/?rev=481&view=rev
Author:   rd235
Date: 2011-03-27 20:53:56 + (Sun, 27 Mar 2011)

Log Message:
---
step two point five: propagate modifications to kvde_switch, handle_input 
becomes handle_io

Modified Paths:
--
branches/rd235/vde-2/src/dpipe.c
branches/rd235/vde-2/src/kvde_switch/consmgmt.c
branches/rd235/vde-2/src/kvde_switch/datasock.c
branches/rd235/vde-2/src/kvde_switch/kvde_switch.c
branches/rd235/vde-2/src/vde_switch/consmgmt.c
branches/rd235/vde-2/src/vde_switch/datasock.c
branches/rd235/vde-2/src/vde_switch/switch.h
branches/rd235/vde-2/src/vde_switch/tuntap.c
branches/rd235/vde-2/src/vde_switch/vde_switch.c

Modified: branches/rd235/vde-2/src/dpipe.c
===
--- branches/rd235/vde-2/src/dpipe.c2011-03-27 09:07:52 UTC (rev 480)
+++ branches/rd235/vde-2/src/dpipe.c2011-03-27 20:53:56 UTC (rev 481)
@@ -114,7 +114,7 @@
close(p1[0]);
break;
default:
-   fprintf(stderr,"CHECA\n");
+   fprintf(stderr,"Error\n");
}
execvp(argv1[0],argv1);
} else {
@@ -136,7 +136,7 @@
close(p1[1]);
break;
default:
-   fprintf(stderr,"CHECA\n");
+   fprintf(stderr,"Error\n");
}
recmain(argc-split-1,argv2,newdirchar);
}
@@ -151,11 +151,72 @@
char **argv1,**argv2;
int p1[2],p2[2];
int dirchar=0;
+   int daemonize=0;
+   char *pidfile=NULL;
+   int pgrp;
+   int argflag;
+   int err=0;
 
progname=argv[0];
argv++;
argc--;
 
+   do {
+   argflag=0;
+   if (argv[0] && *argv[0] == '-') {
+   argflag++;
+   argv[0]++;
+   if (*argv[0] == '-') {
+   argv[0]++;
+   if (strcmp(argv[0],"daemon") == 0)
+   daemonize = 1;
+   else if (strcmp(argv[0],"pidfile") == 0) {
+   pidfile = argv[argflag];
+   argflag++;
+   } else {
+   fprintf(stderr,"unknown option 
--%s\n",argv[0]);
+   err++;
+   }
+   } else {
+   while (*argv[0] != 0) {
+   switch (*argv[0]) {
+   case 0: break;
+   case 'd': daemonize = 1; break;
+   case 'p': pidfile = 
argv[argflag];
+   
argflag++;
+   
break;
+   default: 
fprintf(stderr,"unknown option -%c\n",*argv[0]);
+   
 err++;
+   }
+   if (*argv[0] != 0) argv[0]++;
+   }
+   }
+   argv += argflag;
+   argc -= argflag;
+   }
+   } while (argflag);
+
+   if (err)
+   exit(1);
+
+   if (setpgrp() == 0)
+   pgrp = getpgrp();
+   else {
+   fprintf(stderr,"Err: cannot create pgrp\n");
+   exit(1);
+   }
+
+   if (daemonize != 0)
+   daemon(0,0);
+
+   if (pidfile != NULL) {
+   FILE *f=fopen(pidfile, "w");
+   if (f != NULL) {
+   fprintf(f,"-%d\n",pgrp);
+   fclose(f);
+   }
+   }
+
alternate_fd();
split=splitindex(argc,argv,&dirchar);
 

Modified: branches/rd235/vde-2/src/kvde_switch/consmgmt.c
===
--- branches/rd235/vde-2/src/kvde_switch/consmgmt.c 2011-03-27 09:07:52 UTC 
(rev 480)
+++ branches/rd235/vde-2/src/kvde_switch/consmgmt.c 2011-03-27 20:53:56 UTC 
(rev 481)
@@ -381,7 +381,7 @@
return;
}
 
-   add_fd(new,mgmt_data,-1);
+   add_fd(new,mgmt_data,NULL);
EVENTOUT(MGMTPORTNEW,new);
snprintf(buf,MAXCMD,head

[vde-users] SF.net SVN: vde:[482] branches/rd235/vde-2/src/dpipe.c

2011-03-27 Thread rd235
Revision: 482
  http://vde.svn.sourceforge.net/vde/?rev=482&view=rev
Author:   rd235
Date: 2011-03-27 21:04:28 + (Sun, 27 Mar 2011)

Log Message:
---
dpipe daemon and pid log

Modified Paths:
--
branches/rd235/vde-2/src/dpipe.c

Modified: branches/rd235/vde-2/src/dpipe.c
===
--- branches/rd235/vde-2/src/dpipe.c2011-03-27 20:53:56 UTC (rev 481)
+++ branches/rd235/vde-2/src/dpipe.c2011-03-27 21:04:28 UTC (rev 482)
@@ -199,15 +199,14 @@
if (err)
exit(1);
 
-   if (setpgrp() == 0)
-   pgrp = getpgrp();
-   else {
+   if (daemonize != 0)
+   daemon(0,0);
+   else if (setpgrp() != 0) {
fprintf(stderr,"Err: cannot create pgrp\n");
exit(1);
}
 
-   if (daemonize != 0)
-   daemon(0,0);
+   pgrp = getpgrp();
 
if (pidfile != NULL) {
FILE *f=fopen(pidfile, "w");


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
___
vde-users mailing list
vde-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vde-users


Re: [vde-users] qemu guess OS creating VLAN

2011-03-27 Thread Ming-Ching Tiew


--- On Sun, 3/27/11, Renzo Davoli  wrote:

> 
> Your example will run if you define the VLAN 150 and you
> add the ports of the two qemu
> machines to that vlan (tagged mode).
> 
> the commands are:
> 
> vlan/create 150
> vlan/addport 150 1
> vlan/addport 150 2
> 
> (if the qemu machines were connected to different ports,
> not 1 and 2, change the arguments
> of vlan/addport commands).
> 
>     renzo davoli
> 

OK thanks for the info. I did what you said but they are still not answering to 
the ping. This is the print of the switch info :-

vde[/tmp/myvde.mgmt1]: port/print

Port 0001 untagged_vlan= ACTIVE - Unnamed Allocatable
 Current User: NONE Access Control: (User: NONE - Group: NONE)
 IN:  pkts912  bytes38760
 OUT: pkts   1393  bytes61794
  -- endpoint ID 0007 module tuntap  : tap1
Port 0002 untagged_vlan= ACTIVE - Unnamed Allocatable
 Current User: root Access Control: (User: NONE - Group: NONE)
 IN:  pkts962  bytes43860
 OUT: pkts974  bytes41316
  -- endpoint ID 0008 module unix prog   : QEMU user=root PID=591  
SOCK=/tmp/vde.ctl1/.00591-0
Port 0003 untagged_vlan= ACTIVE - Unnamed Allocatable
 Current User: root Access Control: (User: NONE - Group: NONE)
 IN:  pkts503  bytes21294
 OUT: pkts   1356  bytes57120
  -- endpoint ID 0010 module unix prog   : QEMU user=root PID=598  
SOCK=/tmp/vde.ctl1/.00598-0
Success

And this is the VLAN info :-

vde[/tmp/myvde.mgmt1]: vlan/print

VLAN   
 -- Port 0001 tagged=0 active=1 status=Forwarding
 -- Port 0002 tagged=0 active=1 status=Forwarding
 -- Port 0003 tagged=0 active=1 status=Forwarding
VLAN 0150
 -- Port 0001 tagged=1 active=1 status=Forwarding
 -- Port 0002 tagged=1 active=1 status=Forwarding
 -- Port 0003 tagged=1 active=1 status=Forwarding
Success

I have added the same VLAN into the host, the guest OS1, the guest OS2 with IP 
address 192.168.200.1, 192.168.200.2 and 192.168.200.3 respectively but still 
cannot ping each other.




  

--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
___
vde-users mailing list
vde-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vde-users