Ethereal-dev: [ethereal-dev] Ethernet / manufacturer resolution

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Laurent Deniel <deniel@xxxxxxxxxxx>
Date: Mon, 21 Sep 1998 19:24:13 +0200
 Hi,

 The first attachment contains a diff to ethereal 0.3.16 that implements
 ethernet and manufacturer resolutions.
 The second attachment is the /etc/manuf file that should be distributed
 with ethereal.

 Laurent.

--
Laurent DENIEL            | E-mail: deniel@xxxxxxxxxxx
Paris, FRANCE             |         deniel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
                          | WWW   : http://www.worldnet.fr/~deniel
    All above opinions are personal, unless stated otherwise.
diff -u --recursive --new-file ethereal-0.3.16/AUTHORS ethereal-0.3.16-deniel/AUTHORS
--- ethereal-0.3.16/AUTHORS	Thu Sep 17 02:15:36 1998
+++ ethereal-0.3.16-deniel/AUTHORS	Mon Sep 21 08:30:34 1998
@@ -29,6 +29,7 @@
     http://www.worldnet.fr/~deniel
 
     Name resolution
+    Ethernet/Manufacturer files support
     ISO/OSI CLNP/COTP support
     Miscellaneous enhancements and fixes
 }
diff -u --recursive --new-file ethereal-0.3.16/packet-eth.c ethereal-0.3.16-deniel/packet-eth.c
--- ethereal-0.3.16/packet-eth.c	Wed Sep 16 03:22:13 1998
+++ ethereal-0.3.16-deniel/packet-eth.c	Mon Sep 21 08:30:34 1998
@@ -36,6 +36,7 @@
 #include "packet.h"
 #include "ethereal.h"
 #include "etypes.h"
+#include "resolv.h"
 
 /* These are the Netware-ish names for the different Ethernet frame types.
 	EthernetII: The ethernet with a Type field instead of a length field
@@ -59,8 +60,8 @@
   int   	ethhdr_type;	/* the type of ethernet frame */
 
   if (fd->win_info[0]) {
-    strcpy(fd->win_info[2], ether_to_str((guint8 *)&pd[0]));
-    strcpy(fd->win_info[1], ether_to_str((guint8 *)&pd[6]));
+    strcpy(fd->win_info[2], get_ether_name((u_char *)&pd[0]));
+    strcpy(fd->win_info[1], get_ether_name((u_char *)&pd[6]));
     strcpy(fd->win_info[4], "Ethernet II");
   }
 
@@ -92,10 +93,12 @@
 
       fh_tree = gtk_tree_new();
       add_subtree(ti, fh_tree, ETT_IEEE8023);
-      add_item_to_tree(fh_tree, 0, 6, "Destination: %s",
-        ether_to_str((guint8 *) &pd[0]));
-      add_item_to_tree(fh_tree, 6, 6, "Source: %s",
-        ether_to_str((guint8 *) &pd[6]));
+      add_item_to_tree(fh_tree, 0, 6, "Destination: %s (%s)",
+	ether_to_str((guint8 *) &pd[0]),
+        get_ether_name((u_char *) &pd[0]));
+      add_item_to_tree(fh_tree, 6, 6, "Source: %s (%s)",
+	ether_to_str((guint8 *) &pd[6]),
+	get_ether_name((u_char *)&pd[6]));
       add_item_to_tree(fh_tree, 12, 2, "Length: %d", length);
     }
 
@@ -105,10 +108,12 @@
       "Ethernet II (%d on wire, %d captured)", fd->pkt_len, fd->cap_len);
     fh_tree = gtk_tree_new();
     add_subtree(ti, fh_tree, ETT_ETHER2);
-    add_item_to_tree(fh_tree, 0, 6, "Destination: %s",
-      ether_to_str((guint8 *) &pd[0]));
-    add_item_to_tree(fh_tree, 6, 6, "Source: %s",
-      ether_to_str((guint8 *) &pd[6]));
+    add_item_to_tree(fh_tree, 0, 6, "Destination: %s (%s)",
+      ether_to_str((guint8 *) &pd[0]),
+      get_ether_name((u_char *)&pd[0]));
+    add_item_to_tree(fh_tree, 6, 6, "Source: %s (%s)",
+      ether_to_str((guint8 *) &pd[6]),
+      get_ether_name((u_char *)&pd[6]));
   }
 
 	/* either ethernet802.3 or ethernet802.2 */
