diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-11-03 19:06:41 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-11-03 19:06:41 -0800 |
commit | e64b287afd7d588d8c177600e400169e032293c4 (patch) | |
tree | d95c86ef64559ff117cb17740692aa82554747c3 /addrtoname.c | |
parent | a7a448081310beb7ca63c52244a8348f4105606d (diff) | |
download | tcpdump-e64b287afd7d588d8c177600e400169e032293c4.tar.gz |
Keep our own Ethertype-to-name map.
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.
Diffstat (limited to 'addrtoname.c')
-rw-r--r-- | addrtoname.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/addrtoname.c b/addrtoname.c index e49a78d4..a79aba7d 100644 --- a/addrtoname.c +++ b/addrtoname.c @@ -60,6 +60,7 @@ extern int ether_ntohost(char *, const struct ether_addr *); #include "netdissect.h" #include "addrtoname.h" #include "addrtostr.h" +#include "ethertype.h" #include "llc.h" #include "setsignal.h" #include "extract.h" @@ -777,16 +778,32 @@ init_servarray(netdissect_options *ndo) 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; -} 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) |