From patchwork Sun Mar 26 18:39:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 9645163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6BDD6602C8 for ; Sun, 26 Mar 2017 18:39:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F50C2521E for ; Sun, 26 Mar 2017 18:39:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52C4027F81; Sun, 26 Mar 2017 18:39:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 240522521E for ; Sun, 26 Mar 2017 18:39:52 +0000 (UTC) Received: from localhost ([::1]:41900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csD4w-00054Y-H0 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 26 Mar 2017 14:39:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csD4N-00054S-7E for qemu-devel@nongnu.org; Sun, 26 Mar 2017 14:39:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csD4M-0007OC-4h for qemu-devel@nongnu.org; Sun, 26 Mar 2017 14:39:15 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:47417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csD4L-0007LD-Rw for qemu-devel@nongnu.org; Sun, 26 Mar 2017 14:39:14 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 14CFDBB21; Sun, 26 Mar 2017 20:39:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n87Gt-TkkNqZ; Sun, 26 Mar 2017 20:39:09 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [IPv6:2a01:cb19:181:c200:3602:86ff:fe2c:6a19]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 35F32B6DA; Sun, 26 Mar 2017 20:39:09 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.88) (envelope-from ) id 1csD4G-00066A-HC; Sun, 26 Mar 2017 20:39:08 +0200 Date: Sun, 26 Mar 2017 20:39:08 +0200 From: Samuel Thibault To: Cole Robinson Message-ID: <20170326183908.cogmdiisen2jlsh5@var.youpi.perso.aquilenet.fr> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Organization: I am not organized User-Agent: NeoMutt/20170113 (1.7.2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:474::1 Subject: Re: [Qemu-devel] slirp + ipxe + ipv6 dns issue X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ondrejj@salstar.sk, qemu-devel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hello, Cole Robinson, on ven. 24 mars 2017 21:17:43 -0400, wrote: > I bisected to this commit: > > slirp: Add RDNSS advertisement Mmm, I see. Could you try the attached patch to confirm that it fixes the issue for you too? Samuel diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 298a48dd25..00183e5945 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -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,27 +187,30 @@ 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) */ - /* 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; -#endif + { + struct in6_addr addr; + uint32_t scope_id; + 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; + 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);