[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCHv7 9/9] qapi-schema, qemu-options & slirp: Adding
From: |
Samuel Thibault |
Subject: |
Re: [Qemu-devel] [PATCHv7 9/9] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses |
Date: |
Fri, 19 Feb 2016 01:35:30 +0100 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Thomas Huth, on Wed 17 Feb 2016 12:59:04 +0100, wrote:
> The IPv4 code seems to have a sanity check that the vhost address is
> within the same net as specified with the "net=" parameter... maybe the
> IPv6 part should have that, too? Or use the prefix from "ip6-net=" here
> if ip6-host has not been specified manually?
I'd say the latter indeed. I have reworked this part of the code, and
then the implementation matches the documentation :)
@@ -235,6 +242,52 @@ static int net_slirp_init(NetClientState *peer, const char
*model,
}
#endif
+
+ if (!vprefix6) {
+ vprefix6 = "fec0::";
+ }
+ if (!inet_pton(AF_INET6, vprefix6, &ip6_prefix)) {
+ return -1;
+ }
+
+ if (!vprefix6_len) {
+ vprefix6_len = 64;
+ }
+ if (vprefix6_len < 0 || vprefix6_len > 128) {
+ return -1;
+ }
+
+ if (vhost6) {
+ if (!inet_pton(AF_INET6, vhost6, &ip6_host)) {
+ return -1;
+ }
+ if (!in6_equal_net(&ip6_prefix, &ip6_host, vprefix6_len)) {
+ return -1;
+ }
+ } else {
+ if (vprefix6_len > 126) {
+ return -1;
+ }
+ ip6_host = ip6_prefix;
+ ip6_host.s6_addr[15] |= 2;
+ }
+
+ if (vnameserver6) {
+ if (!inet_pton(AF_INET6, vnameserver6, &ip6_dns)) {
+ return -1;
+ }
+ if (!in6_equal_net(&ip6_prefix, &ip6_dns, vprefix6_len)) {
+ return -1;
+ }
+ } else {
+ if (vprefix6_len > 126) {
+ return -1;
+ }
+ ip6_dns = ip6_prefix;
+ ip6_dns.s6_addr[15] |= 3;
+ }
+
+
nc = qemu_new_net_client(&net_slirp_info, peer, model, name);
snprintf(nc->info_str, sizeof(nc->info_str),
- Re: [Qemu-devel] [PATCHv7 5/9] slirp: Generalizing and neutralizing various TCP functions before adding IPv6 stuff, (continued)
- [Qemu-devel] [PATCHv7 1/9] slirp: Adding IPv6, ICMPv6 Echo and NDP autoconfiguration, Samuel Thibault, 2016/02/14
- [Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure with an union, Samuel Thibault, 2016/02/14
- [Qemu-devel] [PATCHv7 7/9] slirp: Handle IPv6 in TCP functions, Samuel Thibault, 2016/02/14
- [Qemu-devel] [PATCHv7 9/9] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Samuel Thibault, 2016/02/14
- [Qemu-devel] [PATCHv7 8/9] slirp: Adding IPv6 address for DNS relay, Samuel Thibault, 2016/02/14
- [Qemu-devel] [PATCH] slirp: Add IPv6 support to the TFTP code, Thomas Huth, 2016/02/16