Package: arpwatch
Version: 2.1a13-2.1
Severity: wishlist
Tags: patch

Hi,

I have wrote a patch, which add support for simple humanreadaable aliases for 
mac-addresses.

Andrej



-- System Information:
Debian Release: lenny/sid
  APT prefers hardy-updates
  APT policy: (500, 'hardy-updates'), (500, 'hardy')
Architecture: i386 (x86_64)

Kernel: Linux 2.6.22-14-generic (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
diff --git a/Makefile.in b/Makefile.in
index 45e9047..1a189b1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -67,7 +67,7 @@ SENDMAIL = @V_SENDMAIL@
        @rm -f $@
        $(CC) $(CFLAGS) -c $(srcdir)/$*.c
 
-CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c localhost.c 
setsignal.c
+CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c localhost.c 
setsignal.c ea.c streamsearch.c
 WSRC = arpwatch.c
 SSRC = arpsnmp.c
 GENSRC = version.c
@@ -79,7 +79,7 @@ SRC = $(WSRC) $(SSRC) $(CSRC) $(GENSRC)
 OBJ =  $(WSRC:.c=.o) $(SSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
 WOBJ = $(WSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
 SOBJ = $(SSRC:.c=.o) $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
-HDR =  arpwatch.h db.h dns.h ec.h file.h machdep.h report.h localhost.h 
setsignal.h
+HDR =  arpwatch.h db.h dns.h ec.h file.h machdep.h report.h localhost.h 
setsignal.h ea.h streamsearch.h
 
 TAGHDR = \
        /usr/include/net/if.h \
diff --git a/arpsnmp.8 b/arpsnmp.8
index 2fec0b0..4eaecf2 100644
--- a/arpsnmp.8
+++ b/arpsnmp.8
@@ -56,6 +56,14 @@ arpsnmp \- keep track of ethernet/ip address pairings
 .\" **
 .br
 .ti +8
+[
+.B -e
+.I aliasesfile
+]
+.\" **
+.\" **
+.br
+.ti +8
 .I file
 [
 .I ...
@@ -104,6 +112,12 @@ on the local machine.
 .\" **
 .\" **
 .LP
+The
+.B -e
+flag ist used to specify a ethernet aliases file.
+.\" **
+.\" **
+.LP
 Note that an empty
 .I arp.dat
 file must be created before the first time you run
diff --git a/arpsnmp.c b/arpsnmp.c
index 0fb7f85..80e50e4 100644
--- a/arpsnmp.c
+++ b/arpsnmp.c
@@ -84,6 +84,7 @@ main(int argc, char **argv)
                "m:"
                "f:"
                "s:"
+               "e:"
        ;
 
        if ((cp = strrchr(argv[0], '/')) != NULL)
@@ -120,6 +121,10 @@ main(int argc, char **argv)
                        path_sendmail = optarg;
                        break;
 
+               case 'e':
+                       ealiases = ealiases;
+                       break;
+
                default:
                        usage();
                }
@@ -204,6 +209,7 @@ usage(void)
                "[-m addr ] "
                "[-f datafile] "
                "[-s sendmail_path] "
+               "[-e aliasesfile] "
                "file [...]\n"
        ;
 
diff --git a/arpwatch.8 b/arpwatch.8
index 1bee166..226027f 100644
--- a/arpwatch.8
+++ b/arpwatch.8
@@ -124,6 +124,14 @@ arpwatch \- keep track of ethernet/ip address pairings
 ]
 .\" **
 .\" **
+.br
+.ti +8
+[
+.B -e
+.I aliasesfile
+]
+.\" **
+.\" **
 .ad
 .SH DESCRIPTION
 .B Arpwatch
@@ -272,6 +280,12 @@ range). Netmask is specified as 255.255.128.0.
 .\" **
 .\" **
 .LP
+The
+.B -e
+flag ist used to specify a ethernet aliases file.
+.\" **
+.\" **
+.LP
 Note that an empty
 .I arp.dat
 file must be created before the first time you run
diff --git a/arpwatch.c b/arpwatch.c
index 196b4f0..47d1657 100644
--- a/arpwatch.c
+++ b/arpwatch.c
@@ -221,6 +221,9 @@ main(int argc, char **argv)
                "z:"
                /**/
                /**/
+               "e:"
+               /**/
+               /**/
        ;
        char *tmpptr;
 
@@ -322,6 +325,11 @@ main(int argc, char **argv)
                        break;
                /**/
                /**/
+               case 'e':
+                       ealiases = optarg;
+                       break;
+               /**/
+               /**/
                default:
                        usage();
                }
@@ -569,7 +577,8 @@ sanity_ether(register struct ether_header *eh, register 
struct ether_arp *ea,
        ea->arp_op = ntohs(ea->arp_op);
 
        if (len < sizeof(*eh) + sizeof(*ea)) {
-               syslog(LOG_ERR, "short (want %d)\n", sizeof(*eh) + sizeof(*ea));
+
+               syslog(LOG_ERR, "short (want %zd)\n", sizeof(*eh) + 
sizeof(*ea));
                return(0);
        }
 
@@ -723,7 +732,8 @@ sanity_fddi(register struct fddi_header *fh, register 
struct ether_arp *ea,
        op = ntohs(op);
 
        if (len < sizeof(*fh) + sizeof(*ea)) {
-               syslog(LOG_ERR, "short (want %d)\n", sizeof(*fh) + sizeof(*ea));
+               /* fix specifier to be proper on 64-bit systems */
+               syslog(LOG_ERR, "short (want %zd)\n", sizeof(*fh) + 
sizeof(*ea));
                return(0);
        }
 
@@ -932,6 +942,9 @@ usage(void)
                "[-z ignorenet/ignoremask] "
                /**/
                /**/
+               "[-e aliasesfile] "
+               /**/
+               /**/
                "\n"
        ;
 
diff --git a/arpwatch.h b/arpwatch.h
index 188c925..39038ab 100644
--- a/arpwatch.h
+++ b/arpwatch.h
@@ -2,6 +2,7 @@
 
 #define ARPFILE "arp.dat"
 /* #define ETHERCODES "ethercodes.dat" */
+#define EALIASES NULL
 #define CHECKPOINT (15*60)             /* Checkpoint time in seconds */
 
 #define MEMCMP(a, b, n) memcmp((char *)a, (char *)b, n)
diff --git a/configure.in b/configure.in
old mode 100755
new mode 100644
index f7ed3d7..3016e41
--- a/configure.in
+++ b/configure.in
@@ -6,9 +6,10 @@ dnl
 dnl Process this file with autoconf to produce a configure script.
 dnl
 
-AC_INIT(arpwatch.c)
+AC_INIT
+AC_CONFIG_SRCDIR([arpwatch.c])
 
-AC_CANONICAL_SYSTEM
+AC_CANONICAL_TARGET
 
 umask 002
 
@@ -56,7 +57,7 @@ AC_MSG_CHECKING(if ether_header uses ether_addr structs)
 AC_CACHE_VAL(ac_cv_ether_header_has_ea,
     LBL_SAVE_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $V_INCLS"
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #      include <sys/types.h>
 #      if __STDC__
        /* osf3 has REALLY good prototyes */
@@ -66,11 +67,8 @@ AC_CACHE_VAL(ac_cv_ether_header_has_ea,
 #      include <sys/socket.h>
 #      include <net/if.h>
 #      include <netinet/in.h>
-#      include <netinet/if_ether.h>],
-       [u_int i =
-           sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
-       ac_cv_ether_header_has_ea=yes,
-       ac_cv_ether_header_has_ea=no)
+#      include <netinet/if_ether.h>]], [[u_int i =
+           sizeof(((struct ether_header 
*)0)->ether_dhost.ether_addr_octet)]])],[ac_cv_ether_header_has_ea=yes],[ac_cv_ether_header_has_ea=no])
     CFLAGS="$LBL_SAVE_CFLAGS")
 AC_MSG_RESULT($ac_cv_ether_header_has_ea)
 if test $ac_cv_ether_header_has_ea = yes ; then
@@ -81,7 +79,7 @@ AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
 AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
     LBL_SAVE_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $V_INCLS"
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #      include <sys/types.h>
 #      if __STDC__
        /* osf3 has REALLY good prototyes */
@@ -91,11 +89,8 @@ AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
 #      include <sys/socket.h>
 #      include <net/if.h>
 #      include <netinet/in.h>
-#      include <netinet/if_ether.h>],
-       [u_int i =
-           sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
-       ac_cv_ether_arp_has_ea=yes,
-       ac_cv_ether_arp_has_ea=no)
+#      include <netinet/if_ether.h>]], [[u_int i =
+           sizeof(((struct ether_arp 
*)0)->arp_sha.ether_addr_octet)]])],[ac_cv_ether_arp_has_ea=yes],[ac_cv_ether_arp_has_ea=no])
     CFLAGS="$LBL_SAVE_CFLAGS")
 AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
 if test $ac_cv_ether_arp_has_ea = yes ; then
@@ -106,7 +101,7 @@ AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
 AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
     LBL_SAVE_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $V_INCLS"
-    AC_TRY_COMPILE([
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #      include <sys/types.h>
 #      include <sys/socket.h>
 #      if __STDC__
@@ -116,10 +111,7 @@ AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
 #      endif
 #      include <net/if.h>
 #      include <netinet/in.h>
-#      include <netinet/if_ether.h>],
-       [u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
-       ac_cv_struct_ether_arp_x=yes,
-       ac_cv_struct_ether_arp_x=no)
+#      include <netinet/if_ether.h>]], [[u_int i = sizeof( ((struct ether_arp 
*)0)->arp_xsha)]])],[ac_cv_struct_ether_arp_x=yes],[ac_cv_struct_ether_arp_x=no])
     CFLAGS="$LBL_SAVE_CFLAGS")
 AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
 if test $ac_cv_struct_ether_arp_x = yes ; then
@@ -131,14 +123,11 @@ dnl bind 8 does some routine name renaming so we must 
test specially
 dnl
 AC_MSG_CHECKING(for dn_skipname)
 AC_CACHE_VAL(ac_cv_have_dn_skipname,
-    AC_TRY_LINK([
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #      include <sys/types.h>
 #      include <netinet/in.h>
 #      include <arpa/nameser.h>
-#      include <resolv.h>],
-       [(void)dn_skipname(0, 0);],
-       ac_cv_have_dn_skipname=yes,
-       ac_cv_have_dn_skipname=no))
+#      include <resolv.h>]], [[(void)dn_skipname(0, 
0);]])],[ac_cv_have_dn_skipname=yes],[ac_cv_have_dn_skipname=no]))
 AC_MSG_RESULT($ac_cv_have_dn_skipname)
 if test $ac_cv_have_dn_skipname = yes ; then
        AC_DEFINE(HAVE_DN_SKIPNAME)
diff --git a/ea.c b/ea.c
new file mode 100644
index 0000000..a54cf86
--- /dev/null
+++ b/ea.c
@@ -0,0 +1,276 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <syslog.h>
+
+#include "ea.h"
+#include "ec.h"
+#include "streamsearch.h"
+
+enum {
+ macbuf_l = 17, /*  6*2 + 5 */
+ abuf_l = 256
+};
+
+static ea_t ea_root;
+
+static char *push_mac(char *macbuf, char *macbuf_i, const char *i, const char 
*ni)
+{
+ register size_t n = ni - i;
+ if ( n > (macbuf_l - (macbuf_i - macbuf)) )
+ {
+  return NULL;
+ }
+ memcpy(macbuf_i, i, n);
+ return macbuf_i + n;
+}
+
+static char *push_alias(char *abuf, char *abuf_i, const char *i, const char 
*ni)
+{
+ if ( abuf_i <  abuf + abuf_l )
+ {
+  register size_t n = ni - i;
+  if ( n > (abuf_l - (abuf_i - abuf)) )
+  {
+   n = (abuf_l - (abuf_i - abuf));
+  }
+  memcpy(abuf_i, i, n);
+  return abuf_i + n;
+ }
+ return abuf_i;
+}
+
+static ea_t *set_alias(ea_t *ea, char *mac, char *alias)
+{
+ ea_t *n = malloc(sizeof(ea_t));
+ if ( !n )
+ {
+  (void)fprintf(stderr, "set_aliases: malloc: %m\n");
+  exit(1);
+ }
+ if ( !str2e(mac, &(n->e[0])) )
+ {
+     return NULL;
+ }
+ n->alias = strdup(alias);
+ if (!(n->alias))
+ {
+  (void)fprintf(stderr, "set_aliases: strdup: %m\n");
+  exit(1);
+ }
+ n->next = NULL;
+ ea->next = n;
+ return n;
+}
+
+static void parse_ea(FILE *f, const char *fname)
+{
+ ea_t *eai = &ea_root;
+ ea_root.next = NULL;
+
+ char fbuf[4096]; /*  file read buffer */
+ char macbuf[macbuf_l+1];
+ char *macbuf_i = NULL;
+ char abuf[abuf_l+1];
+ char *abuf_i = NULL;
+
+ size_t line_c = 1;/* line counter */
+ size_t s;
+ char *i; /*  buffer iterator */
+ char *ni; /*  new buffer iterator */
+
+
+ /*  initials for streamsearch */
+
+ ss_t *r;
+ ss_t nl; /*  new line */
+ ss_t cm; /*  comment */
+ ss_t ns; /*  not space */
+ ss_t sp; /*  space */
+
+ nl.type = STR;
+ nl.str = "\n";
+ nl.i = nl.str;
+
+ cm.type = STR;
+ cm.str = "#";
+ cm.i = cm.str;
+
+ ns.type = NSPACE;
+ sp.type = SPACE;
+
+ ss_t *ss_nl[] = { &nl, NULL }; /*  search new line */
+ /*  search for mac address begin */
+ /*  it is not space */
+ /*  comment can occur */
+ ss_t *ss_mab[] = { &nl, &cm, &ns, NULL };
+
+ /*  search for mac address end */
+ /*  if new line found, when no alias for this mac address */
+ /*  it is space */
+ ss_t *ss_mae[] = { &nl, &sp, NULL };
+
+ /*  search for alias begin */
+ /*  is not space */
+ ss_t *ss_ab[] = { &nl, &ns, NULL };
+
+ /*  search for alias end */
+ ss_t *ss_ae[] = { &nl, NULL };
+
+ ss_t **ss = ss_mab;
+ 
+
+ /*  start main read loop */
+
+ while ( (s=fread(fbuf, 1, sizeof(fbuf), f)) )
+ {
+  i = fbuf;
+  while ( i < fbuf + s ) /* parse buffer until the end */
+  {
+   ni = (char *)streamsearch(&r, ss, i, fbuf+s); /* search for next token */
+
+   if ( !r )
+   {
+    /*  nothing found */
+    if ( ss == ss_mae )
+       {
+     /*  fill mac address buffer */
+        macbuf_i = push_mac(macbuf, macbuf_i, i, ni);
+        if ( !macbuf_i )
+        {
+      syslog(LOG_NOTICE, "parse_ea(%s): line %zd: bad mac address: too 
long\n", fname, line_c);
+         ss = ss_nl; /* bad mac address, ignore this line of ealiases */
+        }
+       }
+       else if ( ss == ss_ae )
+       {
+        /*  fill alias buffer */
+        abuf_i = push_alias(abuf, abuf_i, i, ni);
+       }
+
+   }
+   else
+   {
+    if ( r == &nl ) /* new line found */
+    {
+
+        if ( ss == ss_ae ) /* it is the end of alias */
+        {
+         /* fill alias buffer */
+         abuf_i = push_alias(abuf, abuf_i, i, ni);
+         /* set proper end of alias string */
+         *abuf_i = '\0';
+         /* try to add alias for given mac address */
+         ea_t *neai = set_alias(eai, macbuf, abuf);
+
+         if ( neai )
+       eai = neai;
+         else
+       syslog(LOG_NOTICE, "parse_ea(%s): line %zd: not valid 
mac-address\n",fname, line_c);
+        }
+
+     /*  we search mac address after every new line */
+     ss = ss_mab;
+        ++line_c;
+        ++ni;
+    }
+    else if ( r == &cm ) /* comment begin was found */
+    {
+        /*  if we find a comment, ignore this line of ealiases */
+     ss = ss_nl;
+        ++ni;
+    }
+    else if ( r == &ns ) /* not space character */
+    {
+        /*  we found first not space character */
+        if ( ss == ss_mab ) /* begin of mac address was found */
+        {
+         /*  now search for the end of mac address */
+         ss = ss_mae;
+         macbuf_i = macbuf;
+        }
+        else if ( ss == ss_ab ) /* begin of alias was found */
+        {
+         /*  now search for end of alias string */
+      ss = ss_ae;
+
+         /* set iterator at the begin of buffer */
+         abuf_i = abuf;
+        }
+    }
+    else if ( r == &sp ) /* space character (isspace(*ni) == true) */
+       {
+        /* this token is only in ss_mae, also ss == ss_mae
+         * end of mac address was found
+         */
+
+     /* fill mac buffer */
+        macbuf_i = push_mac(macbuf, macbuf_i, i, ni);
+        if ( !macbuf_i )
+        {
+      syslog(LOG_NOTICE, "parse_ea(%s): line %zd: bad mac address: too 
long\n",fname, line_c);
+         ss = ss_nl; /* bad mac address, ignore this line of ealiases */
+        }
+        else
+        {
+      /* mac address is not too long, validate it later */
+          
+      /* set proper end of mac address strng*/
+         *macbuf_i = '\0';
+
+      /* now search for alias */
+         ss = ss_ab;
+        }
+
+        ++ni;
+       }
+   }
+   i = ni;
+  }
+ }
+}
+
+/* return pointer to alias to the mac address or NULL */
+const char *get_ealias(register u_char *e)
+{
+ ea_t *ea = ea_root.next;
+ int i;
+EA_LOOP: while ( ea )
+ {
+  for(i = 0; i < 6; ++i )
+  {
+   if ( ea->e[i] != e[i] )
+   {
+    ea = ea->next;
+    goto EA_LOOP;
+   }
+  }
+  return ea->alias;
+ }
+ return NULL;
+}
+
+/*  return 1 on error, and 0 on success */
+void read_aliases(const char *fname)
+{
+ if ( ! fname )
+  return;
+
+ FILE *f = fopen(fname, "r");
+ if ( f == NULL )
+ {
+  syslog(LOG_ERR, "fopen(%s): %m", fname);
+  return;
+ }
+
+ parse_ea(f, fname);
+
+ if ( ferror(f) )
+ {
+  syslog(LOG_ERR, "fread(%s) error, may be: %m", fname);
+  return;
+ }
+
+ fclose(f);
+}
+
diff --git a/ea.h b/ea.h
new file mode 100644
index 0000000..e14ad2d
--- /dev/null
+++ b/ea.h
@@ -0,0 +1,18 @@
+#ifndef _EA_H_
+#define _EA_H_
+
+#include <sys/types.h>
+
+struct ea_t;
+typedef struct ea_t ea_t;
+
+struct ea_t {
+ u_char e[6];
+ char *alias;
+ ea_t *next;
+};
+
+void read_aliases(const char *fname);
+const char *get_ealias(register u_char *e);
+
+#endif // _EA_H_
diff --git a/report.c b/report.c
index 238e735..ea79e7b 100644
--- a/report.c
+++ b/report.c
@@ -69,6 +69,8 @@ struct rtentry;
 #include "util.h"
 #include "localhost.h"
 
+#include "ea.h"
+
 #define PLURAL(n) ((n) == 1 || (n) == -1 ? "" : "s")
 
 static int cdepth;     /* number of outstanding children */
@@ -246,6 +248,7 @@ report(register char *title, register u_int32_t a, register 
u_char *e1,
        char *watcher = mailaddress;
        char *watchee = WATCHEE;
        char *sendmail = path_sendmail;
+       const char *ealias;
        char *unknown = "<unknown>";
        char buf[132];
        static int init = 0;
@@ -322,6 +325,9 @@ report(register char *title, register u_int32_t a, register 
u_char *e1,
        (void)fprintf(f, fmt, "hostname", hn);
        (void)fprintf(f, fmt, "ip address", intoa(a));
        (void)fprintf(f, fmt, "interface", interface);
+       ealias = get_ealias(e1);
+       if ( ealias )
+               (void)fprintf(f, fmt, "ethernet alias", ealias);
        (void)fprintf(f, fmt, "ethernet address", e2str(e1));
        if ((cp = ec_find(e1)) == NULL)
                cp = unknown;
@@ -335,6 +341,9 @@ report(register char *title, register u_int32_t a, register 
u_char *e1,
                if ((cp = ec_find(e2)) == NULL)
                        cp = unknown;
                (void)fprintf(f, fmt, "old ethernet vendor", cp);
+               ealias = get_ealias(e2);
+               if ( ealias )
+                       (void)fprintf(f, fmt, "old ethernet alias", ealias);
        }
        if (t1p)
                (void)fprintf(f, fmt, "timestamp", fmtdate(*t1p));
diff --git a/streamsearch.c b/streamsearch.c
new file mode 100644
index 0000000..1d8ecf7
--- /dev/null
+++ b/streamsearch.c
@@ -0,0 +1,52 @@
+#include <ctype.h>
+#include <stddef.h>
+
+#include "streamsearch.h"
+
+const char *streamsearch(ss_t **retval, ss_t **ss, const char *begin, const 
char *end)
+{
+ register ss_t **ssi;
+ register ss_t *s;
+ register const char *i;
+ for(i = begin; i < end; ++i)
+ {
+  for(ssi = ss; *ssi; ++ssi)
+  {
+   s = *ssi;
+   switch ( s->type )
+   {
+    case STR:
+     if ( *(s->i) == *i )
+     {
+      ++(s->i);
+      if ( !*(s->i) )
+         {
+       s->i = s->str;
+          *retval = s;
+          return i;
+      }
+     }
+     else
+     {
+      s->i = s->str;
+     }
+        break;
+       case SPACE:
+        if (isspace(*i))
+        {
+          *retval = s;
+          return i;
+        }
+        break;
+       case NSPACE:
+        if (!isspace(*i))
+        {
+          *retval = s;
+          return i;
+        }
+   }
+  }
+ }
+ *retval = 0;
+ return i;
+}
diff --git a/streamsearch.h b/streamsearch.h
new file mode 100644
index 0000000..cb13bf6
--- /dev/null
+++ b/streamsearch.h
@@ -0,0 +1,27 @@
+#ifndef _STREAMSEARCH_H_
+#define _STREAMSEARCH_H_
+
+struct ss_t;
+typedef struct ss_t ss_t;
+
+enum ss_type_t {
+ STR, // match string
+ SPACE, // match space char (isspace)
+ NSPACE // not space char (!isspace)
+};
+typedef enum ss_type_t ss_type_t;
+
+struct ss_t {
+ ss_type_t type;
+ const char *str; // C-String to match
+ const char *i; // iterator for match position
+};
+
+// retval is pointer to matched ss_str_t or NULL after function return
+// ss is NULL terminated array of ss_str_t pointers
+// bein ist pointer to first char to match
+// end is pointer after last char to match
+// return end pointer or last char, which matched
+const char *streamsearch(ss_t **retval, ss_t **ss, const char *begin, const 
char *end);
+
+#endif // _STREAMSEARCH_H_
diff --git a/util.c b/util.c
index 181e129..89d15b6 100644
--- a/util.c
+++ b/util.c
@@ -55,6 +55,7 @@ static const char rcsid[] =
 char *arpdir = ARPDIR;
 char *arpfile = ARPFILE;
 char *ethercodes = ETHERCODES;
+char *ealiases = EALIASES;
 
 /* Broadcast ethernet addresses */
 u_char zero[6] = { 0, 0, 0, 0, 0, 0 };
@@ -172,6 +173,8 @@ readdata(void)
                (void)fclose(f);
        }
 
+       read_aliases(ealiases);
+
        return(1);
 }
 
diff --git a/util.h b/util.h
index 9574ff1..adccd35 100644
--- a/util.h
+++ b/util.h
@@ -11,6 +11,7 @@ extern char *newarpfile;
 extern char *arpfile;
 extern char *oldarpfile;
 extern char *ethercodes;
+extern char *ealiases;
 
 extern u_char zero[6];
 extern u_char allones[6];

Reply via email to