diff --git a/usr.sbin/pppd/Makefile.inc b/usr.sbin/pppd/Makefile.inc index 50beab00fc6a..a6386e42e7d9 100644 --- a/usr.sbin/pppd/Makefile.inc +++ b/usr.sbin/pppd/Makefile.inc @@ -1,9 +1,11 @@ -# $NetBSD: Makefile.inc,v 1.3 2006/05/11 07:17:41 mrg Exp $ +# $NetBSD: Makefile.inc,v 1.4 2007/05/27 18:11:38 tls Exp $ .if exists(${.CURDIR}/../../Makefile.inc) .include "${.CURDIR}/../../Makefile.inc" .endif +USE_FORT?=yes # network client/server + .include .if ${HAVE_GCC} == 4 diff --git a/usr.sbin/pppd/pppd/sys-bsd.c b/usr.sbin/pppd/pppd/sys-bsd.c index f8dcbc105049..a3798a069eed 100644 --- a/usr.sbin/pppd/pppd/sys-bsd.c +++ b/usr.sbin/pppd/pppd/sys-bsd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sys-bsd.c,v 1.55 2006/01/29 17:52:38 christos Exp $ */ +/* $NetBSD: sys-bsd.c,v 1.56 2007/05/27 18:11:38 tls Exp $ */ /* * sys-bsd.c - System-dependent procedures for setting up @@ -79,7 +79,7 @@ #if 0 #define RCSID "Id: sys-bsd.c,v 1.47 2000/04/13 12:04:23 paulus Exp " #else -__RCSID("$NetBSD: sys-bsd.c,v 1.55 2006/01/29 17:52:38 christos Exp $"); +__RCSID("$NetBSD: sys-bsd.c,v 1.56 2007/05/27 18:11:38 tls Exp $"); #endif #endif @@ -1803,16 +1803,24 @@ get_ether_addr(u_int32_t ipaddr, struct sockaddr_dl *hwaddr) int get_if_hwaddr(u_char *addr, char *name) { - struct ifreq ifreq; - struct sockaddr_dl *sdl = (struct sockaddr_dl *) &ifreq.ifr_addr; + +#define IFREQ_SAFE (sizeof(struct ifreq) + sizeof(struct sockaddr_dl)) + /* XXX sockaddr_dl is larger than the sockaddr in struct ifreq! */ + union { /* XXX */ + struct ifreq _ifreq; /* XXX */ + char _X[IFREQ_SAFE]; /* XXX */ + } _ifreq_dontsmashstack; /* XXX */ +#define ifreq_xxx _ifreq_dontsmashstack._ifreq /* XXX */ + + struct sockaddr_dl *sdl = (struct sockaddr_dl *) &ifreq_xxx.ifr_addr; int fd; if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) return 0; (void)memset(sdl, 0, sizeof(*sdl)); sdl->sdl_family = AF_LINK; - (void)strlcpy(ifreq.ifr_name, name, sizeof(ifreq.ifr_name)); - if (ioctl(fd, SIOCGIFADDR, &ifreq) == -1) { + (void)strlcpy(ifreq_xxx.ifr_name, name, sizeof(ifreq_xxx.ifr_name)); + if (ioctl(fd, SIOCGIFADDR, &ifreq_xxx) == -1) { (void)close(fd); return 0; }