aboutsummaryrefslogtreecommitdiff
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
commit511be19b96229a5cc276742d82189df2d9f20db5 (patch)
tree4cfef648a7d2c4630632dba86100c2859a515cd6
parenta377269b797834a3c139fab13bf73955d6067b99 (diff)
downloadslirp-511be19b96229a5cc276742d82189df2d9f20db5.zip
slirp-511be19b96229a5cc276742d82189df2d9f20db5.tar.gz
slirp-511be19b96229a5cc276742d82189df2d9f20db5.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>
-rw-r--r--libslirp.h8
-rw-r--r--slirp.c28
2 files changed, 14 insertions, 22 deletions
diff --git a/libslirp.h b/libslirp.h
index 9a3fe40..6911898 100644
--- a/libslirp.h
+++ b/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.c b/slirp.c
index c4a77e2..43e0670 100644
--- a/slirp.c
+++ b/slirp.c
@@ -200,9 +200,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));
@@ -222,22 +224,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);
@@ -246,6 +235,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);