@ -51,15 +51,15 @@ int open_ping_socket_ipv6(int *socktype)
struct protoent * proto ;
struct protoent * proto ;
int s ;
int s ;
/* confirm that ICMP is available on this machine */
/* confirm that ICMP 6 is available on this machine */
if ( ( proto = getprotobyname ( " ipv6-icmp " ) ) = = NULL )
if ( ( proto = getprotobyname ( " ipv6-icmp " ) ) = = NULL )
crash_and_burn ( " i cmp: unknown protocol" ) ;
crash_and_burn ( " i pv6-i cmp: unknown protocol" ) ;
/* create raw socket for ICMP calls (ping) */
/* create raw socket for ICMP 6 calls (ping) */
* socktype = SOCK_RAW ;
* socktype = SOCK_RAW ;
s = socket ( AF_INET6 , * socktype , proto - > p_proto ) ;
s = socket ( AF_INET6 , * socktype , proto - > p_proto ) ;
if ( s < 0 ) {
if ( s < 0 ) {
/* try non-privileged icmp (works on Mac OSX without privileges, for example) */
/* try non-privileged icmp 6 (works on Mac OSX without privileges, for example) */
* socktype = SOCK_DGRAM ;
* socktype = SOCK_DGRAM ;
s = socket ( AF_INET6 , * socktype , proto - > p_proto ) ;
s = socket ( AF_INET6 , * socktype , proto - > p_proto ) ;
if ( s < 0 ) {
if ( s < 0 ) {
@ -104,7 +104,7 @@ void socket_set_src_addr_ipv6(int s, struct in6_addr* src_addr, int *ident)
if ( ident ) {
if ( ident ) {
memset ( & sa , 0 , len ) ;
memset ( & sa , 0 , len ) ;
if ( getsockname ( s , ( struct sockaddr * ) & sa , & len ) < 0 )
if ( getsockname ( s , ( struct sockaddr * ) & sa , & len ) < 0 )
errno_crash_and_burn ( " can't get ICMP socket identity" ) ;
errno_crash_and_burn ( " can't get ICMP 6 socket identity" ) ;
if ( sa . sin6_port )
if ( sa . sin6_port )
* ident = sa . sin6_port ;
* ident = sa . sin6_port ;