From c138b081413d0dc2735997e68c722ec65b8dee62 Mon Sep 17 00:00:00 2001 From: Erik Auerswald Date: Sat, 17 Feb 2024 17:21:32 +0100 Subject: [PATCH] typo fixes pertaining to ICMP for IPv6 sockets As mentioned in issue #300, error messages pertaining to socket creation may not be printed. But they should be corrected anyway, just as the comments. Having correct error messages also makes a fix for issue #300 more obvious, because the messages itself would not change. --- src/socket6.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/socket6.c b/src/socket6.c index 9ba42a3..84a84ea 100644 --- a/src/socket6.c +++ b/src/socket6.c @@ -51,15 +51,15 @@ int open_ping_socket_ipv6(int *socktype) struct protoent* proto; int s; - /* confirm that ICMP is available on this machine */ + /* confirm that ICMP6 is available on this machine */ if ((proto = getprotobyname("ipv6-icmp")) == NULL) - crash_and_burn("icmp: unknown protocol"); + crash_and_burn("ipv6-icmp: unknown protocol"); - /* create raw socket for ICMP calls (ping) */ + /* create raw socket for ICMP6 calls (ping) */ *socktype = SOCK_RAW; s = socket(AF_INET6, *socktype, proto->p_proto); if (s < 0) { - /* try non-privileged icmp (works on Mac OSX without privileges, for example) */ + /* try non-privileged icmp6 (works on Mac OSX without privileges, for example) */ *socktype = SOCK_DGRAM; s = socket(AF_INET6, *socktype, proto->p_proto); if (s < 0) { @@ -104,7 +104,7 @@ void socket_set_src_addr_ipv6(int s, struct in6_addr* src_addr, int *ident) if (ident) { memset(&sa, 0, len); 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 ICMP6 socket identity"); if (sa.sin6_port) *ident = sa.sin6_port;