Update to 1.05; fixes regress test for netmask and mac address detection.
from Mikolaj Kucharsk, thanks!
This commit is contained in:
parent
c9db012489
commit
35274f1c96
@ -1,12 +1,11 @@
|
||||
# $OpenBSD: Makefile,v 1.9 2010/07/12 22:07:39 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.10 2010/08/30 03:48:17 kevlo Exp $
|
||||
|
||||
SHARED_ONLY= Yes
|
||||
|
||||
COMMENT= module for access to network card configuration information
|
||||
|
||||
MODULES= cpan
|
||||
DISTNAME= IO-Interface-1.02
|
||||
REVISION= 0
|
||||
DISTNAME= IO-Interface-1.05
|
||||
CATEGORIES= net
|
||||
|
||||
MAINTAINER= Kevin Lo <kevlo@openbsd.org>
|
||||
|
@ -1,5 +1,5 @@
|
||||
MD5 (IO-Interface-1.02.tar.gz) = /5b5j1K2js6IqOQOKSBx0g==
|
||||
RMD160 (IO-Interface-1.02.tar.gz) = irvOLpxPkVcdZkiHZ8/2w2frmbY=
|
||||
SHA1 (IO-Interface-1.02.tar.gz) = H72ejBXdzPuwCgC1t+Ha5AtYgNo=
|
||||
SHA256 (IO-Interface-1.02.tar.gz) = DiTSxOoQpFuJm8tvYDMx4p3EmXsJwsS0KbnipEofodA=
|
||||
SIZE (IO-Interface-1.02.tar.gz) = 9507
|
||||
MD5 (IO-Interface-1.05.tar.gz) = CsLmusTThaATVazqi2GQzA==
|
||||
RMD160 (IO-Interface-1.05.tar.gz) = VA3lQxHiRhnnSBFqWVxA79PbMyk=
|
||||
SHA1 (IO-Interface-1.05.tar.gz) = WxlVGPvYcXWlvExx1Cai42C5n5g=
|
||||
SHA256 (IO-Interface-1.05.tar.gz) = 3KHnUobc6ZP5sG1NTQ3B98y52zMXSPTu165Y/FFs6Vc=
|
||||
SIZE (IO-Interface-1.05.tar.gz) = 10219
|
||||
|
@ -1,67 +1,75 @@
|
||||
$OpenBSD: patch-Interface_xs,v 1.1 2006/01/11 20:12:45 steven Exp $
|
||||
--- Interface.xs.orig Wed Jan 11 08:24:31 2006
|
||||
+++ Interface.xs Wed Jan 11 08:25:51 2006
|
||||
@@ -317,7 +317,7 @@ not_there:
|
||||
return 0;
|
||||
}
|
||||
|
||||
NetBSD and OpenBSD don't set the address family on the "netmask" address.
|
||||
Work around that by just setting the address family field after ioctl() and
|
||||
before checking it.
|
||||
|
||||
if_hwaddr() was broken, code looping all interfaces was causing segmentation
|
||||
fault on freeifaddrs()
|
||||
|
||||
$OpenBSD: patch-Interface_xs,v 1.2 2010/08/30 03:48:17 kevlo Exp $
|
||||
--- Interface.xs.orig Fri Jun 6 16:51:42 2008
|
||||
+++ Interface.xs Sun Aug 29 01:53:48 2010
|
||||
@@ -2,6 +2,9 @@
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
|
||||
-int Ioctl (InputStream sock,int operation,void* result) {
|
||||
+int Ioctl (InputStream sock,unsigned long operation,void* result) {
|
||||
int fd = PerlIO_fileno(sock);
|
||||
return ioctl(fd,operation,result) == 0;
|
||||
}
|
||||
@@ -383,7 +383,7 @@ if_addr(sock, name, ...)
|
||||
PROTOTYPE: $$;$
|
||||
PREINIT:
|
||||
STRLEN len;
|
||||
- int operation;
|
||||
+ unsigned long operation;
|
||||
struct ifreq ifr;
|
||||
char* newaddr;
|
||||
CODE:
|
||||
@@ -421,7 +421,7 @@ if_broadcast(sock, name, ...)
|
||||
PROTOTYPE: $$;$
|
||||
PREINIT:
|
||||
STRLEN len;
|
||||
- int operation;
|
||||
+ unsigned long operation;
|
||||
struct ifreq ifr;
|
||||
char* newaddr;
|
||||
CODE:
|
||||
@@ -455,7 +455,7 @@ if_netmask(sock, name, ...)
|
||||
PROTOTYPE: $$;$
|
||||
PREINIT:
|
||||
STRLEN len;
|
||||
- int operation;
|
||||
+ unsigned long operation;
|
||||
+#include <stdio.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
/* socket definitions */
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -511,6 +514,9 @@ if_netmask(sock, name, ...)
|
||||
operation = SIOCGIFNETMASK;
|
||||
}
|
||||
if (!Ioctl(sock,operation,&ifr)) XSRETURN_UNDEF;
|
||||
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
+ ifr.ifr_addr.sa_family = AF_INET;
|
||||
+#endif
|
||||
if (ifr.ifr_addr.sa_family != AF_INET) croak ("Address is not in the AF_INET family.\n");
|
||||
RETVAL = inet_ntoa(((struct sockaddr_in*) &ifr.ifr_addr)->sin_addr);
|
||||
#endif
|
||||
@@ -566,7 +572,7 @@ if_hwaddr(sock, name, ...)
|
||||
IOCTL_CMD_T operation;
|
||||
struct ifreq ifr;
|
||||
char* newaddr;
|
||||
CODE:
|
||||
@@ -489,7 +489,7 @@ if_dstaddr(sock, name, ...)
|
||||
PROTOTYPE: $$;$
|
||||
PREINIT:
|
||||
STRLEN len;
|
||||
- int operation;
|
||||
+ unsigned long operation;
|
||||
struct ifreq ifr;
|
||||
char* newaddr;
|
||||
CODE:
|
||||
@@ -523,7 +523,7 @@ if_hwaddr(sock, name, ...)
|
||||
PROTOTYPE: $$;$
|
||||
PREINIT:
|
||||
STRLEN len;
|
||||
- int operation;
|
||||
+ unsigned long operation;
|
||||
struct ifreq ifr;
|
||||
char *newaddr,hwaddr[128];
|
||||
CODE:
|
||||
@@ -555,7 +555,8 @@ if_flags(sock, name, ...)
|
||||
char* name
|
||||
PROTOTYPE: $$;$
|
||||
PREINIT:
|
||||
- int operation,flags;
|
||||
+ unsigned long operation;
|
||||
+ int flags;
|
||||
struct ifreq ifr;
|
||||
CODE:
|
||||
{
|
||||
#if (defined(USE_GETIFADDRS) && defined(HAVE_SOCKADDR_DL_STRUCT))
|
||||
- struct ifaddrs* ifap = NULL;
|
||||
+ struct ifaddrs *ifap, *ifa;
|
||||
struct sockaddr_dl* sdl;
|
||||
sa_family_t family;
|
||||
char *sdlname, *haddr, *s;
|
||||
@@ -582,20 +588,17 @@ if_hwaddr(sock, name, ...)
|
||||
#if (defined(USE_GETIFADDRS) && defined(HAVE_SOCKADDR_DL_STRUCT))
|
||||
getifaddrs(&ifap);
|
||||
|
||||
- while(1) {
|
||||
- if (ifap == NULL) break;
|
||||
- if (strncmp(name, ifap -> ifa_name, IFNAMSIZ) == 0) {
|
||||
- family = ifap -> ifa_addr -> sa_family;
|
||||
+ for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
|
||||
+ if (strncmp(name, ifa->ifa_name, IFNAMSIZ) == 0) {
|
||||
+ family = ifa->ifa_addr->sa_family;
|
||||
if (family == AF_LINK) {
|
||||
- sdl = (struct sockaddr_dl *) ifap->ifa_addr;
|
||||
+ sdl = (struct sockaddr_dl *) ifa->ifa_addr;
|
||||
haddr = sdl->sdl_data + sdl->sdl_nlen;
|
||||
hlen = sdl->sdl_alen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
- ifap = ifap -> ifa_next;
|
||||
}
|
||||
- freeifaddrs(ifap);
|
||||
|
||||
s = hwaddr;
|
||||
s[0] = '\0';
|
||||
@@ -608,6 +611,9 @@ if_hwaddr(sock, name, ...)
|
||||
s += len;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ freeifaddrs(ifap);
|
||||
+
|
||||
RETVAL = hwaddr;
|
||||
#elif (defined(HAS_IOCTL) && defined(SIOCGIFHWADDR))
|
||||
bzero((void*)&ifr,sizeof(struct ifreq));
|
||||
|
Loading…
Reference in New Issue
Block a user