diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 1996-11-18 21:53:23 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 1996-11-18 21:53:23 +0000 |
commit | 30aa8d532d067d2b1f531013846e367046679c4a (patch) | |
tree | 6a1156abc5c2f9f12f05ca18154532e726b0cc60 | |
parent | 4bef56e86cab1150c0420ea535673f41244fa622 (diff) |
This commit was manufactured by cvs2svn to create tag 'rarpd_1_1'.vendor/rarpd/1.1
Notes
Notes:
svn path=/cvs2svn/branches/LBL/; revision=19855
svn path=/cvs2svn/tags/rarpd_1_1/; revision=19858; tag=vendor/rarpd/1.1
-rw-r--r-- | usr.sbin/rarpd/ether_addr.c | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/usr.sbin/rarpd/ether_addr.c b/usr.sbin/rarpd/ether_addr.c deleted file mode 100644 index 197c15715562..000000000000 --- a/usr.sbin/rarpd/ether_addr.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * rarpd support routines - * - * Written by Bill Paul <wpaul@ctr.columbia.edu> - * Center for Telecommunications Research - * Columbia University, New York City - * - * This code is public domain. There is no copyright. There are no - * distribution or usage restrictions. There are no strings attached. - * - * Have a party. - * - * $Id$ - */ - - -#include <stdio.h> - -#ifndef _PATH_ETHERS -#define _PATH_ETHERS "/etc/ethers" -#endif - -/* - * This should be defined in <netinet/if_ether.h> but it isn't. - */ -struct ether_addr { - unsigned char octet[6]; -}; - -/* - * Parse a string of text containing an ethernet address and hostname - * and separate it into its component parts. - */ -int ether_line(l, e, hostname) - char *l; - struct ether_addr *e; - char *hostname; -{ - int i, o[6]; - - i = sscanf(l, "%x:%x:%x:%x:%x:%x %s", &o[0], &o[1], &o[2], - &o[3], &o[4], &o[5], - hostname); - if (i != 7) - return (-1); - - for (i=0; i<6; i++) - e->octet[i] = o[i]; - return (0); -} - -/* - * Map an ethernet address to a hostname. Use either /etc/ethers or - * NIS/YP. - */ - -int ether_ntohost(hostname, e) - char *hostname; - struct ether_addr *e; -{ - FILE *fp; - static char buf[BUFSIZ]; - static struct ether_addr local_ether; - static char *local_host; - static char *result; - int resultlen, i; - extern int yp_get_default_domain(); - extern int yp_match(); - static char *yp_domain; - static char ether_a[BUFSIZ]; - - if ((fp = fopen(_PATH_ETHERS, "r")) == NULL) { - perror(_PATH_ETHERS); - return (-1); - } - - while (fgets(buf,BUFSIZ,fp)) { - if (buf[0] == '+') { - if (yp_get_default_domain(&yp_domain)) - return(-1); - sprintf(ether_a,"%x:%x:%x:%x:%x:%x", - e->octet[0], e->octet[1], - e->octet[2], e->octet[3], - e->octet[4], e->octet[5]); - if (yp_match(yp_domain, "ethers.byaddr", ether_a, - strlen(ether_a),&result, &resultlen)) - return(-1); - if (ether_line(result, &local_ether, - &local_host) == 0) { - strcpy(hostname, (char *)&local_host); - return(0); - } else - return(-1); - } - if (ether_line(&buf, &local_ether, &local_host) == 0) { - for (i = 0; i < 6; i++) - if (local_ether.octet[i] != e->octet[i]) - goto nomatch; - /* We have a match */ - strcpy(hostname, (char *)&local_host); - fclose(fp); - return(0); - } -nomatch: - } - -return (-1); -} |