pax_global_header00006660000000000000000000000064137452541350014523gustar00rootroot0000000000000052 comment=9c8de49e4f15c76dd4f06875bfac95875d97b660 vdeplug-slirp-0.1.0/000077500000000000000000000000001374525413500143165ustar00rootroot00000000000000vdeplug-slirp-0.1.0/CMakeLists.txt000066400000000000000000000023501374525413500170560ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.1) project("vdeplug_slirp" DESCRIPTION "libvdeplug plugin module for slirp" HOMEPAGE_URL "https://github.com/rd235/vdeplug_slirp" VERSION 0.1.0 LANGUAGES C) include(GNUInstallDirs) include(CheckIncludeFile) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2 -O2 -pedantic -Wall -Wextra") set(CMAKE_REQUIRED_QUIET TRUE) set(LIBS_REQUIRED vdeslirp vdeplug_mod) set(HEADERS_REQUIRED libvdeplug.h slirp/libvdeslirp.h) foreach(THISLIB IN LISTS LIBS_REQUIRED) find_library(LIB${THISLIB}_OK ${THISLIB}) if(NOT LIB${THISLIB}_OK) message(FATAL_ERROR "library lib${THISLIB} not found") endif() endforeach(THISLIB) foreach(HEADER IN LISTS HEADERS_REQUIRED) check_include_file(${HEADER} ${HEADER}_OK) if(NOT ${HEADER}_OK) message(FATAL_ERROR "header file ${HEADER} not found") endif() endforeach(HEADER) add_definitions(-D_GNU_SOURCE) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_library(vdeplug_slirp SHARED libvdeplug_slirp.c) target_link_libraries(vdeplug_slirp vdeslirp vdeplug_mod) install(TARGETS vdeplug_slirp DESTINATION ${CMAKE_INSTALL_LIBDIR}/vdeplug) add_subdirectory(man) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${PROJECT_SOURCE_DIR}/Uninstall.cmake") vdeplug-slirp-0.1.0/README.md000066400000000000000000000032331374525413500155760ustar00rootroot00000000000000# `vdeplug_slirp` This is the libvdeplug plugin module to join slirp networks. It is based on the [libvdeslirp](https://github.com/virtualsquare/libvdeslirp) library. This module of libvdeplug4 can be used in any program supporting VDE like `vde_plug, vdens, kvm, qemu, user-mode-linux` and `virtualbox`. ## install `vdeplug_slirp` Requirements: [vdeplug4](https://github.com/rd235/vdeplug4) and [libvdeslirp](https://github.com/virtualsquare/libvdeslirp). `vdeplug_slirp` uses cmake, so the standard procedure to build and install this vdeplug plugin module is the following: ```sh $ mkdir build $ cd build $ cmake .. $ make $ sudo make install ``` ## usage examples (tutorial) ### create a vde namespaces connected to the Internet by slirp ``` vdens -R 10.0.2.3 slirp:// ``` Inside the namespace the ip address can be defined by hand or using a dhcp client. e.g.: ``` /sbin/udhcpc -i vde0 ``` ### connect a vxvde network to the Internet using slirp ``` vde_plug vxvde:// slirp:// ``` ### connect a tap virtual interface to slirp with port forwarding TCP port 8080 is forwarded to port 80 of 10.0.2.15 ``` vde_plug tap://mytap slirp:///tcpfwd=8080:10.0.2.15:80" ``` ### connect a kvm machine to the Internet using slirp (both v4 and v6) ``` kvm .... -device e1000,netdev=vde0,mac=52:54:00:00:00:01 -netdev vde,id=vde0,sock="slirp:///addr=10.1.1.2" ``` ## Final Remarks This version obsoletes the [previous implementation](https://github.com/rd235/vdeplug_slirp) based on the deprecated old [libslirp](https://github.com/rd235/libslirp). The only feature still unimplemented in this new code is the redirection to a unix port. We are working to add this missing feature. vdeplug-slirp-0.1.0/Uninstall.cmake000066400000000000000000000010361374525413500172710ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.13) set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") if(NOT EXISTS ${MANIFEST}) message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'") endif() file(STRINGS ${MANIFEST} files) foreach(file ${files}) if(EXISTS ${file} OR IS_SYMLINK ${file}) message(STATUS "Removing: ${file}") execute_process( COMMAND rm -f ${file} RESULT_VARIABLE retcode ) if(NOT "${retcode}" STREQUAL "0") message(WARNING "Failed to remove: ${file}") endif() endif() endforeach(file) vdeplug-slirp-0.1.0/libvdeplug_slirp.c000066400000000000000000000267711374525413500200450ustar00rootroot00000000000000/* * VDE - libvdeplug_slirp module * Copyright (C) 2019 Renzo Davoli VirtualSquare * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation version 2.1 of the License, or (at * your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include #include #include #include #include #include #include #define NTOP_BUFSIZE 128 static VDECONN *vde_slirp_open(char *sockname, char *descr, int interface_version, struct vde_open_args *open_args); static ssize_t vde_slirp_recv(VDECONN *conn, void *buf, size_t len, int flags); static ssize_t vde_slirp_send(VDECONN *conn, const void *buf, size_t len, int flags); static int vde_slirp_datafd(VDECONN *conn); static int vde_slirp_ctlfd(VDECONN *conn); static int vde_slirp_close(VDECONN *conn); struct vdeplug_module vdeplug_ops={ .vde_open_real=vde_slirp_open, .vde_recv=vde_slirp_recv, .vde_send=vde_slirp_send, .vde_datafd=vde_slirp_datafd, .vde_ctlfd=vde_slirp_ctlfd, .vde_close=vde_slirp_close }; struct vde_slirp_conn { void *handle; struct vdeplug_module *module; struct vdeslirp *slirp; }; /* like strtok_r but this allows empty fields */ static char *strtok_rep_r (char *s, const char *delim, char **save_ptr) { char *end; if (s == NULL) s = *save_ptr; if (*s == '\0') return *save_ptr = s, NULL; end = s + strcspn (s, delim); if (*end == '\0') return *save_ptr = end, s; return *end = '\0', *save_ptr = end + 1, s; } static void vde_slirp_dofwd(struct vdeslirp *slirp, int is_udp, char *arg, int verbose) { char *toktmp; char *fwditem; while ((fwditem = strtok_r(arg, ",", &toktmp)) != NULL) { char *fldtmp; char *haddrstr, *hport, *gaddrstr, *gport; struct in_addr host_addr, guest_addr; arg = NULL; haddrstr = strtok_rep_r(fwditem, ":", &fldtmp); hport = strtok_rep_r(NULL, ":", &fldtmp); gaddrstr = strtok_rep_r(NULL, ":", &fldtmp); gport = strtok_rep_r(NULL, "", &fldtmp); if (gport == NULL) { gport = gaddrstr; gaddrstr = hport; hport = haddrstr; haddrstr = "0.0.0.0"; } if (*haddrstr == 0) haddrstr = "0.0.0.0"; if (inet_pton(AF_INET, haddrstr, &host_addr) == 1 && inet_pton(AF_INET, gaddrstr, &guest_addr) == 1) { int retvalue = vdeslirp_add_fwd(slirp, is_udp, host_addr, atoi(hport), guest_addr, atoi(gport)); if (verbose) { fprintf(stderr, "%sfwd host %s %d -> guest %s %d: %s\n", is_udp ? "udp" : "tcp", haddrstr, atoi(hport), gaddrstr, atoi(gport), strerror(retvalue == 0 ? 0 : errno)); } } } } static void vde_slirp_dounixfwd(struct vdeslirp *slirp, char *arg, int verbose) { char *toktmp; char *fwditem; while ((fwditem = strtok_r(arg, ",", &toktmp)) != NULL) { char *fldtmp; char *haddrstr, *hport, *path; struct in_addr host_addr; arg = NULL; haddrstr = strtok_rep_r(fwditem, ":", &fldtmp); hport = strtok_rep_r(NULL, ":", &fldtmp); path = strtok_rep_r(NULL, "", &fldtmp); if (path == NULL) { path = hport; hport = haddrstr; haddrstr = "0.0.0.0"; } if (*haddrstr == 0) haddrstr = "0.0.0.0"; if (inet_pton(AF_INET, haddrstr, &host_addr) == 1 && path != 0) { int retvalue = vdeslirp_add_unixfwd(slirp, path, &host_addr, atoi(hport)); if (verbose) { char buf[NTOP_BUFSIZE]; fprintf(stderr, "unixfwd gw %s %d -> host %s: %s\n", inet_ntop(AF_INET, &host_addr, buf, NTOP_BUFSIZE), atoi(hport), path, strerror(retvalue == 0 ? 0 : errno)); } } } } static void vde_slirp_docmdfwd(struct vdeslirp *slirp, char *arg, int verbose) { char *toktmp; char *fwditem; while ((fwditem = strtok_r(arg, ",", &toktmp)) != NULL) { char *fldtmp; char *haddrstr, *hport, *cmd; struct in_addr host_addr; arg = NULL; haddrstr = strtok_rep_r(fwditem, ":", &fldtmp); hport = strtok_rep_r(NULL, ":", &fldtmp); cmd = strtok_rep_r(NULL, "", &fldtmp); if (cmd == NULL) { cmd = hport; hport = haddrstr; haddrstr = "0.0.0.0"; } if (*haddrstr == 0) haddrstr = "0.0.0.0"; if (inet_pton(AF_INET, haddrstr, &host_addr) == 1 && cmd != 0) { int retvalue = vdeslirp_add_cmdexec(slirp, cmd, &host_addr, atoi(hport)); if (verbose) { char buf[NTOP_BUFSIZE]; fprintf(stderr, "cmdfwd gw %s %d -> '%s': %s\n", inet_ntop(AF_INET, &host_addr, buf, NTOP_BUFSIZE) , atoi(hport), cmd, strerror(retvalue == 0 ? 0 : errno)); } } } } static const char **vdnssearch_copy(char *list) { const char **retval = NULL; int i, count; if (list == NULL) return NULL; for (i = 0, count = 2; list[i] != 0; i++) count += (list[i] == ','); retval = malloc(count * sizeof(char *)); if (retval != NULL) { const char **scan = retval;; char *toktmp, *item; for (; (item = strtok_r(list, ",", &toktmp)) != NULL; list = NULL) *scan++ = strdup(item); *scan = NULL; } return retval; } static void vdnssearch_free(const char **argv) { const char **scan; for (scan = argv; *scan; scan++) free((void *) *scan); free(argv); } static void verbose_configuration(SlirpConfig *cfg) { char buf[NTOP_BUFSIZE]; fprintf(stderr, "SLIRP configuration\n"); fprintf(stderr, "version %d\n", cfg->version); fprintf(stderr, "ipv4-enable %d\n", cfg->in_enabled); fprintf(stderr, "ipv4-network %s\n", inet_ntop(AF_INET, &cfg->vnetwork, buf, NTOP_BUFSIZE)); fprintf(stderr, "ipv4-netmask %s\n", inet_ntop(AF_INET, &cfg->vnetmask, buf, NTOP_BUFSIZE)); fprintf(stderr, "ipv4-host %s\n", inet_ntop(AF_INET, &cfg->vhost, buf, NTOP_BUFSIZE)); fprintf(stderr, "ipv6-enabled %d\n", cfg->in6_enabled); fprintf(stderr, "ipv6-prefix %s\n", inet_ntop(AF_INET6, &cfg->vprefix_addr6, buf, NTOP_BUFSIZE)); fprintf(stderr, "ipv6-preflen %d\n", cfg->vprefix_len); fprintf(stderr, "ipv6-host %s\n", inet_ntop(AF_INET6, &cfg->vhost6, buf, NTOP_BUFSIZE)); fprintf(stderr, "hostname %s\n", cfg->vhostname); fprintf(stderr, "tftp-servname %s\n", cfg->tftp_server_name); fprintf(stderr, "tftp-path %s\n", cfg->tftp_path); fprintf(stderr, "bootfile %s\n", cfg->bootfile); fprintf(stderr, "dhcp-start %s\n", inet_ntop(AF_INET, &cfg->vdhcp_start, buf, NTOP_BUFSIZE)); fprintf(stderr, "ipv4-vDNS %s\n", inet_ntop(AF_INET, &cfg->vnameserver, buf, NTOP_BUFSIZE)); fprintf(stderr, "ipv6-vDNS %s\n", inet_ntop(AF_INET6, &cfg->vnameserver6, buf, NTOP_BUFSIZE)); fprintf(stderr, "vDNS-search "); if (cfg->vdnssearch) { const char **scan; for (scan = cfg->vdnssearch; *scan; scan++) fprintf(stderr, "%s ", *scan); } fprintf(stderr, "\n"); fprintf(stderr, "vdomainname %s\n", cfg->vdomainname); fprintf(stderr, "MTU(0=def) %zd\n", cfg->if_mtu); fprintf(stderr, "MRU(0=def) %zd\n", cfg->if_mru); fprintf(stderr, "disable-lback %d\n", cfg->disable_host_loopback); fprintf(stderr, "enable-emu %d\n", cfg->enable_emu); } static VDECONN *vde_slirp_open(char *sockname, char *descr, int interface_version, struct vde_open_args *open_args) { (void) descr; (void) interface_version; (void) open_args; SlirpConfig cfg; char *restricted = NULL; char *v4str = NULL; char *v6str = NULL; char *host4 = NULL; char *host6 = NULL; char *vhostname = NULL; char *tftp_server_name = NULL; char *tftp_path = NULL; char *bootfile = NULL; char *dhcp = NULL; char *vnameserver = NULL; char *vnameserver6 = NULL; char *vdnssearch = NULL; char *vdomainname = NULL; char *mtu = NULL; char *mru = NULL; char *disable_host_loopback = NULL; char *tcpfwd = NULL; char *udpfwd = NULL; char *unixfwd = NULL; char *cmdfwd = NULL; char *verbose = NULL; struct vdeparms parms[] = { {"restricted", &restricted}, {"v4", &v4str}, {"v6", &v6str}, {"host", &host4}, {"addr", &host4}, {"host6", &host6}, {"addr6", &host6}, {"hostname", &vhostname}, {"tftp_server_name", &tftp_server_name}, {"tftp_path", &tftp_path}, {"bootfile", &bootfile}, {"dhcp", &dhcp}, {"vnameserver", &vnameserver}, {"vnameserver6", &vnameserver6}, {"vdnssearch", &vdnssearch}, {"vdomainname", &vdomainname}, {"mtu", &mtu}, {"mru", &mru}, {"disable_host_loopback", &disable_host_loopback}, {"tcpfwd", &tcpfwd}, {"udpfwd", &udpfwd}, {"unixfwd", &unixfwd}, {"cmdfwd", &cmdfwd}, {"verbose", &verbose}, {NULL, NULL}}; if (vde_parseparms(sockname, parms) != 0) return NULL; vdeslirp_init(&cfg, VDE_INIT_DEFAULT); if (restricted) cfg.restricted = 1; if (v4str && !v6str) cfg.in6_enabled = 0; if (v6str && !v4str) cfg.in_enabled = 0; if (host4) { int prefix = 24; char *slash = strchr(host4, '/'); if (slash) { prefix = atoi(slash+1); *slash = 0; } inet_pton(AF_INET, host4, &(cfg.vhost)); vdeslirp_setvprefix(&cfg, prefix); } if (host6) { int prefix = 64; char *slash = strchr(host6, '/'); if (slash) { prefix = atoi(slash+1); *slash = 0; } inet_pton(AF_INET6, host6, &(cfg.vhost6)); vdeslirp_setvprefix6(&cfg, prefix); } if (vhostname) cfg.vhostname = vhostname; if (tftp_server_name) cfg.tftp_server_name = tftp_server_name; if (tftp_path) cfg.tftp_path = tftp_path; if (bootfile) cfg.bootfile = bootfile; if (dhcp) inet_pton(AF_INET, dhcp, &(cfg.vdhcp_start)); if (vnameserver) inet_pton(AF_INET, vnameserver, &(cfg.vnameserver)); if (vnameserver6) inet_pton(AF_INET6, vnameserver6, &(cfg.vnameserver6)); if (vdnssearch) cfg.vdnssearch = vdnssearch_copy(vdnssearch); if (vdomainname) cfg.vdomainname = vdomainname; if (mtu) cfg.if_mtu = atoi(mtu); if (mru) cfg.if_mru = atoi(mru); if (disable_host_loopback) cfg.disable_host_loopback = 1; if (verbose) verbose_configuration(&cfg); struct vdeslirp *slirp = vdeslirp_open(&cfg); if (slirp != NULL) { struct vde_slirp_conn *newconn = calloc(1, sizeof(*newconn)); if (newconn == NULL) { errno = ENOMEM; vdeslirp_close(slirp); } else { if (tcpfwd) vde_slirp_dofwd(slirp, 0, tcpfwd, !!verbose); if (udpfwd) vde_slirp_dofwd(slirp, 1, udpfwd, !!verbose); if (unixfwd) vde_slirp_dounixfwd(slirp, unixfwd, !!verbose); if (cmdfwd) vde_slirp_docmdfwd(slirp, cmdfwd, !!verbose); if (cfg.vdnssearch != NULL) vdnssearch_free(cfg.vdnssearch); newconn->slirp = slirp; return (VDECONN *) newconn; } } return NULL; } static ssize_t vde_slirp_recv(VDECONN *conn, void *buf, size_t len, int flags) { (void) flags; struct vde_slirp_conn *vde_conn = (struct vde_slirp_conn *)conn; return vdeslirp_recv(vde_conn->slirp, buf, len); } static ssize_t vde_slirp_send(VDECONN *conn, const void *buf, size_t len, int flags) { (void) flags; struct vde_slirp_conn *vde_conn = (struct vde_slirp_conn *)conn; return vdeslirp_send(vde_conn->slirp, buf, len); } static int vde_slirp_datafd(VDECONN *conn) { struct vde_slirp_conn *vde_conn = (struct vde_slirp_conn *)conn; return vdeslirp_fd(vde_conn->slirp); } static int vde_slirp_ctlfd(VDECONN *conn) { (void) conn; return -1; } static int vde_slirp_close(VDECONN *conn) { struct vde_slirp_conn *vde_conn = (struct vde_slirp_conn *)conn; int rval = vdeslirp_close(vde_conn->slirp); if (rval == 0) free(vde_conn); return 0; } vdeplug-slirp-0.1.0/man/000077500000000000000000000000001374525413500150715ustar00rootroot00000000000000vdeplug-slirp-0.1.0/man/CMakeLists.txt000066400000000000000000000020101374525413500176220ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.7) set(RONN_ORGANIZATION "VirtualSquare") set(RONN_ARGS --organization=${RONN_ORGANIZATION}) # ### ronn pages file(GLOB VU_RONN_PAGES ${CMAKE_CURRENT_SOURCE_DIR}/*.[1-8].ronn) set(VU_MAN_FILES) foreach(VU_RONN_PATH IN LISTS VU_RONN_PAGES) # VU_RONNPAGE: basename of VU_RONN_PATH get_filename_component(VU_RONNPAGE ${VU_RONN_PATH} NAME) # VU_MANPAGE: VU_RONNPAGE without the suffix string(REGEX REPLACE "\.ronn$" "" VU_MANPAGE ${VU_RONNPAGE}) list(APPEND VU_MAN_FILES ${VU_MANPAGE}) endforeach(VU_RONN_PATH) add_custom_target(${PROJECT_NAME}_manpages ALL make RONN_ARGS="${RONN_ARGS}" ${VU_MAN_FILES} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) ### man pages file(GLOB VU_MAN_PAGES ${CMAKE_CURRENT_SOURCE_DIR}/*.[1-8]) foreach(VU_MAN_PATH IN LISTS VU_MAN_PAGES) get_filename_component(VU_MANPAGE ${VU_MAN_PATH} NAME) string(REGEX REPLACE ".*\\." "" MAN_CHAPTER ${VU_MANPAGE}) install(FILES ${VU_MAN_PATH} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_CHAPTER}) endforeach(VU_MAN_PATH) vdeplug-slirp-0.1.0/man/Makefile000066400000000000000000000005551374525413500165360ustar00rootroot00000000000000RONN=ronn RONNOK := $(shell command -v ${RONN} 2> /dev/null) none: % : %.ronn ifdef RONNOK # copy copyright notice grep "^\.\\\\\"" $< > $@ || true # run ronn $(RONN) -r ${RONN_ARGS} --pipe $< >> $@ # delete useless trailing "" in .TH sed -i '/^\.TH /s/ ""$$//' $@ else echo "${RONN} is not available. Manpage $@ cannot be updated" >/dev/stderr >&2 endif vdeplug-slirp-0.1.0/man/libvdeplug_slirp.1000066400000000000000000000117221374525413500205240ustar00rootroot00000000000000.\" Copyright (C) 2019 VirtualSquare. Project Leader: Renzo Davoli .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License, .\" as published by the Free Software Foundation, either version 2 .\" of the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, .\" MA 02110-1301 USA. .\" .\" generated with Ronn-NG/v0.10.0 .\" http://github.com/apjanke/ronn-ng/tree/0.10.0-SNAPSHOT .TH "LIBVDEPLUG_SLIRP" "1" "October 2020" "VirtualSquare" .SH "NAME" \fBlibvdeplug_slirp\fR \- slirp vdeplug module .SH "SYNOPSIS" libvdeplug_slirp\.so .SH "DESCRIPTION" This is the libvdeplug module to join TCP\-IP networks using the slirp emulator\. .P This module of libvdeplug4 can be used in any program supporting vde like \fBvde_plug\fR, \fBvdens\fR, \fBkvm\fR, \fBqemu\fR, \fBuser\-mode\-linux\fR and \fBvirtualbox\fR\. .P The vde_plug_url syntax of this module is the following: ``` slirp://[/OPTION][/OPTION] .SH "OPTIONS" .TP \fBv4\fR \fBv6\fR provide IPv4 or IPv6 service \fIonly\fR\. Both family of protocols are enabled if both \fBv4\fR and \fBv6\fR options are present of if neither of them have been specified\. .TP \fBaddr\fR=\fIIPv4Addr\fR/\fIprefix\fR or \fBhost\fR=\fIIPv4addr\fR/\fIprefix\fR Set the IPv4 address of slirp (default value 10\.0\.2\.2/24)\. .TP \fBaddr6\fR=\fIIPv6Addr\fR/\fIprefix\fR or \fBhost6\fR=\fIIPv6addr\fR/\fIprefix\fR Set the IPv6 address of slirp (default value fd00::2/64)\. .TP \fBhostname\fR=\fIname\fR define the hostname (default value: slirp) .TP \fBtftp_server_name\fR=\fIname\fR define the hostname of the dhcp server .TP \fBtftp_path\fR=\fIpath\fR define the path of the directory whose contents are available by the tftp service .TP \fBbootfile\fR=\fIpath\fR define the path of the bootfile (for bootp) .TP \fBdhcp\fR=\fIdhcpIPv4addr\fR set the lowest IP address assigned by dhcp .TP \fBvnameserver\fR=\fIIPv4Addr\fR set the address of the IPv4 DNS proxy .TP \fBvnameserver6\fR=\fIIPv6Addr\fR set the address of the IPv6 DNS proxy .TP \fBvdnssearch\fR=\fIlist of domains\fR set the default domains for the neame resolution e\.g\. \fBvdnssearch=foo\.com,bar\.org\fR .TP \fBvdomainname\fR=\fIname\fR set the domain name .TP \fBmtu\fR=\fIint_value\fR define the MTU .TP \fBmru\fR==\fIint_value\fR define the MRU .TP \fBdisable_host_loopback\fR disable loopback .TP \fBtcpfwd\fR=[\fIhostIP\fR\fB:\fR]\fIhostport\fR\fB:\fR\fIguestIP\fR\fB:\fR\fIguestport\fR\fB[,\fR[\fIhostIP\fR\fB:\fR]\fIhostport\fR\fB:\fR\fIguestIP\fR\fB:\fR\fIguestport\fR]\|\.\|\.\|\.] forward TCP port(s)\. .TP \fBudpfwd\fR=[\fIhostIP\fR\fB:\fR]\fIhostport\fR\fB:\fR\fIguestIP\fR\fB:\fR\fIguestport\fR\fB[,\fR[\fIhostIP\fR\fB:\fR]\fIhostport\fR\fB:\fR\fIguestIP\fR\fB:\fR\fIguestport\fR]\|\.\|\.\|\.] forward UDP port(s)\. .TP \fBunixfwd\fR=[\fIslirpIP\fR\fB:\fR]\fIslirpport\fR\fB:\fR\fIpath\fR\fB[,\fR[\fIslirpIP\fR\fB:\fR]\fIslirpport\fR\fB:\fR\fIpath\fR\|\.\|\.\|\.] forward TCP port(s) (from the virtual network) to PF_UNIX socket(s) (commonly used to forward ports to a X server) \fIstill unsupported by libslirp\fR\. .TP \fBcmdfwd\fR=[\fIslirpIP\fR\fB:\fR]\fIslirpport\fR\fB:\fR\fIcmd\fR\fB[,\fR[\fIslirpIP\fR\fB:\fR]\fIslirpport\fR\fB:\fR\fIpath\fR\|\.\|\.\|\.] forward TCP port(s) (from the virtual network) to external command(s)\. .TP \fBverbose\fR print a table of slirp service configuration\. .SH "EXAMPLES" This vde_plug_url enables both IPv4 and IPv6 (using the default configuration) .P \fBslirp://\fR .P Like the previous example but it prints the table of the configuration options .P \fBslirp:///verbose\fR .P When a program uses the following vde_plug_url: .P \fBslirp:///tcpfwd=8080:10\.0\.2\.15:80\fR .P tcp connections to the host computer port 8080 (any interface) are forwarded to 10\.0\.2\.15 port 80 .P \fBslirp:///tcpfwd=8080:10\.0\.2\.15:80/cmdfwd=10\.0\.2\.5:6000:'socat STDIO UNIX:"/tmp/\.X11\-unix/X0"'\fR .P like the previous one plus this uses socat to forward all X\-windows requests to 10\.0\.2\.5:0 (port 6000) to the local server of the display \fB:0\fR\. .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_plug\fR(1) .SH "AUTHOR" VirtualSquare\. Project leader: Renzo Davoli vdeplug-slirp-0.1.0/man/libvdeplug_slirp.1.ronn000066400000000000000000000106331374525413500214770ustar00rootroot00000000000000libvdeplug_slirp(1) -- slirp vdeplug module ==== ## SYNOPSIS libvdeplug_slirp.so ## DESCRIPTION This is the libvdeplug module to join TCP-IP networks using the slirp emulator. This module of libvdeplug4 can be used in any program supporting vde like `vde_plug`, `vdens`, `kvm`, `qemu`, `user-mode-linux` and `virtualbox`. The vde_plug_url syntax of this module is the following: ``` slirp://[/OPTION][/OPTION] ## OPTIONS * `v4` `v6`: provide IPv4 or IPv6 service *only*. Both family of protocols are enabled if both `v4` and `v6` options are present of if neither of them have been specified. * `addr`=_IPv4Addr_/_prefix_ or `host`=_IPv4addr_/_prefix_ : Set the IPv4 address of slirp (default value 10.0.2.2/24). * `addr6`=_IPv6Addr_/_prefix_ or `host6`=_IPv6addr_/_prefix_ : Set the IPv6 address of slirp (default value fd00::2/64). * `hostname`=_name_: define the hostname (default value: slirp) * `tftp_server_name`=_name_: define the hostname of the dhcp server * `tftp_path`=_path_: define the path of the directory whose contents are available by the tftp service * `bootfile`=_path_: define the path of the bootfile (for bootp) * `dhcp`=_dhcpIPv4addr_: set the lowest IP address assigned by dhcp * `vnameserver`=_IPv4Addr_: set the address of the IPv4 DNS proxy * `vnameserver6`=_IPv6Addr_: set the address of the IPv6 DNS proxy * `vdnssearch`=_list of domains_: set the default domains for the neame resolution e.g. `vdnssearch=foo.com,bar.org` * `vdomainname`=_name_: set the domain name * `mtu`=_int\_value_: define the MTU * `mru`==_int\_value_: define the MRU * `disable_host_loopback`: disable loopback * `tcpfwd`=[_hostIP_`:`]_hostport_`:`_guestIP_`:`_guestport_`[,`[_hostIP_`:`]_hostport_`:`_guestIP_`:`_guestport_]...]: forward TCP port(s). * `udpfwd`=[_hostIP_`:`]_hostport_`:`_guestIP_`:`_guestport_`[,`[_hostIP_`:`]_hostport_`:`_guestIP_`:`_guestport_]...]: forward UDP port(s). * `unixfwd`=[_slirpIP_`:`]_slirpport_`:`_path_`[,`[_slirpIP_`:`]_slirpport_`:`_path_...]: forward TCP port(s) (from the virtual network) to PF_UNIX socket(s) (commonly used to forward ports to a X server) *still unsupported by libslirp*. * `cmdfwd`=[_slirpIP_`:`]_slirpport_`:`_cmd_`[,`[_slirpIP_`:`]_slirpport_`:`_path_...]: forward TCP port(s) (from the virtual network) to external command(s). * `verbose`: print a table of slirp service configuration. ## EXAMPLES This vde_plug_url enables both IPv4 and IPv6 (using the default configuration) `slirp://` Like the previous example but it prints the table of the configuration options `slirp:///verbose` When a program uses the following vde_plug_url: `slirp:///tcpfwd=8080:10.0.2.15:80` tcp connections to the host computer port 8080 (any interface) are forwarded to 10.0.2.15 port 80 `slirp:///tcpfwd=8080:10.0.2.15:80/cmdfwd=10.0.2.5:6000:'socat STDIO UNIX:"/tmp/.X11-unix/X0"'` like the previous one plus this uses socat to forward all X-windows requests to 10.0.2.5:0 (port 6000) to the local server of the display `:0`. ## 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"). ## SEE ALSO `vde_plug`(1) ## AUTHOR VirtualSquare. Project leader: Renzo Davoli