pkgsrc/net/vpnc/patches/patch-bd
is 678f7cecd9 -back out HAVE_GETLINE, so that this builds on pre-5.99 NetBSD
-patch replacement getline() to be of type ssize_t, so that this builds
 on NetBSD >=5.99
Problem reported by Matthias Kretschmer and Luca Sironi; first part of
fix by Matthias, too.
2011-05-18 12:28:50 +00:00

43 lines
1 KiB
Text

$NetBSD: patch-bd,v 1.2 2011/05/18 12:28:50 is Exp $
--- sysdep.c.orig 2008-11-19 20:36:12.000000000 +0000
+++ sysdep.c
@@ -666,7 +666,7 @@ int tun_get_hwaddr(int fd, char *dev, ui
}
return 0;
-#elif defined(SIOCGIFHWADDR)
+#elif defined(SIOCGIFHWADDR) || defined(SIOCGENADDR)
struct ifreq ifr;
/* Use a new socket fd! */
@@ -677,11 +677,20 @@ int tun_get_hwaddr(int fd, char *dev, ui
memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+#if defined(SIOCGIFHWADDR) && !defined(__sun)
if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) {
return -1;
}
memcpy(hwaddr, &ifr.ifr_hwaddr.sa_data, ETH_ALEN);
+#endif
+#if defined(SIOCGENADDR)
+ if (ioctl(fd, SIOCGENADDR, &ifr) < 0) {
+ return -1;
+ }
+
+ memcpy(hwaddr, &ifr.ifr_enaddr, ETH_ALEN);
+#endif
return 0;
#else
@@ -751,7 +760,7 @@ void error(int status, int errornum, con
#endif
#ifndef HAVE_GETLINE
-int getline(char **line, size_t * length, FILE * stream)
+ssize_t getline(char **line, size_t * length, FILE * stream)
{
size_t len;
#ifdef HAVE_FGETLN