Skip to contentSkip to conversation

problems with dual ethernet networking

Qemu-devel marco ghidinelli 3 participants 5 messages Nov 2, 2004 – Nov 3, 2004

lore
Share & tools
lore
#0 lore raw

i'm unable to get a running configuration with a dual ethernet card with qemu and vdeq.

i try with this commands:

vde_switch -daemon -sock /tmp/vde1.ctl
chmod 777 /tmp/vde1.ctl
vde_switch -daemon -sock /tmp/vde2.ctl
chmod 777 /tmp/vde2.ctl

vdeq qemu -sock /tmp/vde1.ctl,/tmp/vde2.ctl -nics 2 -hda vivian.img

and i got this message:

qemu: invalid fd for network interface 0

running:

vdeq echo -sock /tmp/vde1.ctl,/tmp/vde2.ctl -nics 2 -hda vivian.img

i got:

-tun-fd 3,5 -nics 2 -hda images/vivian.img

and looking in vl.c seems that qemu doesn't like very much the option -tun-fd 3,5

is this option implemented? where i am wrong?
let me know.

bye!

Signature · 3 lines
BOFH excuse #10:

hardware stress fractures
#1 lore raw
Quoted 20 lines · marco ghidinelli

i'm unable to get a running configuration with a dual ethernet card with qemu and vdeq.

i try with this commands:

vde_switch -daemon -sock /tmp/vde1.ctl
chmod 777 /tmp/vde1.ctl
vde_switch -daemon -sock /tmp/vde2.ctl
chmod 777 /tmp/vde2.ctl

vdeq qemu -sock /tmp/vde1.ctl,/tmp/vde2.ctl -nics 2 -hda vivian.img

and i got this message:

qemu: invalid fd for network interface 0

running:

vdeq echo -sock /tmp/vde1.ctl,/tmp/vde2.ctl -nics 2 -hda vivian.img

Quoted 8 lines

i got:

-tun-fd 3,5 -nics 2 -hda images/vivian.img

and looking in vl.c seems that qemu doesn't like very much the option -tun-fd 3,5

is this option implemented? where i am wrong?

No it is not implemented. vdeq is meant for only one sock at a time.

You may be able to get qemu to work by using -tun-fd 3 -tun-fd 5 tho (not sure), but vdeq won't support that unless you change it.

Quoted 15 lines

let me know.

bye!

Signature · 9 lines
BOFH excuse #10:

hardware stress fractures


_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
#2 lore raw
Quoted 2 lines
Quoted 1 line

vdeq qemu -sock /tmp/vde1.ctl,/tmp/vde2.ctl -nics 2 -hda vivian.img

No it is not implemented. vdeq is meant for only one sock at a time.

Actually, it was implemented in qemu and vdeq used the multiple -tun-fd option provided bu qemu.

Now I'll try to see what has happened inside the qemu code.

Stay tuned.
renzo

#3 lore raw
Quoted 3 lines · Renzo Davoli

Actually, it was implemented in qemu and vdeq used the multiple -tun-fd option provided bu qemu.

qemu has changed recently the option management, now it wants multiple -tun-fd options for several tun interfaces (previously it accepted several comma separated numbers).

I have just committed on cvs an updated version of vde that should be able to work with multiple interfaces.
the -nics option should not be needed.

Sourceforge sometimes is late in updating the public access cvs, thus I am sending here enclosed the patch for vdeq.c.

I have had no time to test it personally, please let me know if it works correctly.

BTW: if you are connecting also several qemu machines on the same vde network remember to change the MAC addresses!
The default configuration MAC is 52:54:00:12:34:56. (for eth0, 52:54:00:12:34:57 for eth1 etc.).
Several machines on the same network using the standard configuration end up having the same MAC: networking does not work. i.e. it is a net-does-not-work.

renzo

qemu/vdeq.c +8 -13
@@ -78,12 +78,10 @@
 
 unsigned char bufin[BUFSIZE];
 
-//struct pollfd pollv[]={{STDIN_FILENO,POLLIN|POLLHUP,0},{0,POLLIN|POLLHUP,0}};
 struct pollfd *pollv;
 
 char *filename;
 char *vdeqname;
-char *numfd;
 #define NUMW 10
 
 static int countnics(const char *s)
@@ -169,19 +167,12 @@
 	  perror("malloc nics");
 	  exit(1);
   }
-  if ((numfd= (char *) malloc(nb_nics * NUMW * sizeof (char)))<0) {
-	  perror("malloc numfd");
-	  exit(1);
-  }
 
   for (i=0; i<nb_nics; i++) {
-	char curfd[NUMW];
   	if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sp[i]) < 0){
 	  	perror("socketpair");
 	  	exit(1);
 	}
-	snprintf(curfd,NUMW,"%d%c",sp[i][0],(i<nb_nics-1)?',':0);
-	strcat(numfd,curfd);
   }
 
   if ((sockname= (char **) malloc(sizeof(char *) * nb_nics))<0) {
@@ -207,17 +198,21 @@
   printf("as %s\n",argsock);
 	    for (i=0; i<nb_nics; i++)
 		    printf("%d -> %s\n",i,sockname[i]); */
-  newargc=argc+3-args;
+  newargc=argc+1+(2*nb_nics)-args;
   if ((newargv=(char **) malloc ((newargc+1)* sizeof(char *))) <0) {
 	  perror("malloc");
 	  exit(1);
   }
 
   newargv[0]=filename;
-  newargv[1]="-tun-fd";
-  newargv[2]=numfd;
+  for (i=0; i<nb_nics; i++) {
+	char numfd[10];
+	sprintf(numfd,"%d",sp[i][0]);
+  	newargv[2*i+1]="-tun-fd";
+  	newargv[2*i+2]=strdup(numfd);
+  }
    
-  for (i=3;args<argc;i++,args++) newargv[i]=argv[args];
+  for (i=(2*nb_nics)+1;args<argc;i++,args++) newargv[i]=argv[args];
 
   newargv[i]=0;
 
#4 lore raw
Quoted 12 lines · Renzo Davoli
Quoted 3 lines · Renzo Davoli

Actually, it was implemented in qemu and vdeq used the multiple -tun-fd option provided bu qemu.

qemu has changed recently the option management, now it wants multiple -tun-fd options for several tun interfaces (previously it accepted several comma separated numbers).

I have just committed on cvs an updated version of vde that should be able to work with multiple interfaces.
the -nics option should not be needed.

Quoted 5 lines

Sourceforge sometimes is late in updating the public access cvs, thus I am sending here enclosed the patch for vdeq.c.

I have had no time to test it personally, please let me know if it works correctly.

it works perfectly.

great.

Quoted 4 lines

BTW: if you are connecting also several qemu machines on the same vde network remember to change the MAC addresses!
The default configuration MAC is 52:54:00:12:34:56. (for eth0, 52:54:00:12:34:57 for eth1 etc.).

yes, of course! :)

Quoted 1 line

renzo

thankyou very much! :)