mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
Slirp updates Greg Kurz (1): slirp: Fix build with gcc 9 Marc-André Lureau (7): slirp: adapt a subset of QEMU vmstate code slirp: use libslirp migration code slirp: use "slirp_" prefix for inet_aton() win32 implementation slirp: move sources to src/ subdirectory slirp: add a standalone Makefile build-sys: link with slirp as an external project slirp: remove QEMU Makefile.objs Samuel Thibault (2): slirp: fix big/little endian conversion in ident protocol slirp: Mark pieces missing IPv6 support Vic Lee (1): slirp: check for ioctlsocket error and 0-length udp payload. William Bowling (1): slirp: check sscanf result when emulating ident # gpg: Signature made Thu 07 Mar 2019 11:51:20 GMT # gpg: using RSA key E61DBB15D4172BDEC97E92D9DB550E89F0FA54F3 # gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>" [unknown] # gpg: aka "Samuel Thibault <sthibault@debian.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@gnu.org>" [unknown] # gpg: aka "Samuel Thibault <samuel.thibault@inria.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@labri.fr>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@ens-lyon.org>" [marginal] # gpg: aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>" [unknown] # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 900C B024 B679 31D4 0F82 304B D017 8C76 7D06 9EE6 # Subkey fingerprint: E61D BB15 D417 2BDE C97E 92D9 DB55 0E89 F0FA 54F3 * remotes/thibault/tags/samuel-thibault: slirp: remove QEMU Makefile.objs build-sys: link with slirp as an external project slirp: add a standalone Makefile slirp: move sources to src/ subdirectory slirp: use "slirp_" prefix for inet_aton() win32 implementation slirp: use libslirp migration code slirp: adapt a subset of QEMU vmstate code slirp: Mark pieces missing IPv6 support slirp: fix big/little endian conversion in ident protocol slirp: check sscanf result when emulating ident slirp: check for ioctlsocket error and 0-length udp payload. slirp: Fix build with gcc 9 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -414,8 +414,7 @@ dummy := $(call unnest-vars,, \
|
||||
ui-obj-m \
|
||||
audio-obj-y \
|
||||
audio-obj-m \
|
||||
trace-obj-y \
|
||||
slirp-obj-y)
|
||||
trace-obj-y)
|
||||
|
||||
include $(SRC_PATH)/tests/Makefile.include
|
||||
|
||||
@@ -474,7 +473,10 @@ CAP_CFLAGS += -DCAPSTONE_HAS_X86
|
||||
subdir-capstone: .git-submodule-status
|
||||
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
|
||||
|
||||
$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) $(slirp-obj-y) \
|
||||
subdir-slirp: .git-submodule-status
|
||||
$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp BUILD_DIR="$(BUILD_DIR)/slirp" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(QEMU_CFLAGS)")
|
||||
|
||||
$(SUBDIR_RULES): libqemuutil.a $(common-obj-y) $(chardev-obj-y) \
|
||||
$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
|
||||
|
||||
ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
|
||||
|
||||
@@ -4,7 +4,6 @@ stub-obj-y = stubs/ util/ crypto/
|
||||
util-obj-y = util/ qobject/ qapi/
|
||||
|
||||
chardev-obj-y = chardev/
|
||||
slirp-obj-$(CONFIG_SLIRP) = slirp/
|
||||
|
||||
#######################################################################
|
||||
# authz-obj-y is code used by both qemu system emulation and qemu-img
|
||||
|
||||
+1
-4
@@ -177,7 +177,6 @@ target-obj-y :=
|
||||
block-obj-y :=
|
||||
common-obj-y :=
|
||||
chardev-obj-y :=
|
||||
slirp-obj-y :=
|
||||
include $(SRC_PATH)/Makefile.objs
|
||||
dummy := $(call unnest-vars,,target-obj-y)
|
||||
target-obj-y-save := $(target-obj-y)
|
||||
@@ -191,8 +190,7 @@ dummy := $(call unnest-vars,.., \
|
||||
qom-obj-y \
|
||||
io-obj-y \
|
||||
common-obj-y \
|
||||
common-obj-m \
|
||||
slirp-obj-y)
|
||||
common-obj-m)
|
||||
target-obj-y := $(target-obj-y-save)
|
||||
all-obj-y += $(common-obj-y)
|
||||
all-obj-y += $(target-obj-y)
|
||||
@@ -202,7 +200,6 @@ all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y) $(chardev-obj-y)
|
||||
all-obj-$(CONFIG_USER_ONLY) += $(crypto-aes-obj-y)
|
||||
all-obj-$(CONFIG_SOFTMMU) += $(crypto-obj-y)
|
||||
all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
|
||||
all-obj-$(CONFIG_SOFTMMU) += $(slirp-obj-y)
|
||||
|
||||
ifdef CONFIG_SOFTMMU
|
||||
$(QEMU_PROG_BUILD): config-devices.mak
|
||||
|
||||
@@ -406,7 +406,7 @@ includedir="\${prefix}/include"
|
||||
sysconfdir="\${prefix}/etc"
|
||||
local_statedir="\${prefix}/var"
|
||||
confsuffix="/qemu"
|
||||
slirp="yes"
|
||||
slirp=""
|
||||
oss_lib=""
|
||||
bsd="no"
|
||||
linux="no"
|
||||
@@ -1109,6 +1109,10 @@ for opt do
|
||||
;;
|
||||
--disable-slirp) slirp="no"
|
||||
;;
|
||||
--enable-slirp=git) slirp="git"
|
||||
;;
|
||||
--enable-slirp=system) slirp="system"
|
||||
;;
|
||||
--disable-vde) vde="no"
|
||||
;;
|
||||
--enable-vde) vde="yes"
|
||||
@@ -5769,6 +5773,55 @@ if test "$libpmem" != "no"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
# check for slirp
|
||||
|
||||
case "$slirp" in
|
||||
"" | yes)
|
||||
if $pkg_config slirp; then
|
||||
slirp=system
|
||||
elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
|
||||
slirp=git
|
||||
elif test -e "${source_path}/slirp/Makefile" ; then
|
||||
slirp=internal
|
||||
elif test -z "$slirp" ; then
|
||||
slirp=no
|
||||
else
|
||||
feature_not_found "slirp" "Install slirp devel or git submodule"
|
||||
fi
|
||||
;;
|
||||
|
||||
system)
|
||||
if ! $pkg_config slirp; then
|
||||
feature_not_found "slirp" "Install slirp devel"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$slirp" in
|
||||
git | internal)
|
||||
if test "$slirp" = git; then
|
||||
git_submodules="${git_submodules} slirp"
|
||||
fi
|
||||
mkdir -p slirp
|
||||
slirp_cflags="-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src"
|
||||
slirp_libs="-L\$(BUILD_DIR)/slirp -lslirp"
|
||||
;;
|
||||
|
||||
system)
|
||||
slirp_version=$($pkg_config --modversion slirp 2>/dev/null)
|
||||
slirp_cflags=$($pkg_config --cflags slirp 2>/dev/null)
|
||||
slirp_libs=$($pkg_config --libs slirp 2>/dev/null)
|
||||
;;
|
||||
|
||||
no)
|
||||
;;
|
||||
*)
|
||||
error_exit "Unknown state for slirp: $slirp"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
##########################################
|
||||
# End of CC checks
|
||||
# After here, no more $cc or $ld runs
|
||||
@@ -6126,7 +6179,8 @@ echo "QEMU_LDFLAGS $QEMU_LDFLAGS"
|
||||
echo "make $make"
|
||||
echo "install $install"
|
||||
echo "python $python ($python_version)"
|
||||
if test "$slirp" = "yes" ; then
|
||||
echo "slirp support $slirp $(echo_version $slirp $slirp_version)"
|
||||
if test "$slirp" != "no" ; then
|
||||
echo "smbd $smbd"
|
||||
fi
|
||||
echo "module support $modules"
|
||||
@@ -6393,9 +6447,14 @@ fi
|
||||
if test "$profiler" = "yes" ; then
|
||||
echo "CONFIG_PROFILER=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$slirp" = "yes" ; then
|
||||
if test "$slirp" != "no"; then
|
||||
echo "CONFIG_SLIRP=y" >> $config_host_mak
|
||||
echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
|
||||
echo "SLIRP_CFLAGS=$slirp_cflags" >> $config_host_mak
|
||||
echo "SLIRP_LIBS=$slirp_libs" >> $config_host_mak
|
||||
fi
|
||||
if [ "$slirp" = "git" -o "$slirp" = "internal" ]; then
|
||||
echo "config-host.h: subdir-slirp" >> $config_host_mak
|
||||
fi
|
||||
if test "$vde" = "yes" ; then
|
||||
echo "CONFIG_VDE=y" >> $config_host_mak
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#ifndef QEMU_FILE_H
|
||||
#define QEMU_FILE_H
|
||||
|
||||
int qemu_file_get_error(QEMUFile *f);
|
||||
|
||||
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size);
|
||||
void qemu_put_byte(QEMUFile *f, int v);
|
||||
|
||||
|
||||
@@ -149,7 +149,6 @@ void qemu_update_position(QEMUFile *f, size_t size);
|
||||
void qemu_file_reset_rate_limit(QEMUFile *f);
|
||||
void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
|
||||
int64_t qemu_file_get_rate_limit(QEMUFile *f);
|
||||
int qemu_file_get_error(QEMUFile *f);
|
||||
void qemu_file_set_error(QEMUFile *f, int ret);
|
||||
int qemu_file_shutdown(QEMUFile *f);
|
||||
QEMUFile *qemu_file_get_return_path(QEMUFile *f);
|
||||
|
||||
@@ -8,6 +8,8 @@ common-obj-$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET_USER)) += vhost-u
|
||||
common-obj-$(call land,$(call lnot,$(CONFIG_VIRTIO_NET)),$(CONFIG_VHOST_NET_USER)) += vhost-user-stub.o
|
||||
common-obj-$(CONFIG_ALL) += vhost-user-stub.o
|
||||
common-obj-$(CONFIG_SLIRP) += slirp.o
|
||||
slirp.o-cflags := $(SLIRP_CFLAGS)
|
||||
slirp.o-libs := $(SLIRP_LIBS)
|
||||
common-obj-$(CONFIG_VDE) += vde.o
|
||||
common-obj-$(CONFIG_NETMAP) += netmap.o
|
||||
common-obj-y += filter.o
|
||||
|
||||
+57
-1
@@ -37,13 +37,15 @@
|
||||
#include "monitor/monitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "slirp/libslirp.h"
|
||||
#include <libslirp.h>
|
||||
#include "chardev/char-fe.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "util.h"
|
||||
#include "migration/register.h"
|
||||
#include "migration/qemu-file-types.h"
|
||||
|
||||
static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
|
||||
{
|
||||
@@ -146,6 +148,7 @@ static void net_slirp_cleanup(NetClientState *nc)
|
||||
|
||||
g_slist_free_full(s->fwd, slirp_free_fwd);
|
||||
main_loop_poll_remove_notifier(&s->poll_notifier);
|
||||
unregister_savevm(NULL, "slirp", s->slirp);
|
||||
slirp_cleanup(s->slirp);
|
||||
if (s->exit_notifier.notify) {
|
||||
qemu_remove_exit_notifier(&s->exit_notifier);
|
||||
@@ -303,6 +306,46 @@ static void net_slirp_poll_notify(Notifier *notifier, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
net_slirp_stream_read(void *buf, size_t size, void *opaque)
|
||||
{
|
||||
QEMUFile *f = opaque;
|
||||
|
||||
return qemu_get_buffer(f, buf, size);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
net_slirp_stream_write(const void *buf, size_t size, void *opaque)
|
||||
{
|
||||
QEMUFile *f = opaque;
|
||||
|
||||
qemu_put_buffer(f, buf, size);
|
||||
if (qemu_file_get_error(f)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int net_slirp_state_load(QEMUFile *f, void *opaque, int version_id)
|
||||
{
|
||||
Slirp *slirp = opaque;
|
||||
|
||||
return slirp_state_load(slirp, version_id, net_slirp_stream_read, f);
|
||||
}
|
||||
|
||||
static void net_slirp_state_save(QEMUFile *f, void *opaque)
|
||||
{
|
||||
Slirp *slirp = opaque;
|
||||
|
||||
slirp_state_save(slirp, net_slirp_stream_write, f);
|
||||
}
|
||||
|
||||
static SaveVMHandlers savevm_slirp_state = {
|
||||
.save_state = net_slirp_state_save,
|
||||
.load_state = net_slirp_state_load,
|
||||
};
|
||||
|
||||
static int net_slirp_init(NetClientState *peer, const char *model,
|
||||
const char *name, int restricted,
|
||||
bool ipv4, const char *vnetwork, const char *vhost,
|
||||
@@ -523,6 +566,18 @@ static int net_slirp_init(NetClientState *peer, const char *model,
|
||||
&slirp_cb, s);
|
||||
QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry);
|
||||
|
||||
/*
|
||||
* Make sure the current bitstream version of slirp is 4, to avoid
|
||||
* QEMU migration incompatibilities, if upstream slirp bumped the
|
||||
* version.
|
||||
*
|
||||
* FIXME: use bitfields of features? teach libslirp to save with
|
||||
* specific version?
|
||||
*/
|
||||
g_assert(slirp_state_version() == 4);
|
||||
register_savevm_live(NULL, "slirp", 0, slirp_state_version(),
|
||||
&savevm_slirp_state, s->slirp);
|
||||
|
||||
s->poll_notifier.notify = net_slirp_poll_notify;
|
||||
main_loop_poll_add_notifier(&s->poll_notifier);
|
||||
|
||||
@@ -885,6 +940,7 @@ static ssize_t guestfwd_write(const void *buf, size_t len, void *chr)
|
||||
|
||||
static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp)
|
||||
{
|
||||
/* TODO: IPv6 */
|
||||
struct in_addr server = { .s_addr = 0 };
|
||||
struct GuestFwd *fwd;
|
||||
const char *p;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
BUILD_DIR ?= .
|
||||
|
||||
LIBSLIRP = $(BUILD_DIR)/libslirp.a
|
||||
|
||||
all: $(LIBSLIRP)
|
||||
|
||||
SRCS := $(wildcard src/*.c)
|
||||
OBJS := $(SRCS:%.c=$(BUILD_DIR)/%.o)
|
||||
DEPS := $(OBJS:%.o=%.d)
|
||||
|
||||
INC_DIRS := $(BUILD_DIR)/src
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
override CFLAGS += \
|
||||
-DG_LOG_DOMAIN='"Slirp"' \
|
||||
$(shell $(PKG_CONFIG) --cflags glib-2.0) \
|
||||
$(INC_FLAGS) \
|
||||
-MMD -MP
|
||||
override LDFLAGS += $(shell $(PKG_CONFIG) --libs glib-2.0)
|
||||
|
||||
$(LIBSLIRP): $(OBJS)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -r $(OBJS) $(DEPS) $(LIBSLIRP)
|
||||
|
||||
$(BUILD_DIR)/src/%.o: $(ROOT_DIR)/src/%.c
|
||||
@$(MKDIR_P) $(dir $@)
|
||||
$(call quiet-command,$(CC) $(CFLAGS) -c -o $@ $<,"CC","$@")
|
||||
|
||||
%.a:
|
||||
$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$@")
|
||||
|
||||
PKG_CONFIG ?= pkg-config
|
||||
MKDIR_P ?= mkdir -p
|
||||
quiet-command-run = $(if $(V),,$(if $2,printf " %-7s %s\n" $2 $3 && ))$1
|
||||
quiet-@ = $(if $(V),,@)
|
||||
quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
|
||||
|
||||
print-%:
|
||||
@echo '$*=$($*)'
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
-include $(DEPS)
|
||||
@@ -1,34 +0,0 @@
|
||||
slirp-obj-y = slirp.mo
|
||||
|
||||
slirp.mo-objs = \
|
||||
arp_table.o \
|
||||
bootp.o \
|
||||
cksum.o \
|
||||
dhcpv6.o \
|
||||
dnssearch.o \
|
||||
if.o \
|
||||
ip6_icmp.o \
|
||||
ip6_input.o \
|
||||
ip6_output.o \
|
||||
ip_icmp.o \
|
||||
ip_input.o \
|
||||
ip_output.o \
|
||||
mbuf.o \
|
||||
misc.o \
|
||||
ncsi.o \
|
||||
ndp_table.o \
|
||||
sbuf.o \
|
||||
slirp.o \
|
||||
socket.o \
|
||||
state.o \
|
||||
tcp_input.o \
|
||||
tcp_output.o \
|
||||
tcp_subr.o \
|
||||
tcp_timer.o \
|
||||
tftp.o \
|
||||
udp.o \
|
||||
udp6.o \
|
||||
util.o \
|
||||
$(NULL)
|
||||
|
||||
slirp.mo-cflags = -DG_LOG_DOMAIN=\"Slirp\" -DWITH_QEMU
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user