On 05/10/13 09:08, Martin Pieuchot wrote:
> The diff below prevents libdnet to issue an unneeded SIOCSIFNETMASK
> ioctl(2) prior to SIOCSIFADDR.
>
> I'd like to commit this change because I'm about to change the behavior
> of the SIOCSIFNETMASK and SIOCSIFDSTMASK ioctl(2)s in such way that they
> will fail if the interface has no previous configured IPv4 address.
>
> This port is the only one that I've seen that makes an incorrect use of
> this ioctl(2)s, if you are aware of another, please let me know.
>
I think that this is needed as well, nmap uses its own modified libdnet.
Cheers
Giovanni
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/nmap/Makefile,v
retrieving revision 1.106
diff -u -p -u -p -r1.106 Makefile
--- Makefile 11 Mar 2013 11:35:50 -0000 1.106
+++ Makefile 10 May 2013 07:56:39 -0000
@@ -6,6 +6,7 @@ COMMENT-zenmap= graphical frontend for n
MODPY_EGG_VERSION= 6.25
DISTNAME= nmap-${MODPY_EGG_VERSION}
PKGNAME-main= ${DISTNAME}
+REVISION-main= 0
PKGNAME-zenmap= nmap-zenmap-${MODPY_EGG_VERSION}
CATEGORIES= net security
Index: patches/patch-libdnet-stripped_src_intf_c
===================================================================
RCS file: /cvs/ports/net/nmap/patches/patch-libdnet-stripped_src_intf_c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-libdnet-stripped_src_intf_c
--- patches/patch-libdnet-stripped_src_intf_c 19 Dec 2012 17:12:11 -0000 1.2
+++ patches/patch-libdnet-stripped_src_intf_c 10 May 2013 07:56:39 -0000
@@ -1,6 +1,6 @@
$OpenBSD: patch-libdnet-stripped_src_intf_c,v 1.2 2012/12/19 17:12:11 giovanni Exp $
--- libdnet-stripped/src/intf.c.orig Mon Sep 10 03:17:28 2012
-+++ libdnet-stripped/src/intf.c Fri Nov 30 12:41:47 2012
++++ libdnet-stripped/src/intf.c Fri May 10 09:54:54 2013
@@ -77,7 +77,13 @@
/* XXX - superset of ifreq, for portable SIOC{A,D}IFADDR */
struct dnet_ifaliasreq {
@@ -16,3 +16,12 @@ $OpenBSD: patch-libdnet-stripped_src_int
struct sockaddr ifra_brdaddr;
struct sockaddr ifra_mask;
int ifra_cookie; /* XXX - IRIX!@#$ */
+@@ -308,7 +314,7 @@ intf_set(intf_t *intf, const struct intf_entry *entry)
+ }
+ /* Set interface address. */
+ if (entry->intf_addr.addr_type == ADDR_TYPE_IP) {
+-#ifdef BSD
++#if definet(BSD) && !defined(__OpenBSD__)
+ /* XXX - why must this happen before SIOCSIFADDR? */
+ if (addr_btos(entry->intf_addr.addr_bits,
+ &ifr.ifr_addr) == 0) {