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.

Ok?

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/net/libdnet/Makefile,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile
--- Makefile    21 Mar 2013 08:46:34 -0000      1.36
+++ Makefile    8 May 2013 14:38:10 -0000
@@ -7,7 +7,7 @@ MODPY_EGG_VERSION= 1.12
 DISTNAME=      libdnet-${MODPY_EGG_VERSION}
 PKGNAME-main=  ${DISTNAME}
 PKGNAME-python= py-${DISTNAME}
-REVISION=      6
+REVISION=      7
 
 SHARED_LIBS=   dnet    1.0
 
Index: patches/patch-src_intf_c
===================================================================
RCS file: /home/ncvs/ports/net/libdnet/patches/patch-src_intf_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_intf_c
--- patches/patch-src_intf_c    16 Nov 2012 17:05:13 -0000      1.1
+++ patches/patch-src_intf_c    8 May 2013 14:38:10 -0000
@@ -1,6 +1,10 @@
 $OpenBSD: patch-src_intf_c,v 1.1 2012/11/16 17:05:13 sthen Exp $
---- src/intf.c.orig    Wed Nov 14 04:15:30 2012
-+++ src/intf.c Wed Nov 14 04:16:33 2012
+
+Do not issue an SIOCSIFNETMASK before SIOCSIFADDR it is not
+needed even if the XXX says otherwise.
+
+--- src/intf.c.orig    Mon Jan  9 08:09:49 2006
++++ src/intf.c Thu Apr 11 16:16:02 2013
 @@ -66,7 +66,13 @@
  /* XXX - superset of ifreq, for portable SIOC{A,D}IFADDR */
  struct dnet_ifaliasreq {
@@ -16,3 +20,12 @@ $OpenBSD: patch-src_intf_c,v 1.1 2012/11
        struct sockaddr ifra_brdaddr;
        struct sockaddr ifra_mask;
        int             ifra_cookie;    /* XXX - IRIX!@#$ */
+@@ -281,7 +287,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 defined(BSD) && !defined(__OpenBSD__)
+               /* XXX - why must this happen before SIOCSIFADDR? */
+               if (addr_btos(entry->intf_addr.addr_bits,
+                   &ifr.ifr_addr) == 0) {

Reply via email to