View | Details | Raw Unified | Return to bug 264402
Collapse All | Expand All

(-)b/net/fping/Makefile (-1 / +1 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	fping
3
PORTNAME=	fping
4
PORTVERSION=	5.0
4
PORTVERSION=	5.0
5
PORTREVISION=	1
5
PORTREVISION=	2
6
CATEGORIES=	net
6
CATEGORIES=	net
7
MASTER_SITES=	http://fping.org/dist/ \
7
MASTER_SITES=	http://fping.org/dist/ \
8
		https://github.com/schweikert/${PORTNAME}/releases/download/v${PORTVERSION}/
8
		https://github.com/schweikert/${PORTNAME}/releases/download/v${PORTVERSION}/
(-)b/net/fping/files/patch-fping.c (+23 lines)
Lines 14-16 Link Here
14
         socket_set_src_addr_ipv6(socket6, &src_addr6, (socktype6 == SOCK_DGRAM) ? &ident6 : NULL);
14
         socket_set_src_addr_ipv6(socket6, &src_addr6, (socktype6 == SOCK_DGRAM) ? &ident6 : NULL);
15
     }
15
     }
16
 #endif
16
 #endif
17
@@ -2299,6 +2299,22 @@ int wait_for_reply(int64_t wait_time)
18
 #endif
19
     else {
20
         return 1;
21
+    }
22
+
23
+    /* Check that src address is one of the hosts we pinged before */
24
+    int found = 0;
25
+    for (int i = 0; i < num_hosts; i++) {
26
+        HOST_ENTRY *h = table[i];
27
+        if (!addr_cmp((struct sockaddr*)&response_addr, (struct sockaddr*)&h->saddr)) {
28
+            found = 1;
29
+            break;
30
+        }
31
+    }
32
+    if (!found) {
33
+        // char buf[INET6_ADDRSTRLEN];
34
+        // getnameinfo((struct sockaddr*)&response_addr, sizeof(response_addr), buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
35
+        // fprintf(stderr, "ignoring response from %s\n", buf);
36
+        return 1; /* packet received, but not from a host we pinged */        
37
     }
38
 
39
     seqmap_value = seqmap_fetch(seq, current_time_ns);

Return to bug 264402