From 3571e8d7ad1443b2b8f9ea3f50c73a260c751509 Mon Sep 17 00:00:00 2001 From: garden Date: Sun, 15 Jun 2008 10:33:11 +0000 Subject: [PATCH] * [slirpvde] added some checks for successful connection to the VDE switch. * integrations and corrections to some manual pages git-svn-id: https://vde.svn.sourceforge.net/svnroot/vde/trunk@273 d37a7db1-d92d-0410-89df-f68f52f87b57 --- vde-2/man/slirpvde.1 | 118 ++++++++++++------------------------------ vde-2/man/vde_autolink.1 | 26 +++++----- vde-2/man/vde_plug.1 | 11 ++-- vde-2/man/vde_switch.1 | 2 +- vde-2/src/slirpvde/slirpvde.c | 22 ++++++-- 5 files changed, 74 insertions(+), 105 deletions(-) diff --git a/vde-2/man/slirpvde.1 b/vde-2/man/slirpvde.1 index 0436452..d9cd47c 100644 --- a/vde-2/man/slirpvde.1 +++ b/vde-2/man/slirpvde.1 @@ -1,79 +1,9 @@ -.TH SLIRPVDE 1 "December 6, 2006" "Virtual Distributed Ethernet" +.TH SLIRPVDE 1 "June 15, 2008" "Virtual Distributed Ethernet" .SH NAME slirpvde \- Virtual Distributed Ethernet-Slirp interface .SH SYNOPSIS .B slirpvde -[ -.B \-sock -.I socketpath -] -[ -.B \-network -.I netaddr -] -[ -.B \-dhcp -] -[ -.B \-L -.I port -.B : -.I vde_host -.B : -.I vde_hostport -] -[ -.B \-X -.I vde_host -[ -.B : -.I display -[ -.B . -.I screen -] -] -] -.br -.B slirpvde -[ -.B \-s -.I socketpath -] -[ -.B \-n -.I netaddr -] -[ -.B \-D -] -[ -.B \-L -.I port -.B : -.I vde_host -.B : -.I vde_hostport -] -[ -.B \-X -.I vde_host -[ -.B : -.I display -[ -.B . -.I screen -] -] -] -[ -.B \-x -.I port -.B : -.I unix_socket_path -] -.br +.I OPTIONS .SH DESCRIPTION \fBslirpvde\fP is a slirp interface for a VDE network. @@ -86,27 +16,47 @@ configuration) and DNS is re-mapped in node 3 (10.0.2.3). Slirpvde runs using standard user privileges (no need for root access): all the connections are re-generated by slirpvde itself. -IPv4 only. IPv6 is still unsupported. +IPv4 only. IPv6 is still unsupported (will be supported when slirpvde will be +rewritten using the LWIPv6 network stack). -\fB-sock\fP is used to specify the VDE switch (default /tmp/vde.ctl) - -\fB-dhcp\fP turns on the dhcp server for the network autoconfiguration of +.SH OPTIONS +.TP +\fB-s, --sock, --socket, --vdesock, --unix\fP \fIdirectory\fP +specify the VDE switch directory (default /var/run/vde.ctl). +.TP +\fB-p, --pidfile\fP \fIfilename\fP +specify the name of the file which contains the PID of slirpvde. +.TP +\fB-g, --group\fP \fIgroup\fP +specify the UNIX group for the VDE communication socket. +.TP +\fB-m, --mod\fP \fImode\fP +specify the octal UNIX permissions for the VDE communication socket. +.TP +\fB-d, --daemon\fP +detach from terminal and run \fBslirpvde\fP in background. +.TP +\fB-D, --dhcp\fP +turn on the DHCP server for the network autoconfiguration of all the units connected to the VDE. - -\fB-network\fP is used to specify the network address (default 10.0.2.0). - -\fB-L \fIport\fR:\fIvde_host\fR:\fIvde_hostport\fR specifies a port redirection. +.TP +\fB-n, --network\fP \fIaddress\fP +specify the network address (default 10.0.2.0). +.TP +\fB-L \fIport\fR:\fIvde_host\fR:\fIvde_hostport\fR +specifyes a port redirection. All the packet received by the host running slirpvde at port \fIport\fR will be forwarded to \fIvde_host\fR at port \fIvde_hostport\fR. - -\fB-X \fIvde_host\fR[:\fIdisplay\fR.[\fIscreen\fR]] is the option to +.TP +\fB-X \fIvde_host\fR[:\fIdisplay\fR.[\fIscreen\fR]]i redirect a X window screen of a virtual machine. Slirpvde gets the first unused X display on the host running slirpvde and redirects all the requests to \fIvde_host\fR. \fIdisplay\fR and \fIscreen\fR] must be specified when different from :0.0. - -\fB-x \fIport\fR:\fIunix_socket_path\fR] is the option to +.TP +\fB-x \fIport\fR:\fIunix_socket_path\fR] redirect a port of the virtual router (usually 10.0.2.2) to a unix stream socket. It is used for example to redirect a X display of the hosting computer on the virtual network. e.g. -x6000:/tmp/.X11-unix/X0. (A suitable xhost configuration is needed (e.g. 'xhost local:'). + .SH NOTICE Virtual Distributed Ethernet is not related in any way with www.vde.com ("Verband der Elektrotechnik, Elektronik und Informationstechnik" diff --git a/vde-2/man/vde_autolink.1 b/vde-2/man/vde_autolink.1 index 330d6ee..93ed679 100644 --- a/vde-2/man/vde_autolink.1 +++ b/vde-2/man/vde_autolink.1 @@ -45,15 +45,17 @@ Management UNIX socket access mode (octal) [*] Attach to this vde_switch management socket .IP [*] == Required option! -.SH "SEE ALSO" -The full documentation for -.B vde_autolink -is maintained as a Texinfo manual. If the -.B info -and -.B vde_autolink -programs are properly installed at your site, the command -.IP -.B info vde_autolink -.PP -should give you access to the complete manual. +.SH NOTICE +Virtual Distributed Ethernet is not related in any way with +www.vde.com ("Verband der Elektrotechnik, Elektronik und Informationstechnik" +i.e. the German "Association for Electrical, Electronic & Information +Technologies"). + +.SH SEE ALSO +\fBvde_switch\fP(1), +\fBvde_plug\fP(1), +.br +.SH AUTHORS +VDE is a project by Renzo Davoli . + +vde_autolink is a VDE component by Luca Bigliardi diff --git a/vde-2/man/vde_plug.1 b/vde-2/man/vde_plug.1 index 2ffab5b..89124c4 100644 --- a/vde-2/man/vde_plug.1 +++ b/vde-2/man/vde_plug.1 @@ -16,7 +16,7 @@ vde_plug \- Virtual Distributed Ethernet plug (two plugs creates a vde cable) .I octal-mode ] [ -.I socketpath +.I socketdir ] .br .SH DESCRIPTION @@ -82,11 +82,12 @@ so that the network traffic cannot be sniffed. .B \-m "\fIoctal-mode\fP" octal chmod like permissions for the comm sockets .TP -.B "\fIsocketpath\fP" +.B "\fIsocketdir\fP" (This option can be also set as: -.B -sock "\fIsocketpath\fP" -) specify the UNIX socket to be used by local programs for joining the VDE. -The default value is "/tmp/vde.ctl". +.B -sock "\fIsocketdir\fP" +) specify the directory which contains the UNIX socket to be used by local programs for joining the VDE. +The default value is "/tmp/vde.ctl", which corresponds to the socket +"/tmp/vde.ctl/ctl". .SH NOTICE Virtual Distributed Ethernet is not related in any way with www.vde.com ("Verband der Elektrotechnik, Elektronik und Informationstechnik" diff --git a/vde-2/man/vde_switch.1 b/vde-2/man/vde_switch.1 index 51fb267..604fa06 100644 --- a/vde-2/man/vde_switch.1 +++ b/vde-2/man/vde_switch.1 @@ -59,7 +59,7 @@ Type "help" at the prompt for a list of possible options. .SH OPTIONS .TP -.B \-hub, +.B \-hub turn off the switch engine. It operates as a hub. .TP .B \-sock "\fIcommdirpath\fP" diff --git a/vde-2/src/slirpvde/slirpvde.c b/vde-2/src/slirpvde/slirpvde.c index 21e63b9..47512ca 100644 --- a/vde-2/src/slirpvde/slirpvde.c +++ b/vde-2/src/slirpvde/slirpvde.c @@ -424,6 +424,15 @@ int main(int argc, char **argv) printlog(LOG_ERR, "getcwd: %s", strerror(errno)); exit(1); } + + conn=vde_open(sockname,"slirpvde:",&open_args); + if (!conn) + { + printlog(LOG_ERR, "Could not connect to the VDE switch at '%s': %s", + sockname, strerror(errno)); + exit(1); + } + strcat(pidfile_path, "/"); if (daemonize && daemon(0, 0)) { printlog(LOG_ERR,"daemon: %s",strerror(errno)); @@ -432,7 +441,6 @@ int main(int argc, char **argv) if(pidfile) save_pidfile(); - conn=vde_open(sockname,"slirpvde:",&open_args); lfd=stderr; slirp_init(netw); @@ -446,8 +454,16 @@ int main(int argc, char **argv) FD_ZERO(&xs); nfds= -1; slirp_select_fill(&nfds,&rs,&ws,&xs); - datafd=vde_datafd(conn); - ctlfd=vde_ctlfd(conn); + datafd = vde_datafd(conn); + ctlfd = vde_ctlfd(conn); + + if (datafd < 0 || ctlfd < 0) + { + printlog(LOG_ERR, "Wrong file descriptor(s) for the VDE plug: (%d, %d)", + datafd, ctlfd); + exit(1); + } + FD_SET(datafd,&rs); FD_SET(ctlfd,&rs); if (datafd>nfds) nfds=datafd; -- 2.11.4.GIT