diff -u --recursive --new-file ethereal-0.3.16/resolv.c ethereal-0.3.16-deniel/resolv.c
--- ethereal-0.3.16/resolv.c	Wed Sep 16 03:22:27 1998
+++ ethereal-0.3.16-deniel/resolv.c	Mon Sep 21 09:17:08 1998
@@ -23,14 +23,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- *
- *
- * To do:
- *
- * - Add ethernet address resolution
- * - In a future live capture and decode mode, 
- *   add hostname entries in hash table from DNS packet decoding.
- *
  */
 
 #ifdef HAVE_CONFIG_H
@@ -66,7 +58,10 @@
 #include "resolv.h"
 
 #define MAXNAMELEN  	64	/* max name length (hostname and port name) */
+#define MAXMANUFLEN	9	/* max vendor name length with ending '\0' */
+#define HASHETHSIZE	1024
 #define HASHHOSTSIZE	1024
+#define HASHMANUFSIZE   256
 #define HASHPORTSIZE	256
 
 /* hash table used for host and port lookup */
@@ -77,15 +72,50 @@
   struct hashname 	*next;
 } hashname_t;
 
-static hashname_t *host_table[HASHHOSTSIZE];
-static hashname_t *udp_port_table[HASHPORTSIZE];
-static hashname_t *tcp_port_table[HASHPORTSIZE];
+/* hash tables used for ethernet and manufacturer lookup */
+
+typedef struct hashmanuf {
+  u_char 		addr[3];
+  char 			name[MAXMANUFLEN];
+  struct hashmanuf     	*next;
+} hashmanuf_t;
+
+typedef struct hashether {
+  u_char 		addr[6];
+  char 			name[MAXNAMELEN];
+  struct hashether     	*next;
+} hashether_t;
+
+/* internal ethernet type */
+
+typedef struct _ether
+{
+  u_char		addr[6];
+  char 			name[MAXNAMELEN];
+} ether_t;
+
+static hashname_t 	*host_table[HASHHOSTSIZE];
+static hashname_t 	*udp_port_table[HASHPORTSIZE];
+static hashname_t 	*tcp_port_table[HASHPORTSIZE];
+static hashether_t 	*eth_table[HASHETHSIZE];
+static hashmanuf_t 	*manuf_table[HASHMANUFSIZE];
+
+static int 		eth_resolution_initialized = 0;
+
+/*
+ *  Global variables (can be changed in GUI sections)
+ */
 
-/* global variable that indicates if name resolving is actif */
+int g_resolving_actif = 1; 		/* routines are active by default */
 
-int g_resolving_actif = 1; 	/* routines are active by default */
+gchar *g_ethers_path  = EPATH_ETHERS;
+gchar *g_pethers_path = NULL; 		/* "$HOME"/EPATH_PERSONAL_ETHERS    */
+gchar *g_manuf_path   = EPATH_MANUF;	/* may only be changed before the   */
+					/* first resolving call        	    */
 
-/* local function definitions */
+/*
+ *  Local function definitions 
+ */
 
 static u_char *serv_name_lookup(u_int port, u_int proto)
 {
@@ -141,6 +171,7 @@
     sprintf(tp->name, "%d", port);
   } else {
     strncpy(tp->name, servp->s_name, MAXNAMELEN);
+    tp->name[MAXNAMELEN-1] = '\0';
   }
 
   return (tp->name);
@@ -190,9 +221,9 @@
   tp->next = NULL;
 
 #ifdef AVOID_DNS_TIMEOUT
-
+    
   /* Quick hack to avoid DNS/YP timeout */
-
+  
   if (!setjmp(hostname_env)) {
     signal(SIGALRM, abort_network_query);
     alarm(DNS_TIMEOUT);
@@ -203,6 +234,7 @@
 #endif
     if (hostp != NULL) {
       strncpy(tp->name, hostp->h_name, MAXNAMELEN);
+      tp->name[MAXNAMELEN-1] = '\0';
       return tp->name;
     }
 #ifdef AVOID_DNS_TIMEOUT
@@ -212,11 +244,412 @@
   /* unknown host or DNS timeout */
 
   sprintf(tp->name, "%s", ip_to_str((guint8 *)&addr));  
+
   return (tp->name);
 
 } /* host_name_lookup */
 
