Skip to content

Commit

Permalink
Revert "correctly initialize first hop"
Browse files Browse the repository at this point in the history
This reverts commit e25568f.

as it breaks ping to local IPv6 interfaces:

$ ip addr |grep 'inet6'
    inet6 fe80::fc54:ff:fe2d:cc21/64 scope link

$ ./ping -6 fe80::fc54:ff:fe2d:cc21
connect: Invalid argument

Fixes #99 (regression in #57).
  • Loading branch information
pevik committed Oct 30, 2017
1 parent 98dbf8e commit db77fb5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ping6_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,11 @@ int ping6_run(int argc, char **argv, struct addrinfo *ai, struct socket_st *sock
}
disable_capability_raw();
}
firsthop.sin6_family = AF_INET6;

if (!IN6_IS_ADDR_LINKLOCAL(&firsthop.sin6_addr) &&
!IN6_IS_ADDR_MC_LINKLOCAL(&firsthop.sin6_addr))
firsthop.sin6_family = AF_INET6;

firsthop.sin6_port = htons(1025);
if (connect(probe_fd, (struct sockaddr*)&firsthop, sizeof(firsthop)) == -1) {
perror("connect");
Expand Down

0 comments on commit db77fb5

Please sign in to comment.