You are not logged in.

#1 2013-12-29 22:21:52

aplund
Member
Registered: 2012-06-19
Posts: 26

IPv6 autoconfigured address breaks curl

I get error messages when upgrading packages from AUR using yaourt like this:

curl error: Couldn't connect to server

Turns out that just running curl gives this:

$ curl http://aur.archlinux.org/
curl: (7) Failed to connect to aur.archlinux.org port 80: Network is unreachable

This is crazy as I can connect to AUR using firefox on the same machine.  I managed to fix this by deleting the IPv6 auto-configured address on the network interface.

My ISP does not support IPv6 and so there is no way for me to connect to those addresses without using 6to4 or similar (which has horrible performance for me).

Why does curl do strange things like this when ipv6 is configured?  Surely it should just try the A record instead of the AAAA record. 

Does anyone else have this problem and/or any hints as to how to fix this without having to remove the IPv6 address from the interface?

Offline

#2 2013-12-29 22:44:27

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: IPv6 autoconfigured address breaks curl

Have you tried

man curl wrote:

-4, --ipv4
    If curl is capable of resolving an address to multiple IP versions (which it is if it is IPv6-capable), this option tells curl to resolve names to IPv4 addresses only.

Offline

#3 2013-12-29 22:58:39

aplund
Member
Registered: 2012-06-19
Posts: 26

Re: IPv6 autoconfigured address breaks curl

That does seem to work for a single user.  But how can I get it to work in yaourt?  I tried putting "--ipv4" in /root/.curlrc, but I get the same error.

Offline

#4 2013-12-29 23:31:07

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: IPv6 autoconfigured address breaks curl

What about other AUR helpers? Does e.g. cower work fine?
Did you put that option in ~/.curlrc too?

Offline

#5 2013-12-30 03:13:08

aplund
Member
Registered: 2012-06-19
Posts: 26

Re: IPv6 autoconfigured address breaks curl

karol wrote:

What about other AUR helpers? Does e.g. cower work fine?

What does everyone have against yaourt?  The issue here is more that curl doesn't work.

karol wrote:

Did you put that option in ~/.curlrc too?

Yes.

Offline

#6 2013-12-30 04:53:16

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,217
Website

Re: IPv6 autoconfigured address breaks curl

Seems to be a well known / recurring issue with curl, possibly tied back to c-ares. Lots of details here: https://bugzilla.redhat.com/show_bug.cgi?id=548269

One of the workarounds is to hard-code the IPv4 address in /etc/hosts (probably about the same level of hackery as just disabling IPv6 as a workaround)

Offline

#7 2013-12-30 10:11:35

aplund
Member
Registered: 2012-06-19
Posts: 26

Re: IPv6 autoconfigured address breaks curl

It seems that the reason the error messages remain even when using --ipv4 in ~/.curlrc is due to some bug in the way that package-query (from yaourt) initialises the curl library:

$ package-query -QAm
curl error: Couldn't connect to server
curl error: Couldn't connect to server
...

Offline

#8 2013-12-30 10:44:24

Lekensteyn
Member
From: Netherlands
Registered: 2012-06-19
Posts: 192
Website

Re: IPv6 autoconfigured address breaks curl

What about removing the default IPv6 route? See the manual page of ip-route.

Offline

#9 2013-12-30 12:43:34

aplund
Member
Registered: 2012-06-19
Posts: 26

Re: IPv6 autoconfigured address breaks curl

Lekensteyn wrote:

What about removing the default IPv6 route? See the manual page of ip-route.

This kept being put back by something each time I removed it.

That lead me to NetworkManager settings and I changed the IPv6 settings to link-local only (effectively removing the default route).  And that does seem to work.

Offline

#10 2013-12-30 16:02:44

ghen
Member
From: Belgium
Registered: 2010-08-31
Posts: 121

Re: IPv6 autoconfigured address breaks curl

You have some system in your network sending (rogue) router advertisements?  Typically an older Windows machine with an automatic 6to4 tunnel?

"ip -6 route show" (at the time the problem occurs) can point you to this system (the advertised default gateway).

"sysctl -w net.ipv6.conf.all.accept_ra=0" makes the kernel ignore router advertisements, and thus effectively hides the problem.  I assume the NetworkManager link-local setting sets this sysctl.  But it's better to find the rogue router and get rid of it.

Offline

#11 2013-12-30 20:39:01

aplund
Member
Registered: 2012-06-19
Posts: 26

Re: IPv6 autoconfigured address breaks curl

My internet modem/router claims to run radvd.  The mac address of the configured default gateway does seem to match that too.

Offline

#12 2014-01-07 21:12:09

middy
Member
Registered: 2013-09-15
Posts: 13

Re: IPv6 autoconfigured address breaks curl

Same issue here with curl and yaourt. It's annoying. I have to keep spamming yaourt -Xx foo over and over again and hope it doesn't say "curl couldn't connect to server" when it tries to pull in deps and have to restart it all over again. It works so randomly. Is there anyway to make yaourt use wget instead or something?

Last edited by middy (2014-01-07 21:14:15)

Offline

#13 2014-01-07 22:23:36

Lekensteyn
Member
From: Netherlands
Registered: 2012-06-19
Posts: 192
Website

Re: IPv6 autoconfigured address breaks curl

You could try adding the next to your /etc/pacman.conf to force IPv4:

XferCommand = /usr/bin/wget -4 --passive-ftp -c -O %o %u

Offline

#14 2014-01-12 00:28:15

dannylibonette
Member
Registered: 2014-01-12
Posts: 1

Re: IPv6 autoconfigured address breaks curl

I had the same problem with my new ISP, and I thought there was some sort of block on it 'cause I could use yaourt without problems on someone else's wifi. Thanks to this thread I gave a try disabling IPv6 through the kernel line, like it says here:

https://wiki.archlinux.org/index.php/IPv6#Disable_IPv6

...And now it works like a charm! smile
Thanks to everyone!

Offline

Board footer

Powered by FluxBB