-/* external functions */
+/*
+ *  Miscellaneous functions
+ */
+
+static int fgetline(char **buf, int *size, FILE *fp)
+{
+  int len;
+  int c;
+
+  if (fp == NULL)
+    return -1;
+
+  if (*buf == NULL) {
+    if (*size == 0) 
+      *size = BUFSIZ;
+    
+    if ((*buf = g_malloc(*size)) == NULL)
+      return -1;
+  }
+
+  if (feof(fp))
+    return -1;
+    
+  len = 0;
+  while ((c = getc(fp)) != EOF && c != '\n') {
+    if (len+1 >= *size) {
+      if ((*buf = g_realloc(*buf, *size += BUFSIZ)) == NULL)
+	return -1;
+    }
+    (*buf)[len++] = c;
+  }
+
+  if (len == 0 && c == EOF)
+    return -1;
+    
+  (*buf)[len] = '\0';
+    
+  return len;
+
+} /* fgetline */
+
+
+/*
+ * Ethernet / manufacturer resolution
+ *
+ * The following functions implement ethernet address resolution and
+ * ethers files parsing (see ethers(4)). 
+ *
+ * /etc/manuf has the same format as ethers(4) except that names are 
+ * truncated to MAXMANUFLEN-1 characters and that an address contains 
+ * only 3 bytes (instead of 6).
+ *
+ * Notes:
+ *
+ * I decide to not use the existing functions (see ethers(3) on some 
+ * operating systems) for the following reasons:
+ * - performance gains (use of hash tables and some other enhancements),
+ * - use of two ethers files (system-wide and per user),
+ * - avoid the use of NIS maps,
+ * - lack of these functions on some systems.
+ *
+ * So the following functions do _not_ behave as the standard ones.
+ *
+ * -- Laurent.
+ */
+
+
+static int parse_ether_line(char *line, ether_t *eth, int six_bytes)
+{
+  /*
+   *  See man ethers(4) for /etc/ethers file format
+   *  (not available on all systems).
+   *  We allow both ethernet address separators (':' and '-').
+   */
+
+  gchar *cp;
+  int a0, a1, a2, a3, a4, a5;
+    
+  if ((cp = strchr(line, '#')))
+    *cp = '\0';
+  
+  if ((cp = strtok(line, " \t\n")) == NULL)
+    return -1;
+
+  if (six_bytes) {
+    if (sscanf(cp, "%x:%x:%x:%x:%x:%x", &a0, &a1, &a2, &a3, &a4, &a5) != 6) {
+      if (sscanf(cp, "%x-%x-%x-%x-%x-%x", &a0, &a1, &a2, &a3, &a4, &a5) != 6)
+	return -1;
+    }
+  } else {
+    if (sscanf(cp, "%x:%x:%x", &a0, &a1, &a2) != 3) {
+      if (sscanf(cp, "%x-%x-%x", &a0, &a1, &a2) != 3)
+	return -1;
+    }
+  }
+
+  if ((cp = strtok(NULL, " \t\n")) == NULL)
+    return -1;
+
+  eth->addr[0] = a0;
+  eth->addr[1] = a1;
+  eth->addr[2] = a2;
+  if (six_bytes) {
+    eth->addr[3] = a3;
+    eth->addr[4] = a4;
+    eth->addr[5] = a5;
+  } else {
+    eth->addr[3] = 0;
+    eth->addr[4] = 0;
+    eth->addr[5] = 0;
+  }
+
+  strncpy(eth->name, cp, MAXNAMELEN);
+  eth->name[MAXNAMELEN-1] = '\0';
+
+  return 0;
+
+} /* parse_ether_line */
+
+static FILE *eth_p = NULL;
+
+static void set_ethent(char *path)
+{
+  if (eth_p)
+    rewind(eth_p);
+  else
+    eth_p = fopen(path, "r");
+}
+
+static void end_ethent(void)
+{
+  if (eth_p) {
+    fclose(eth_p);
+    eth_p = NULL;
+  }
+}
+
+static ether_t *get_ethent(int six_bytes)
+{
+ 
+  static ether_t eth;
+  static int     size = 0;
+  static char   *buf = NULL;
+  
+  if (eth_p == NULL) 
+    return NULL;
+
+  while (fgetline(&buf, &size, eth_p) >= 0) {
+    if (parse_ether_line(buf, &eth, six_bytes) == 0) {
+      return &eth;
+    }
+  }
+    
+  return NULL;
+
+} /* get_ethent */
+
+static ether_t *get_ethbyname(u_char *name)
+{
+  ether_t *eth;
+  
+  set_ethent(g_ethers_path);
+
+  while ((eth = get_ethent(1)) && strncmp(name, eth->name, MAXNAMELEN) != 0)
+    ;
+
+  if (eth == NULL) {
+    end_ethent();
+    
+    set_ethent(g_pethers_path);
+
+    while ((eth = get_ethent(1)) && strncmp(name, eth->name, MAXNAMELEN) != 0)
+      ;
+
+    end_ethent();
+  }
+
+  return eth;
+
+} /* get_ethbyname */
+
+static ether_t *get_ethbyaddr(u_char *addr)
+{
+
+  ether_t *eth;
+  
+  set_ethent(g_ethers_path);
+
+  while ((eth = get_ethent(1)) && memcmp(addr, eth->addr, 6) != 0)
+    ;
+
+  if (eth == NULL) {
+    end_ethent();
+    
+    set_ethent(g_pethers_path);
+    
+    while ((eth = get_ethent(1)) && memcmp(addr, eth->addr, 6) != 0)
+      ;
+    
+    end_ethent();
+  }
+
+  return eth;
+
+} /* get_ethbyaddr */
+
+static void add_manuf_name(u_char *addr, u_char *name)
+{
+
+  hashmanuf_t *tp;
+  hashmanuf_t **table = manuf_table;
+
+  tp = table[ ((int)addr[2]) & (HASHMANUFSIZE - 1)];
+
+  if( tp == NULL ) {
+    tp = table[ ((int)addr[2]) & (HASHMANUFSIZE - 1)] = 
+      (hashmanuf_t *)g_malloc(sizeof(hashmanuf_t));
+  } else {  
+    while(1) {
+      if (tp->next == NULL) {
+	tp->next = (hashmanuf_t *)g_malloc(sizeof(hashmanuf_t));
+	tp = tp->next;
+	break;
+      }
+      tp = tp->next;
+    }
+  }
+  
+  memcpy(tp->addr, addr, sizeof(tp->addr));
+  strncpy(tp->name, name, MAXMANUFLEN);
+  tp->name[MAXMANUFLEN-1] = '\0';
+  tp->next = NULL;
+
+} /* add_manuf_name */
+
+static hashmanuf_t *manuf_name_lookup(u_char *addr)
+{
+
+  hashmanuf_t *tp;
+  hashmanuf_t **table = manuf_table;
+
+  tp = table[ ((int)addr[2]) & (HASHMANUFSIZE - 1)];
+  
+  while(tp != NULL) {
+    if (memcmp(tp->addr, addr, sizeof(tp->addr)) == 0) {
+      return tp;
+    }
+    tp = tp->next;
+  }
+  
+  return NULL;
+
+} /* manuf_name_lookup */
+
+static hashether_t *add_eth_name(u_char *addr, u_char *name)
+{
+  hashether_t *tp;
+  hashether_t **table = eth_table;
+  int i,j;
+
+  j = (addr[2] << 8) | addr[3];
+  i = (addr[4] << 8) | addr[5];
+
+  tp = table[ (i ^ j) & (HASHETHSIZE - 1)];
+
+  if( tp == NULL ) {
+    tp = table[ (i ^ j) & (HASHETHSIZE - 1)] = 
+      (hashether_t *)g_malloc(sizeof(hashether_t));
+  } else {  
+    while(1) {
+      if (tp->next == NULL) {
+	tp->next = (hashether_t *)g_malloc(sizeof(hashether_t));
+	tp = tp->next;
+	break;
+      }
+      tp = tp->next;
+    }
+  }
+  
+  memcpy(tp->addr, addr, sizeof(tp->addr));
+  strncpy(tp->name, name, MAXNAMELEN);
+  tp->name[MAXNAMELEN-1] = '\0';
+  tp->next = NULL;
+
+  return tp;
+
+} /* add_eth_name */
+
+static u_char *eth_name_lookup(u_char *addr)
+{
+  hashmanuf_t *manufp;
+  hashether_t *tp;
+  hashether_t **table = eth_table;
+  ether_t *eth;
+  int i,j;
+
+  j = (addr[2] << 8) | addr[3];
+  i = (addr[4] << 8) | addr[5];
+
+  tp = table[ (i ^ j) & (HASHETHSIZE - 1)];
+
+  if( tp == NULL ) {
+    tp = table[ (i ^ j) & (HASHETHSIZE - 1)] = 
+      (hashether_t *)g_malloc(sizeof(hashether_t));
+  } else {  
+    while(1) {
+      if (memcmp(tp->addr, addr, sizeof(tp->addr)) == 0) {
+	return tp->name;
+      }
+      if (tp->next == NULL) {
+	tp->next = (hashether_t *)g_malloc(sizeof(hashether_t));
+	tp = tp->next;
+	break;
+      }
+      tp = tp->next;
+    }
+  }
+  
+  /* fill in a new entry */
+
+  memcpy(tp->addr, addr, sizeof(tp->addr));
+  tp->next = NULL;
+
+  if ( (eth = get_ethbyaddr(addr)) == NULL) {
+    /* unknown name */
+
+    if ((manufp = manuf_name_lookup(addr)) == NULL)
+      sprintf(tp->name, "%s", ether_to_str((guint8 *)addr));
+    else
+      sprintf(tp->name, "%s_%02x:%02x:%02x", 
+	      manufp->name, addr[3], addr[4], addr[5]);
+
+  } else {
+    strncpy(tp->name, eth->name, MAXNAMELEN);
+    tp->name[MAXNAMELEN-1] = '\0';
+  }
+
+  return (tp->name);
+
+} /* eth_name_lookup */
+
+static u_char *eth_addr_lookup(u_char *name)
+{
+  ether_t *eth;
+  hashether_t *tp;
+  hashether_t **table = eth_table;
+  int i;
+
+  /* to be optimized (hash table from name to addr) */
+  for (i = 0; i < HASHETHSIZE; i++) {
+    tp = table[i];
+    while (tp) {
+      if (strcmp(tp->name, name) == 0)
+	return tp->addr;
+      tp = tp->next;
+    }
+  }
+
+  /* not in hash table : performs a file lookup */
+
+  if ((eth = get_ethbyname(name)) == NULL)
+    return NULL;
+
+  /* add new entry in hash table */
+
+  tp = add_eth_name(eth->addr, name);
+
+  return tp->addr;
+
+} /* eth_addr_lookup */
+
+static void initialize_ethers(void)
+{
+  ether_t *eth;
+
+#ifdef DEBUG_RESOLV
+  signal(SIGSEGV, SIG_IGN);
+#endif
+
+  if (g_pethers_path == NULL) {
+    g_pethers_path = g_malloc(strlen(getenv("HOME")) + 
+			      strlen(EPATH_PERSONAL_ETHERS) + 2);
+    sprintf(g_pethers_path, "%s/%s", 
+	    (char *)getenv("HOME"), EPATH_PERSONAL_ETHERS);
+  }
+
+  /* manuf hash table initialization */
+
+  set_ethent(g_manuf_path);
+
+  while ((eth = get_ethent(0))) {
+    add_manuf_name(eth->addr, eth->name);
+  }
+
+  end_ethent();
+
+} /* initialize_ethers */
+
+/* 
+ *  External Functions
+ */
 
 extern u_char *get_hostname(u_int addr) 
 {
@@ -226,6 +659,35 @@
   return host_name_lookup(addr);
 }
 
