server configuration: make network redirection support optional

By default it is disabled. To enable: configure --enable-tunnel.
When active, requires libslirp.
This commit is contained in:
Yonit Halperin 2010-04-06 18:07:49 +03:00 committed by Alexander Larsson
parent 88aa56045a
commit 4acf155fb2
3 changed files with 33 additions and 7 deletions

View File

@ -87,6 +87,13 @@ AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
dnl =========================================================================
dnl Chek optional features
have_tunnel=no
AC_ARG_ENABLE(tunnel,
[ --enable-tunnel Enable network redirection],
[ have_tunnel=yes])
AM_CONDITIONAL(SUPPORT_TUNNEL, test "x$have_tunnel" = "xyes")
dnl =========================================================================
dnl Check deps
@ -118,10 +125,13 @@ AC_SUBST(CEGUI_CFLAGS)
AC_SUBST(CEGUI_LIBS)
SPICE_REQUIRES+=" CEGUI"
PKG_CHECK_MODULES(SLIRP, slirp)
AC_SUBST(SLIRP_CFLAGS)
AC_SUBST(SLIRP_LIBS)
SPICE_REQUIRES+=" slirp"
if test "x$have_tunnel" = "xyes"; then
PKG_CHECK_MODULES(SLIRP, slirp)
AC_SUBST(SLIRP_CFLAGS)
AC_SUBST(SLIRP_LIBS)
SPICE_REQUIRES+=" slirp"
AC_DEFINE([HAVE_SLIRP], [], [Define if we have slirp])
fi
PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7)
AC_SUBST(PIXMAN_CFLAGS)
@ -345,6 +355,8 @@ echo "
Have XRANDR 1.2: ${have_xrandr12}
Support tunneling: ${have_tunnel}
Red target: ${red_target}
Now type 'make' to build $PACKAGE

View File

@ -50,6 +50,15 @@ libspice_server_la_LIBADD = \
$(LIBRT) \
$(NULL)
if SUPPORT_TUNNEL
TUNNEL_SRCS = \
red_tunnel_worker.c \
red_tunnel_worker.h \
$(NULL)
else
TUNNEL_SRCS =
endif
libspice_server_la_SOURCES = \
glz_encoder.c \
glz_encoder_config.h \
@ -73,10 +82,9 @@ libspice_server_la_SOURCES = \
snd_worker.h \
red_channel.h \
red_channel.c \
red_tunnel_worker.c \
red_tunnel_worker.h \
spice.h \
vd_interface.h \
$(TUNNEL_SRCS) \
$(COMMON_SRCS) \
$(NULL)

View File

@ -46,11 +46,13 @@
#include "red_common.h"
#include "red_dispatcher.h"
#include "snd_worker.h"
#include "red_tunnel_worker.h"
#include <spice/stats.h>
#include "stat.h"
#include "ring.h"
#include "config.h"
#ifdef HAVE_SLIRP
#include "red_tunnel_worker.h"
#endif
CoreInterface *core = NULL;
static MigrationInterface *mig = NULL;
@ -5162,6 +5164,7 @@ static void interface_change_notifier(void *opaque, VDInterface *interface,
}
attach_to_red_agent((VDIPortInterface *)interface);
} else if (strcmp(interface->type, VD_INTERFACE_NET_WIRE) == 0) {
#ifdef HAVE_SLIRP
NetWireInterface * net_wire = (NetWireInterface *)interface;
red_printf("VD_INTERFACE_NET_WIRE");
if (red_tunnel) {
@ -5174,6 +5177,9 @@ static void interface_change_notifier(void *opaque, VDInterface *interface,
return;
}
red_tunnel = red_tunnel_attach(core, net_wire);
#else
red_printf("unsupported net wire interface");
#endif
}
break;
case VD_INTERFACE_REMOVING: