All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] slirp + ipxe + ipv6 dns issue
@ 2017-03-25  1:17 Cole Robinson
  2017-03-26 18:39 ` Samuel Thibault
  0 siblings, 1 reply; 4+ messages in thread
From: Cole Robinson @ 2017-03-25  1:17 UTC (permalink / raw)
  To: samuel.thibault; +Cc: ondrejj, qemu-devel

Hi Samuel,

A Fedora user reported a regression for his ipxe setup (Jan, CCd). He has a
public PXE server and config. You can see details about his config here:
http://boot.salstar.sk/ipxe/

Reproducer:

  wget http://boot.salstar.sk/ipxe/ipxe.lkrn
  qemu-system-x86_64 -kernel ipxe.lkrn

Non-working output looks like:

Configuring (net0 52:54:00:12:34:56)..... ok
Could not get time and date: Connection timed out (http://ipxe.org/4c116035)
https://boot.salstar.sk/by_mac/52%3A54%3A00%3A12%3A34%3A56..................
Connection timed out (http://ipxe.org/4c116035)
https://boot.salstar.sk/by_ip/10.0.2.15.................. Connection timed out
(http://ipxe.org/4c116035)
https://boot.salstar.sk/menu.ipxe.................. Connection timed out
(http://ipxe.org/4c116035)
Press any key to enter failsafe menu ...


Working output will quickly drop into a text UI boot menu.


I bisected to this commit:

commit f7725df38750c1eaebc6665159bb58ec23864c92
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Mar 20 16:02:52 2016 +0100

    slirp: Add RDNSS advertisement


And infact just reverting it on top of qemu.git makes things work again.

I'm not really sure if this is a bug or if it's just exposing a config issue
on the ipxe server... I tried enabling some ipxe debug commands like
ping/nslookup but didn't really get anywhere. Any thoughts/ideas?

Thanks,
Cole

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] slirp + ipxe + ipv6 dns issue
  2017-03-25  1:17 [Qemu-devel] slirp + ipxe + ipv6 dns issue Cole Robinson
@ 2017-03-26 18:39 ` Samuel Thibault
  2017-03-27 11:15   ` Ján ONDREJ (SAL)
  2017-03-27 20:34   ` Cole Robinson
  0 siblings, 2 replies; 4+ messages in thread
From: Samuel Thibault @ 2017-03-26 18:39 UTC (permalink / raw)
  To: Cole Robinson; +Cc: ondrejj, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

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

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3346 bytes --]

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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] slirp + ipxe + ipv6 dns issue
  2017-03-26 18:39 ` Samuel Thibault
@ 2017-03-27 11:15   ` Ján ONDREJ (SAL)
  2017-03-27 20:34   ` Cole Robinson
  1 sibling, 0 replies; 4+ messages in thread
From: Ján ONDREJ (SAL) @ 2017-03-27 11:15 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Cole Robinson, qemu-devel

Hello Samuel,

  I tested your patch and solved my problem. Thank you.
My version: qemu-kvm-2.7.1-4.fc25.x86_64 + your patch.
Original qemu-kvm-2.7.1-4.fc25.x86_64 didn't work.

Cole, thanks for reporting. Consider applying this to Fedora package.

I am not a member of qemu-devel, so this mail will be probably rejected
from this list. Please forward it if requested.

							SAL

On Sun, Mar 26, 2017 at 08:39:08PM +0200, Samuel Thibault wrote:
> 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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] slirp + ipxe + ipv6 dns issue
  2017-03-26 18:39 ` Samuel Thibault
  2017-03-27 11:15   ` Ján ONDREJ (SAL)
@ 2017-03-27 20:34   ` Cole Robinson
  1 sibling, 0 replies; 4+ messages in thread
From: Cole Robinson @ 2017-03-27 20:34 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: ondrejj, qemu-devel

On 03/26/2017 02:39 PM, Samuel Thibault wrote:
> 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?
> 

I also confirmed your patches fix the test case. Thanks!

- Cole

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-27 20:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-25  1:17 [Qemu-devel] slirp + ipxe + ipv6 dns issue Cole Robinson
2017-03-26 18:39 ` Samuel Thibault
2017-03-27 11:15   ` Ján ONDREJ (SAL)
2017-03-27 20:34   ` Cole Robinson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.