+extern void add_host_name(u_int addr, u_char *name)
+{
+
+  hashname_t *tp;
+  hashname_t **table = host_table;
+
+  tp = table[ addr & (HASHHOSTSIZE - 1)];
+
+  if( tp == NULL ) {
+    tp = table[ addr & (HASHHOSTSIZE - 1)] = 
+      (hashname_t *)g_malloc(sizeof(hashname_t));
+  } else {  
+    while(1) {
+      if (tp->next == NULL) {
+	tp->next = (hashname_t *)g_malloc(sizeof(hashname_t));
+	tp = tp->next;
+	break;
+      }
+      tp = tp->next;
+    }
+  }
+  
+  strncpy(tp->name, name, MAXNAMELEN);
+  tp->name[MAXNAMELEN-1] = '\0';
+  tp->addr = addr;
+  tp->next = NULL;
+
+} /* add_host_name */
+
 extern u_char *get_udp_port(u_int port) 
 {
   static gchar  str[3][MAXNAMELEN];
@@ -247,7 +709,6 @@
 
 } /* get_udp_port */
 
-
 extern u_char *get_tcp_port(u_int port) 
 {
   static gchar  str[3][MAXNAMELEN];
@@ -269,3 +730,57 @@
 
 } /* get_tcp_port */
 
+extern u_char *get_ether_name(u_char *addr)
+{
+  if (!g_resolving_actif)
+    return ether_to_str((guint8 *)addr);
+
+  if (!eth_resolution_initialized) {
+    initialize_ethers();
+    eth_resolution_initialized = 1;
+  }
+
+  return eth_name_lookup(addr);
+
+} /* get_ether_name */
+
+extern u_char *get_ether_addr(u_char *name)
+{
+
+  /* force resolution (do not check g_resolving_actif) */
+
+  if (!eth_resolution_initialized) {
+    initialize_ethers();
+    eth_resolution_initialized = 1;
+  }
+
+  return eth_addr_lookup(name);
+
+} /* get_ether_addr */
+
+extern u_char *get_manuf_name(u_char *addr) 
+{
+  static gchar  str[3][MAXMANUFLEN];
+  static gchar *cur;
+  hashmanuf_t  *manufp;
+
+  if (g_resolving_actif && !eth_resolution_initialized) {
+    initialize_ethers();
+    eth_resolution_initialized = 1;
+  }
+
+  if (!g_resolving_actif || ((manufp = manuf_name_lookup(addr)) == NULL)) {
+    if (cur == &str[0][0]) {
+      cur = &str[1][0];
+    } else if (cur == &str[1][0]) {  
+      cur = &str[2][0];
+    } else {  
+      cur = &str[0][0];
+    }
+    sprintf(cur, "%02x:%02x:%02x", addr[0], addr[1], addr[2]);
+    return cur;
+  }
+  
+  return manufp->name;
+
+} /* get_manuf_name */
diff -u --recursive --new-file ethereal-0.3.16/resolv.h ethereal-0.3.16-deniel/resolv.h
--- ethereal-0.3.16/resolv.h	Wed Sep 16 03:22:28 1998
+++ ethereal-0.3.16-deniel/resolv.h	Mon Sep 21 08:30:35 1998
@@ -28,14 +28,40 @@
 #ifndef __RESOLV_H__
 #define __RESOLV_H__
 
-/* global variable */
+#define EPATH_ETHERS 		"/etc/ethers"
+#define EPATH_MANUF  		"/etc/manuf"
+#define EPATH_PERSONAL_ETHERS 	".ethereal/ethers" /* with "$HOME/" prefix */
 
-extern int g_resolving_actif;
+/* global variables */
+
+extern gchar *g_ethers_path;
+extern gchar *g_manuf_path;
+extern gchar *g_pethers_path;
+extern int    g_resolving_actif;
 
 /* Functions in resolv.c */
 
+/* get_tcp_port returns the UDP port name or "%d" if not found */
 extern u_char *get_udp_port(u_int port);
+
+/* get_tcp_port returns the TCP port name or "%d" if not found */
 extern u_char *get_tcp_port(u_int port);
+
+/* get_hostname returns the host name or "%d.%d.%d.%d" if not found */
 extern u_char *get_hostname(u_int addr);
+
+/* get_ether_name returns the logical name if found in ethers files else
+   "<vendor>_%02x:%02x:%02x" if the vendor code is known else
+   "%02x:%02x:%02x:%02x:%02x:%02x" */
+extern u_char *get_ether_name(u_char *addr);
+
+/* get_manuf_name returns the vendor name or "%02x:%02x:%02x" if not known */
+extern u_char *get_manuf_name(u_char *addr);
+
+/* returns the ethernet address corresponding to name or NULL if not known */
+extern u_char *get_ether_addr(u_char *name);
+
+/* adds a hostname/IP in the hash table */
+extern void add_host_name(u_int addr, u_char *name);
 
 #endif /* __RESOLV_H__ */
# 
# /etc/manuf - Ethernet vendor codes 
#
# $Id$
#
# Laurent Deniel <deniel@xxxxxxxxxxx>
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@xxxxxxxx>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
#
# This is a subset of the list mantained by Michael Patton available from:
# <http://www.cavebear.com/CaveBear/Ethernet/>
# <ftp://ftp.cavebear.com/pub/Ethernet.txt>
#
# This file is in the same format as ethers(4) except that vendor names
# are truncated to eight characters when used with Ethereal.
#

00:00:0c	Cisco
00:00:0e 	Fujitsu
00:00:0f	NeXT
00:00:10	Hughes
00:00:11	Tektrnix
00:00:15	DataPnt		# Datapoint Corporation
00:00:18	Webster
00:00:1a	AMD
00:00:1b	Novell
00:00:1d	Ctron
00:00:20	DIAB
00:00:21	SC&C
00:00:22	VislTech	# Visual Technology
00:00:24	Olicom
00:00:2a	TRW
00:00:3c	Auspex
00:00:3d	AT&T
00:00:44	Castell
00:00:46	ISC-BR
00:00:48	Epson
00:00:49	Apricot
00:00:4b	APT
00:00:4c	NEC
00:00:55	AT&T
00:00:62	Hneywell	# Honeywell
00:00:63	HP
00:00:65	NetGenrl	# Network General
00:00:69	SGI
00:00:6b	MIPS
00:00:7a	Ardent
00:00:7d	Cray
00:00:81	Synoptcs	# Synoptics
00:00:87	Hitachi
00:00:89	Cayman
00:00:93	Proteon
00:00:94	Asante
00:00:95	Sony
00:00:97	Epoch
00:00:a0	Sanyo
00:00:a2	Wellflt		# Wellfleet
00:00:a3	NAT
00:00:a4	Acorn
00:00:a5	CSC
00:00:a7	NCD
00:00:a8	Stratus
00:00:a9	NetSys		# Network Systems
00:00:aa	Xerox
00:00:ae	Dassault
00:00:b0	RND
00:00:dd	Gould
00:00:de	Unigraph
00:00:e1	Hitachi
00:00:ed	April
00:00:f0	Samsung
00:00:f8	DEC
00:01:fa	Compaq
00:02:04	Novell
00:04:00	Lexmark
00:04:ac	IBM
00:06:0d	HP
00:06:29	IBM
00:06:7c	Cisco
00:06:c1	Cisco
00:07:01	Cisco
00:07:0d	Cisco
00:08:c7	Compaq
00:10:11	Cisco
00:10:1f	Cisco
00:10:2f	Cisco
00:10:4b	3Com
00:10:79	Cisco
00:10:f6	Cisco
00:20:00	Lexmark
00:20:35	IBM
00:20:85	3Com
00:20:af	3Com
00:40:a6 	Cray
00:40:c8	Milan
00:60:08	3Com
00:60:09	Cisco
00:60:2f	Cisco
00:60:3e	Cisco
00:60:47	Cisco
00:60:5c	Cisco
00:60:70	Cisco
00:60:83	Cisco
00:60:8c 	3Com
00:60:97	3Com
00:60:b0	HP
00:80:0f	SMC
00:80:1c	Cisco
00:80:24	Kalpana
00:80:45	Matshta
00:80:5a	Tulip
00:80:5f	Compaq
00:80:90	Microtek
00:80:96	HDS
00:80:9f	Alcatel
00:a0:24	3Com
00:aa:00	Intel
00:c0:4f	Dell
00:e0:14	Cisco
00:e0:1e	Cisco
00:e0:34	Cisco
00:e0:4f	Cisco
00:e0:a3	Cisco
00:e0:f7	Cisco
00:e0:f9	Cisco
00:e0:fe	Cisco
02:60:60	3Com
02:60:8c	3Com
02:cf:1f	CMC
08:00:02	3Com
08:00:03	ACC
08:00:07	Apple
08:00:08	BBN
08:00:09	HP
08:00:0a	Nestar
08:00:0b	Unisys
08:00:0e	NCR
08:00:0f	SMC
08:00:11	Tektrnix	# Tektronix
08:00:1a	DataGenl	# Data General
08:00:1b	DataGenl
08:00:1e	Apollo
08:00:1f	Sharp
08:00:20	Sun
08:00:2b	DEC
08:00:38	Bull
08:00:3e	Motorola
08:00:46	Sony
08:00:47	Sequent
08:00:5a	IBM
08:00:69	SGI
08:00:74	Casio
08:00:79	SGI
08:00:87	Xyplex
08:00:89	Kinetix
08:00:8b	Pyramid
08:00:8e	Tandem
08:00:0f	Chipcom
08:00:90	Retix
09:00:6a	AT&T
10:00:5a	IBM
10:00:90	HP
10:00:d4	DEC
3C:00:00	3Com
44:45:53	Micrsoft
aa:00:03	DEC
aa:00:04	DEC