]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Keep our own Ethertype-to-name map.
authorGuy Harris <[email protected]>
Wed, 4 Nov 2015 03:06:41 +0000 (19:06 -0800)
committerGuy Harris <[email protected]>
Wed, 4 Nov 2015 03:06:41 +0000 (19:06 -0800)
Don't use a hack to get the table from libpcap; have our own table.
That cleans up the hack, and lets us add stuff to our table without
having to worry about libpcap.

addrtoname.c

index e49a78d4c6177b5a9e2cab9a653847d8dfd37cfa..a79aba7da256e34308a88bcfcaadc2b178e40a48 100644 (file)
@@ -60,6 +60,7 @@ extern int ether_ntohost(char *, const struct ether_addr *);
 #include "netdissect.h"
 #include "addrtoname.h"
 #include "addrtostr.h"
 #include "netdissect.h"
 #include "addrtoname.h"
 #include "addrtostr.h"
+#include "ethertype.h"
 #include "llc.h"
 #include "setsignal.h"
 #include "extract.h"
 #include "llc.h"
 #include "setsignal.h"
 #include "extract.h"
@@ -777,16 +778,32 @@ init_servarray(netdissect_options *ndo)
        endservent();
 }
 
        endservent();
 }
 
-/* in libpcap.a (nametoaddr.c) */
-#if defined(_WIN32) && !defined(USE_STATIC_LIBPCAP)
-extern __declspec(dllimport)
-#else
-extern
-#endif
-const struct eproto {
+static const struct eproto {
        const char *s;
        u_short p;
        const char *s;
        u_short p;
-} eproto_db[];
+} eproto_db[] = {
+       { "pup", ETHERTYPE_PUP },
+       { "xns", ETHERTYPE_NS },
+       { "ip", ETHERTYPE_IP },
+       { "ip6", ETHERTYPE_IPV6 },
+       { "arp", ETHERTYPE_ARP },
+       { "rarp", ETHERTYPE_REVARP },
+       { "sprite", ETHERTYPE_SPRITE },
+       { "mopdl", ETHERTYPE_MOPDL },
+       { "moprc", ETHERTYPE_MOPRC },
+       { "decnet", ETHERTYPE_DN },
+       { "lat", ETHERTYPE_LAT },
+       { "sca", ETHERTYPE_SCA },
+       { "lanbridge", ETHERTYPE_LANBRIDGE },
+       { "vexp", ETHERTYPE_VEXP },
+       { "vprod", ETHERTYPE_VPROD },
+       { "atalk", ETHERTYPE_ATALK },
+       { "atalkarp", ETHERTYPE_AARP },
+       { "loopback", ETHERTYPE_LOOPBACK },
+       { "decdts", ETHERTYPE_DECDTS },
+       { "decdns", ETHERTYPE_DECDNS },
+       { (char *)0, 0 }
+};
 
 static void
 init_eprotoarray(netdissect_options *ndo)
 
 static void
 init_eprotoarray(netdissect_options *ndo)