$OpenBSD: patch-src_fping_c,v 1.7 2019/03/31 00:09:09 sthen Exp $
Index: src/fping.c
--- src/fping.c.orig
+++ src/fping.c
@@ -352,6 +352,9 @@ int main(int argc, char** argv)
     HOST_ENTRY* cursor;
     struct optparse optparse_state;
 
+    if (pledge("stdio inet rpath dns id", NULL) == -1)
+        perror("pledge");
+
     /* pre-parse -h/--help, so that we also can output help information
      * without trying to open the socket, which might fail */
     prog = argv[0];
@@ -376,6 +379,10 @@ int main(int argc, char** argv)
     }
 
     optparse_init(&optparse_state, argv);
+
+    if (pledge("stdio inet rpath dns", NULL) == -1)
+        perror("pledge");
+
     ident = getpid() & 0xFFFF;
     verbose_flag = 1;
     backoff_flag = 1;
@@ -710,6 +717,11 @@ int main(int argc, char** argv)
         }
     }
 
+    if (!filename) { /* drop rpath if not reading addrs from file */
+        if (pledge("stdio inet dns", NULL) == -1)
+            perror("pledge");
+    }
+
     /* validate various option settings */
 
 #ifndef IPV6
@@ -962,6 +974,10 @@ int main(int argc, char** argv)
         exit(num_noaddress ? 2 : 1);
     }
 
+    /* done with file and dns/rdns lookups */
+    if (pledge("stdio inet", NULL) == -1)
+        perror("pledge");
+
     if (src_addr_set && socket4 >= 0) {
         socket_set_src_addr_ipv4(socket4, &src_addr);
     }
@@ -1831,7 +1847,7 @@ int decode_icmp_ipv4(
     struct icmp* icp;
     int hlen = 0;
 
-#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__)
+#if defined(__alpha__) && __STDC__ && !defined(__GLIBC__) && !defined(__OpenBSD__)
     /* The alpha headers are decidedly broken.
      * Using an ANSI compiler, it provides ip_vhl instead of ip_hl and
      * ip_v.  So, to get ip_hl, we mask off the bottom four bits.
