diff options
| author | Paul Traina <pst@FreeBSD.org> | 1996-01-23 01:35:04 +0000 |
|---|---|---|
| committer | Paul Traina <pst@FreeBSD.org> | 1996-01-23 01:35:04 +0000 |
| commit | e08ac58bbe2be2817736b8f4b32c75f8d55359df (patch) | |
| tree | 145d6ce072fde2eeda7863a006d92fd2c1eec916 /libexec/bootpd/getether.c | |
| parent | a270abb407a717b6c38a10d1c996af9ac907f84a (diff) | |
Notes
Diffstat (limited to 'libexec/bootpd/getether.c')
| -rw-r--r-- | libexec/bootpd/getether.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libexec/bootpd/getether.c b/libexec/bootpd/getether.c index 724a3767d3a7..a96a4bb1b2ae 100644 --- a/libexec/bootpd/getether.c +++ b/libexec/bootpd/getether.c @@ -11,9 +11,14 @@ #include <sys/types.h> #include <sys/socket.h> +#ifndef NO_UNISTD +#include <unistd.h> +#endif + #include <ctype.h> #include <syslog.h> +#include "getether.h" #include "report.h" #define EALEN 6 @@ -101,7 +106,7 @@ getether(ifname, eap) #endif /* SUNOS */ -#if defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__386BSD__) || defined(__NetBSD__) /* Thanks to John Brezak <brezak@ch.hp.com> for this code. */ #include <sys/ioctl.h> #include <net/if.h> @@ -168,10 +173,12 @@ getether(ifname, eap) #include <sys/sockio.h> #include <sys/dlpi.h> #include <stropts.h> +#include <string.h> #ifndef NULL #define NULL 0 #endif +int getether(ifname, eap) char *ifname; /* interface name from ifconfig structure */ char *eap; /* Ether address (output) */ @@ -308,30 +315,31 @@ getether(ifname, eap) #endif /* SVR4 */ -#ifdef linux +#ifdef __linux__ /* * This is really easy on Linux! This version (for linux) - * written by Nigel Metheringham <nigelm@ohm.york.ac.uk> + * written by Nigel Metheringham <nigelm@ohm.york.ac.uk> and + * updated by Pauline Middelink <middelin@polyware.iaf.nl> * * The code is almost identical to the Ultrix code - however * the names are different to confuse the innocent :-) * Most of this code was stolen from the Ultrix bit above. */ +#include <memory.h> #include <sys/ioctl.h> #include <net/if.h> /* struct ifreq */ +#include <sys/socketio.h> /* Needed for IOCTL defs */ -/* In a properly configured system this should be either sys/socketio.h - or sys/sockios.h, but on my distribution these don't line up correctly */ -#include <linux/sockios.h> /* Needed for IOCTL defs */ - +int getether(ifname, eap) char *ifname, *eap; { int rc = -1; int fd; struct ifreq phys; - bzero(&phys, sizeof(phys)); + + memset(&phys, 0, sizeof(phys)); strcpy(phys.ifr_name, ifname); if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { report(LOG_ERR, "getether: socket(INET,DGRAM) failed"); @@ -340,7 +348,7 @@ getether(ifname, eap) if (ioctl(fd, SIOCGIFHWADDR, &phys) < 0) { report(LOG_ERR, "getether: ioctl SIOCGIFHWADDR failed"); } else { - bcopy(phys.ifr_hwaddr, eap, EALEN); + memcpy(eap, &phys.ifr_hwaddr.sa_data, EALEN); rc = 0; } close(fd); @@ -348,11 +356,12 @@ getether(ifname, eap) } #define GETETHER -#endif /* linux */ +#endif /* __linux__ */ /* If we don't know how on this system, just return an error. */ #ifndef GETETHER +int getether(ifname, eap) char *ifname, *eap; { |
