> why/how does ping ::1 work

link-local addresses
(https://tools.ietf.org/html/rfc4291?referring_site=bodynav#section-2.5.6)
are unrelated to the loopback address
(https://tools.ietf.org/html/rfc4291?referring_site=bodynav#section-2.5.3).

ping6 with just -I should not work, but ping6 with just % should.
(both together is fine too.) sin6_scope_id needs to be set to
correspond to the interface.

IPv6 is a sizeable bag of worms.
On Mon, Jul 9, 2018 at 4:42 PM Rob Landley <r...@landley.net> wrote:
>
>
>
> On 07/09/2018 04:49 PM, enh wrote:
> > On Fri, Jul 6, 2018 at 6:16 PM Rob Landley <r...@landley.net> wrote:
> >>
> >> On 07/06/2018 03:19 PM, enh wrote:
> >>> they said they'd be much more worried about whether we use IP_RECVERR
> >>> and parse ICMP errors correctly,
> >>
> >> I don't think we do but I'll throw it on the todo heap. I'm not 100% sure 
> >> what
> >> "correctly" means here, but I can try to research it.
> >>
> >>> or do link-local ping correctly...
> >>
> >> Again, define "correctly"...?
> >>
> >> (I can ping ::1 and ping 127.0.0.1 but I dunno if it's doing something 
> >> wrong?)
> >
> > https://en.wikipedia.org/wiki/Link-local_address#IPv6
>
> This can of worms?
>
> https://twitter.com/RichFelker/status/982286128593043456
>
> (I've always considered ipv6 a poster child for the second system effect.)
>
> > try `ifconfig -a | grep link`
>
> No output. (Using ubuntu's ifconfig or toybox's.) Ah: case insensitive grep.
>
> > and then compare `ping6 $that_address`
> > (which should fail) against `ping6 -I $that_interface $that_address`
>
> Sigh. I had -I working at one point... wait,
>
>   printf("ntop=%s\n", ntop(sa));
>   if (TT.I && bind(TT.sock, sa, sizeof(src_addr))) perror_exit("bind");
>
> $ ./ping -I wlan0 fe80::6627:37ff:fe21:64bf
> ntop=fe80::6627:37ff:fe21:64bf
> Ping fe80::6627:37ff:fe21:64bf (fe80::6627:37ff:fe21:64bf) from wlan0
> (fe80::6627:37ff:fe21:64bf): 56(84) bytes.
> ping: sendto: Invalid argument
>
> What am I doing wrong? I'm binding to the same IP address I'm trying to ping,
> how is sendto() giving me an invalid argument error? strace says:
>
> socket(PF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6) = 3
> bind(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6,
> "fe80::6627:37ff:fe21:64bf", &sin6_addr), sin6_flowinfo=0,
> sin6_scope_id=if_nametoindex("wlan0")}, 28) = 0
> sendto(3,
> "\200\0002(\236+\1\0000\311\3412\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
> 64, 0, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6,
> "fe80::6627:37ff:fe21:64bf", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 
> 28)
> = -1 EINVAL (Invalid argument)
>
> Opened with v6, bound with v6... Sigh, do I have the destination packet
> misformatted for v6? If so, why/how does ping ::1 work?
>
> Hmmm... And this is why I have systems built for qemu, so I can STICK PRINTKs
> INTO THE KERNEL. Grrr...
>
> > and `ping6 $that_address%$that_interface`.
>
> I'm guessing percent is a synonym for -I so this is basically the same issue,
> modulo implementing %?
>
> Rob
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to