mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Fix rt_msghdr padding on NetBSD.
NetBSD uses a fixed 64-bit padding, unlike OS X (32-bit), and unlike other platforms (sizeof(unsigned long)). There is an RT_ROUNDUP macro that does the right alignment; use that when available. http://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/lib/libc/net/getifaddrs.c http://fxr.watson.org/fxr/source/net/route.h?v=NETBSD#L270 Rounding to 4 bytes was breaking with IPv6 addresses, which are 28 bytes. The pointer was being advanced by 28 instead of 32. Compare to r29739, somewhat similar. Reported by Fredrik Pettai. http://seclists.org/nmap-dev/2013/q1/384
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# Nmap Changelog ($Id$); -*-text-*-
|
||||||
|
|
||||||
|
o Fixed IPv6 routing table alignment on NetBSD.
|
||||||
|
|
||||||
o [NSE] Added http-phpmyadmin-dir-traversal by Alexey Meshcheryakov.
|
o [NSE] Added http-phpmyadmin-dir-traversal by Alexey Meshcheryakov.
|
||||||
|
|
||||||
o Added a service probe for Erlang distribution nodes.
|
o Added a service probe for Erlang distribution nodes.
|
||||||
|
|||||||
@@ -1887,3 +1887,26 @@ index 4fe059c..184c077 100644
|
|||||||
/* XXX - why must this happen before SIOCSIFADDR? */
|
/* XXX - why must this happen before SIOCSIFADDR? */
|
||||||
if (addr_btos(entry->intf_addr.addr_bits,
|
if (addr_btos(entry->intf_addr.addr_bits,
|
||||||
&ifr.ifr_addr) == 0) {
|
&ifr.ifr_addr) == 0) {
|
||||||
|
|
||||||
|
o Use the RT_ROUNDUP preprocessor macro for 64-bit rt_msghdr alignment
|
||||||
|
on NetBSD.
|
||||||
|
|
||||||
|
diff --git a/libdnet-stripped/src/route-bsd.c b/libdnet-stripped/src/route-bsd.c
|
||||||
|
index 44e7dd2..47f3705 100644
|
||||||
|
--- a/libdnet-stripped/src/route-bsd.c
|
||||||
|
+++ b/libdnet-stripped/src/route-bsd.c
|
||||||
|
@@ -47,8 +47,14 @@
|
||||||
|
|
||||||
|
#include "dnet.h"
|
||||||
|
|
||||||
|
+#ifdef RT_ROUNDUP
|
||||||
|
+/* NetBSD defines this macro rounding to 64-bit boundaries.
|
||||||
|
+ http://fxr.watson.org/fxr/ident?v=NETBSD;i=RT_ROUNDUP */
|
||||||
|
+#define ROUNDUP(a) RT_ROUNDUP(a)
|
||||||
|
+#else
|
||||||
|
#define ROUNDUP(a) \
|
||||||
|
((a) > 0 ? (1 + (((a) - 1) | (RT_MSGHDR_ALIGNMENT - 1))) : RT_MSGHDR_ALIGNMENT)
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||||
|
#define NEXTSA(s) \
|
||||||
|
|||||||
@@ -47,8 +47,14 @@
|
|||||||
|
|
||||||
#include "dnet.h"
|
#include "dnet.h"
|
||||||
|
|
||||||
|
#ifdef RT_ROUNDUP
|
||||||
|
/* NetBSD defines this macro rounding to 64-bit boundaries.
|
||||||
|
http://fxr.watson.org/fxr/ident?v=NETBSD;i=RT_ROUNDUP */
|
||||||
|
#define ROUNDUP(a) RT_ROUNDUP(a)
|
||||||
|
#else
|
||||||
#define ROUNDUP(a) \
|
#define ROUNDUP(a) \
|
||||||
((a) > 0 ? (1 + (((a) - 1) | (RT_MSGHDR_ALIGNMENT - 1))) : RT_MSGHDR_ALIGNMENT)
|
((a) > 0 ? (1 + (((a) - 1) | (RT_MSGHDR_ALIGNMENT - 1))) : RT_MSGHDR_ALIGNMENT)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||||
#define NEXTSA(s) \
|
#define NEXTSA(s) \
|
||||||
|
|||||||
Reference in New Issue
Block a user