aboutsummaryrefslogtreecommitdiff
path: root/slirp
diff options
context:
space:
mode:
authorYann Bordenave <meow@meowstars.org>2016-03-15 10:31:22 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-03-15 10:35:25 +0100
commit7aac531ef260e3176838f8089525f3e13e40b607 (patch)
treed6f86287f03acba16bdf2407871e21d74caf5932 /slirp
parent05061d8548598c92bda94de0c6159732e75da719 (diff)
downloadqemu-7aac531ef260e3176838f8089525f3e13e40b607.zip
qemu-7aac531ef260e3176838f8089525f3e13e40b607.tar.gz
qemu-7aac531ef260e3176838f8089525f3e13e40b607.tar.bz2
qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses
This patch adds parameters to manage some new options in the qemu -net command. Slirp IPv6 address, network prefix, and DNS IPv6 address can be given in argument to the qemu command. Defaults parameters are respectively fec0::2, fec0::, /64 and fec0::3. Signed-off-by: Yann Bordenave <meow@meowstars.org> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'slirp')
-rw-r--r--slirp/libslirp.h8
-rw-r--r--slirp/slirp.c28
2 files changed, 14 insertions, 22 deletions
diff --git a/slirp/libslirp.h b/slirp/libslirp.h
index 5bdcbd5..c4b25c9 100644
--- a/slirp/libslirp.h
+++ b/slirp/libslirp.h
@@ -10,9 +10,11 @@ int get_dns_addr(struct in_addr *pdns_addr);
Slirp *slirp_init(int restricted, struct in_addr vnetwork,
struct in_addr vnetmask, struct in_addr vhost,
- const char *vhostname, const char *tftp_path,
- const char *bootfile, struct in_addr vdhcp_start,
- struct in_addr vnameserver, const char **vdnssearch,
+ struct in6_addr vprefix_addr6, uint8_t vprefix_len,
+ struct in6_addr vhost6, const char *vhostname,
+ const char *tftp_path, const char *bootfile,
+ struct in_addr vdhcp_start, struct in_addr vnameserver,
+ struct in6_addr vnameserver6, const char **vdnssearch,
void *opaque);
void slirp_cleanup(Slirp *slirp);
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 7a47bb6..9ccf415 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -201,9 +201,11 @@ static int slirp_state_load(QEMUFile *f, void *opaque, int version_id);
Slirp *slirp_init(int restricted, struct in_addr vnetwork,
struct in_addr vnetmask, struct in_addr vhost,
- const char *vhostname, const char *tftp_path,
- const char *bootfile, struct in_addr vdhcp_start,
- struct in_addr vnameserver, const char **vdnssearch,
+ struct in6_addr vprefix_addr6, uint8_t vprefix_len,
+ struct in6_addr vhost6, const char *vhostname,
+ const char *tftp_path, const char *bootfile,
+ struct in_addr vdhcp_start, struct in_addr vnameserver,
+ struct in6_addr vnameserver6, const char **vdnssearch,
void *opaque)
{
Slirp *slirp = g_malloc0(sizeof(Slirp));
@@ -223,22 +225,9 @@ Slirp *slirp_init(int restricted, struct in_addr vnetwork,
slirp->vnetwork_addr = vnetwork;
slirp->vnetwork_mask = vnetmask;
slirp->vhost_addr = vhost;
-#if defined(_WIN32) && (_WIN32_WINNT < 0x0600)
- /* No inet_pton helper... */
- memset(&slirp->vprefix_addr6, 0, sizeof(slirp->vprefix_addr6));
- slirp->vprefix_addr6.s6_addr[0] = 0xfe;
- slirp->vprefix_addr6.s6_addr[1] = 0xc0;
- slirp->vprefix_len = 64;
- slirp->vhost_addr6 = slirp->vprefix_addr6;
- slirp->vhost_addr6.s6_addr[15] = 0x2;
- slirp->vnameserver_addr6 = slirp->vprefix_addr6;
- slirp->vnameserver_addr6.s6_addr[15] = 0x3;
-#else
- inet_pton(AF_INET6, "fec0::0", &slirp->vprefix_addr6);
- slirp->vprefix_len = 64;
- inet_pton(AF_INET6, "fec0::2", &slirp->vhost_addr6);
- inet_pton(AF_INET6, "fec0::3", &slirp->vnameserver_addr6);
-#endif
+ slirp->vprefix_addr6 = vprefix_addr6;
+ slirp->vprefix_len = vprefix_len;
+ slirp->vhost_addr6 = vhost6;
if (vhostname) {
pstrcpy(slirp->client_hostname, sizeof(slirp->client_hostname),
vhostname);
@@ -247,6 +236,7 @@ Slirp *slirp_init(int restricted, struct in_addr vnetwork,
slirp->bootp_filename = g_strdup(bootfile);
slirp->vdhcp_startaddr = vdhcp_start;
slirp->vnameserver_addr = vnameserver;
+ slirp->vnameserver_addr6 = vnameserver6;
if (vdnssearch) {
translate_dnssearch(slirp, vdnssearch);