summaryrefslogtreecommitdiff
path: root/net/nmap/patches/patch-an
blob: 91fe62723dd1fc2f07416a0740dc8f867483e25b (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
28
29
30
31
32
33
34
35
36
$NetBSD: patch-an,v 1.2 2012/10/20 22:59:30 pettai Exp $

Fix for sa_len size problem on NetBSD
(See commit r29739 in nmap's svn for details)

Fix (build) for Solaris 10
(See commit r29672 in nmap's svn or PR pkg/47033)

--- libdnet-stripped/src/intf.c.orig	2012-05-24 03:59:25.000000000 +0000
+++ libdnet-stripped/src/intf.c
@@ -64,9 +64,10 @@
 #endif
 
 #ifdef HAVE_SOCKADDR_SA_LEN
-# define NEXTIFR(i)	((struct ifreq *)((u_char *)&i->ifr_addr + \
-				(i->ifr_addr.sa_len ? i->ifr_addr.sa_len : \
-				 sizeof(i->ifr_addr))))
+# define max(a, b) ((a) > (b) ? (a) : (b))
+# define NEXTIFR(i)	((struct ifreq *) \
+				max((u_char *)i + sizeof(struct ifreq), \
+				(u_char *)&i->ifr_addr + i->ifr_addr.sa_len))
 #else
 # define NEXTIFR(i)	(i + 1)
 #endif
@@ -954,9 +955,11 @@ intf_loop(intf_t *intf, intf_handler cal
 			;
 		else
 			return (-1);
+#ifdef IFF_IPMP
 		if (lifr->lifr_flags & IFF_IPMP) {
 			continue;
 		}
+#endif
 		
 		if (_intf_get_noalias(intf, entry) < 0)
 			return (-1);