aboutsummaryrefslogtreecommitdiffstats
path: root/main/fping/musl-ipv6-icmp-workaround.patch
blob: d19e996e464f671c3d753c10502c9e7ef879ed40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--- ./src/socket6.c.orig	2015-02-02 09:46:48.588456281 -0100
+++ ./src/socket6.c	2015-02-02 09:54:59.444873165 -0100
@@ -44,18 +44,18 @@
 int open_ping_socket_ipv6()
 {
     struct protoent *proto;
-    int opton = 1;
+    int protonum = 58;
     int s;
 
     /* confirm that ICMP is available on this machine */
-    if( ( proto = getprotobyname( "ipv6-icmp" ) ) == NULL ) 
-        crash_and_burn( "icmp: unknown protocol" );
+    if( ( proto = getprotobyname( "ipv6-icmp" ) ) != NULL )
+	protonum = proto->p_proto;
 
     /* create raw socket for ICMP calls (ping) */
-    s = socket( AF_INET6, SOCK_RAW, proto->p_proto );
+    s = socket( AF_INET6, SOCK_RAW, protonum );
     if( s < 0 ) {
-        /* try non-privileged icmp (works on Mac OSX without privileges, for example) */
-        s = socket( AF_INET6, SOCK_DGRAM, proto->p_proto );
+        /* try non-privileged icmp (works on Ma OSX without privileges, for example) */
+        s = socket( AF_INET6, SOCK_DGRAM, protonum );
         if( s < 0 ) {
             errno_crash_and_burn( "can't create raw socket (must run as root?)" );
         }