slirp updates
The following changes since commit df9046363220e57d45818312759b954c033c58ab:
Update version for v2.9.0-rc2 release (2017-03-28 19:11:16 +0100)
are available in the git repository at:
http://people.debian.org/~sthibault/qemu.git tags/samuel-thibault
for you to fetch changes up to a2f80fdfc683019901cdf4c0863a5920c0ca7245:
slirp: Send RDNSS in RA only if host has an IPv6 DNS server (2017-03-29 00:51:25 +0200)
----------------------------------------------------------------
slirp updates
----------------------------------------------------------------
Laurent Vivier (1):
slirp: fix compilation errors with DEBUG set
Samuel Thibault (2):
slirp: Make RA build more flexible
slirp: Send RDNSS in RA only if host has an IPv6 DNS server
slirp/ip6_icmp.c | 47 ++++++++++++++++++++++------------------------- slirp/slirp.c | 2 +- 2 files changed, 23 insertions(+), 26 deletions(-)
[Qemu-devel] [PULL 3/3] slirp: Send RDNSS in RA only if host has an IPv6 DNS server
Previously we would always send an RDNSS option in the RA, making the guest try to resolve DNS through IPv6, even if the host does not actually have and IPv6 DNS server available.
This makes the RDNSS option enabled only when an IPv6 DNS server is available.
--- slirp/ip6_icmp.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
slirp/ip6_icmp.c +14 -11
@@ -144,6 +144,9 @@ void ndp_send_ra(Slirp *slirp)struct mbuf *t =m_get (slirp); struct ip6 *rip = mtod(t, struct ip6 *);size_t pl_size =0 ; +struct in6_addr addr; +uint32_t scope_id; + rip->ip_src = (struct in6_addr )LINKLOCAL_ADDR ; rip->ip_dst = (struct in6_addr )ALLNODES_MULTICAST ; rip->ip_nh =IPPROTO_ICMPV6 ;
@@ -189,18 +192,18 @@ void ndp_send_ra(Slirp *slirp) t->m_data +=NDPOPT_PREFIXINFO_LEN ; pl_size +=NDPOPT_PREFIXINFO_LEN ; -#ifndef _WIN32/* Prefix information (NDP option) */ -/* disabled for windows for now, until get_dns6_addr is implemented */ - struct ndpopt *opt3 = mtod(t, struct ndpopt *); - opt3->ndpopt_type =NDPOPT_RDNSS ; - opt3->ndpopt_len =NDPOPT_RDNSS_LEN /8 ; - opt3->ndpopt_rdnss.reserved =0 ; - opt3->ndpopt_rdnss.lifetime =htonl (2 * NDP_MaxRtrAdvInterval); - opt3->ndpopt_rdnss.addr = slirp->vnameserver_addr6; - t->m_data +=NDPOPT_RDNSS_LEN ; - pl_size +=NDPOPT_RDNSS_LEN ; -#endif +if (get_dns6_addr (&addr, &scope_id) >=0 ) { +/* Host system does have an IPv6 DNS server, announce our proxy. */ + struct ndpopt *opt3 = mtod(t, struct ndpopt *); + opt3->ndpopt_type =NDPOPT_RDNSS ; + opt3->ndpopt_len =NDPOPT_RDNSS_LEN /8 ; + opt3->ndpopt_rdnss.reserved =0 ; + opt3->ndpopt_rdnss.lifetime =htonl (2 * NDP_MaxRtrAdvInterval); + opt3->ndpopt_rdnss.addr = slirp->vnameserver_addr6; + t->m_data +=NDPOPT_RDNSS_LEN ; + pl_size +=NDPOPT_RDNSS_LEN ; + } rip->ip_pl =htons (pl_size); t->m_data -=sizeof (struct ip6 ) + pl_size;
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 1/3] slirp: fix compilation errors with DEBUG set
In reply to Samuel ThibaultFrom: Laurent Vivier <[email protected]>
slirp/slirp.c: In function 'get_dns_addr_resolv_conf':slirp/slirp.c:202:29: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
char *res = inet_ntop(af, tmp_addr, s, sizeof(s));
^~~~~~~~~
slirp/slirp.c:204:25: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
res = "(string conversion error)";--- slirp/slirp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
slirp/slirp.c +1 -1
@@ -198,7 +198,7 @@ static int get_dns_addr_resolv_conf(int af, void *pdns_addr, void *cached_addr,#ifdef DEBUG else {char s[INET6_ADDRSTRLEN ]; -char *res =inet_ntop (af, tmp_addr, s,sizeof (s)); +const char *res =inet_ntop (af, tmp_addr, s,sizeof (s));if (!res) { res ="(string conversion error)" ; }
Signature · 1 line
2.11.0
[Qemu-devel] [PULL 2/3] slirp: Make RA build more flexible
In reply to Samuel ThibaultDo not hardcode the RA size at all, use a pl_size variable which accounts the accumulated size, and fill rip->ip_pl at the end.
This will allow to make some blocks optional.
--- slirp/ip6_icmp.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
slirp/ip6_icmp.c +9 -15
@@ -143,17 +143,10 @@ void ndp_send_ra(Slirp *slirp)/* Build IPv6 packet */ struct mbuf *t =m_get (slirp); struct ip6 *rip = mtod(t, struct ip6 *); +size_t pl_size =0 ; rip->ip_src = (struct in6_addr )LINKLOCAL_ADDR ; rip->ip_dst = (struct in6_addr )ALLNODES_MULTICAST ; rip->ip_nh =IPPROTO_ICMPV6 ; - rip->ip_pl =htons (ICMP6_NDP_RA_MINLEN - +NDPOPT_LINKLAYER_LEN - +NDPOPT_PREFIXINFO_LEN -#ifndef _WIN32 - +NDPOPT_RDNSS_LEN -#endif - ); - t->m_len =sizeof (struct ip6 ) +ntohs (rip->ip_pl);/* Build ICMPv6 packet */ t->m_data +=sizeof (struct ip6 );
@@ -171,6 +164,7 @@ void ndp_send_ra(Slirp *slirp) ricmp->icmp6_nra.reach_time =htonl (NDP_AdvReachableTime); ricmp->icmp6_nra.retrans_time =htonl (NDP_AdvRetransTime); t->m_data +=ICMP6_NDP_RA_MINLEN ; + pl_size +=ICMP6_NDP_RA_MINLEN ;/* Source link-layer address (NDP option) */ struct ndpopt *opt = mtod(t, struct ndpopt *);
@@ -178,6 +172,7 @@ void ndp_send_ra(Slirp *slirp) opt->ndpopt_len =NDPOPT_LINKLAYER_LEN /8 ;in6_compute_ethaddr (rip->ip_src, opt->ndpopt_linklayer); t->m_data +=NDPOPT_LINKLAYER_LEN ; + pl_size +=NDPOPT_LINKLAYER_LEN ;/* Prefix information (NDP option) */ struct ndpopt *opt2 = mtod(t, struct ndpopt *);
@@ -192,6 +187,7 @@ void ndp_send_ra(Slirp *slirp) opt2->ndpopt_prefixinfo.reserved2 =0 ; opt2->ndpopt_prefixinfo.prefix = slirp->vprefix_addr6; t->m_data +=NDPOPT_PREFIXINFO_LEN ; + pl_size +=NDPOPT_PREFIXINFO_LEN ;#ifndef _WIN32/* Prefix information (NDP option) */
@@ -203,16 +199,14 @@ void ndp_send_ra(Slirp *slirp) opt3->ndpopt_rdnss.lifetime =htonl (2 * NDP_MaxRtrAdvInterval); opt3->ndpopt_rdnss.addr = slirp->vnameserver_addr6; t->m_data +=NDPOPT_RDNSS_LEN ; + pl_size +=NDPOPT_RDNSS_LEN ;#endif + rip->ip_pl =htons (pl_size); + t->m_data -=sizeof (struct ip6 ) + pl_size; + t->m_len =sizeof (struct ip6 ) + pl_size; +/* ICMPv6 Checksum */ -#ifndef _WIN32 - t->m_data -=NDPOPT_RDNSS_LEN ; -#endif - t->m_data -=NDPOPT_PREFIXINFO_LEN ; - t->m_data -=NDPOPT_LINKLAYER_LEN ; - t->m_data -=ICMP6_NDP_RA_MINLEN ; - t->m_data -=sizeof (struct ip6 ); ricmp->icmp6_cksum =ip6_cksum (t);ip6_output (NULL , t,0 );
Signature · 1 line
2.11.0
Stefan Hajnoczi
Reviewed-byQuoted 19 lines · Samuel Thibault
The following changes since commit
df9046363220e57d45818312759b954c033c58ab:Update version for v2.9.0-rc2 release (2017-03-28 19:11:16 +0100)
are available in the git repository at:
http://people.debian.org/~sthibault/qemu.git tags/samuel-thibault
for you to fetch changes up to
a2f80fdfc683019901cdf4c0863a5920c0ca7245:slirp: Send RDNSS in RA only if host has an IPv6 DNS server (2017-03-29 00:51:25 +0200)
----------------------------------------------------------------
slirp updates----------------------------------------------------------------
Laurent Vivier (1):
slirp: fix compilation errors with DEBUG set
Quoted 7 lines
Samuel Thibault (2):
slirp: Make RA build more flexible
slirp: Send RDNSS in RA only if host has an IPv6 DNS serverslirp/ip6_icmp.c | 47 ++++++++++++++++++++++------------------------- slirp/slirp.c | 2 +- 2 files changed, 23 insertions(+), 26 deletions(-)
Peter Maydell
AppliedQuoted 24 lines · Stefan Hajnoczi
Quoted 23 lines · Samuel Thibault
The following changes since commit
df9046363220e57d45818312759b954c033c58ab:Update version for v2.9.0-rc2 release (2017-03-28 19:11:16 +0100)
are available in the git repository at:
http://people.debian.org/~sthibault/qemu.git tags/samuel-thibault
for you to fetch changes up to
a2f80fdfc683019901cdf4c0863a5920c0ca7245:slirp: Send RDNSS in RA only if host has an IPv6 DNS server (2017-03-29 00:51:25 +0200)
----------------------------------------------------------------
slirp updates----------------------------------------------------------------
Laurent Vivier (1):
slirp: fix compilation errors with DEBUG setSamuel Thibault (2):
slirp: Make RA build more flexible
slirp: Send RDNSS in RA only if host has an IPv6 DNS server
Quoted 5 lines
Quoted 3 lines
slirp/ip6_icmp.c | 47 ++++++++++++++++++++++------------------------- slirp/slirp.c | 2 +- 2 files changed, 23 insertions(+), 26 deletions(-)Reviewed-by Stefan Hajnoczi <[email protected]>
Applied, thanks.
-- PMM