mirror of https://gitee.com/openkylin/qemu.git
slirp: introduce SLIRP_DEBUG environment variable
Learn to read SLIRP_DEBUG=call,misc,error (all or help also handled) to set the slirp_debug flags. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
parent
208408c3ed
commit
039d5b6312
|
@ -11,14 +11,6 @@
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
#define SLIRP_DEBUG (DBG_CALL | DBG_MISC | DBG_ERROR)
|
|
||||||
#else
|
|
||||||
#define SLIRP_DEBUG 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int slirp_debug = SLIRP_DEBUG;
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
insque(void *a, void *b)
|
insque(void *a, void *b)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int slirp_debug;
|
||||||
|
|
||||||
/* Define to 1 if you want KEEPALIVE timers */
|
/* Define to 1 if you want KEEPALIVE timers */
|
||||||
bool slirp_do_keepalive;
|
bool slirp_do_keepalive;
|
||||||
|
|
||||||
|
@ -250,6 +252,7 @@ int get_dns6_addr(struct in6_addr *pdns6_addr, uint32_t *scope_id)
|
||||||
static void slirp_init_once(void)
|
static void slirp_init_once(void)
|
||||||
{
|
{
|
||||||
static int initialized;
|
static int initialized;
|
||||||
|
const char *debug;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WSADATA Data;
|
WSADATA Data;
|
||||||
#endif
|
#endif
|
||||||
|
@ -266,6 +269,18 @@ static void slirp_init_once(void)
|
||||||
|
|
||||||
loopback_addr.s_addr = htonl(INADDR_LOOPBACK);
|
loopback_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||||
loopback_mask = htonl(IN_CLASSA_NET);
|
loopback_mask = htonl(IN_CLASSA_NET);
|
||||||
|
|
||||||
|
debug = g_getenv("SLIRP_DEBUG");
|
||||||
|
if (debug) {
|
||||||
|
const GDebugKey keys[] = {
|
||||||
|
{ "call", DBG_CALL },
|
||||||
|
{ "misc", DBG_MISC },
|
||||||
|
{ "error", DBG_ERROR },
|
||||||
|
};
|
||||||
|
slirp_debug = g_parse_debug_string(debug, keys, G_N_ELEMENTS(keys));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void slirp_state_save(QEMUFile *f, void *opaque);
|
static void slirp_state_save(QEMUFile *f, void *opaque);
|
||||||
|
|
Loading…
Reference in New Issue