diff options
Diffstat (limited to 'contrib/tcpdump/addrtoname.c')
-rw-r--r-- | contrib/tcpdump/addrtoname.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c index 0540343..2f5b466 100644 --- a/contrib/tcpdump/addrtoname.c +++ b/contrib/tcpdump/addrtoname.c @@ -88,12 +88,12 @@ struct hnamemem { struct hnamemem *nxt; }; -struct hnamemem hnametable[HASHNAMESIZE]; -struct hnamemem tporttable[HASHNAMESIZE]; -struct hnamemem uporttable[HASHNAMESIZE]; -struct hnamemem eprototable[HASHNAMESIZE]; -struct hnamemem dnaddrtable[HASHNAMESIZE]; -struct hnamemem ipxsaptable[HASHNAMESIZE]; +static struct hnamemem hnametable[HASHNAMESIZE]; +static struct hnamemem tporttable[HASHNAMESIZE]; +static struct hnamemem uporttable[HASHNAMESIZE]; +static struct hnamemem eprototable[HASHNAMESIZE]; +static struct hnamemem dnaddrtable[HASHNAMESIZE]; +static struct hnamemem ipxsaptable[HASHNAMESIZE]; #if defined(INET6) && defined(WIN32) /* @@ -142,7 +142,7 @@ struct h6namemem { struct h6namemem *nxt; }; -struct h6namemem h6nametable[HASHNAMESIZE]; +static struct h6namemem h6nametable[HASHNAMESIZE]; #endif /* INET6 */ struct enamemem { @@ -155,9 +155,9 @@ struct enamemem { struct enamemem *e_nxt; }; -struct enamemem enametable[HASHNAMESIZE]; -struct enamemem nsaptable[HASHNAMESIZE]; -struct enamemem bytestringtable[HASHNAMESIZE]; +static struct enamemem enametable[HASHNAMESIZE]; +static struct enamemem nsaptable[HASHNAMESIZE]; +static struct enamemem bytestringtable[HASHNAMESIZE]; struct protoidmem { u_int32_t p_oui; @@ -166,7 +166,7 @@ struct protoidmem { struct protoidmem *p_nxt; }; -struct protoidmem protoidtable[HASHNAMESIZE]; +static struct protoidmem protoidtable[HASHNAMESIZE]; /* * A faster replacement for inet_ntoa(). @@ -313,7 +313,7 @@ getname6(const u_char *ap) } #endif /* INET6 */ -static char hex[] = "0123456789abcdef"; +static const char hex[] = "0123456789abcdef"; /* Find the hash node that corresponds the ether address 'ep' */ @@ -516,13 +516,14 @@ linkaddr_string(const u_char *ep, const unsigned int type, const unsigned int le register char *cp; register struct enamemem *tp; - if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) { - return etheraddr_string(ep); - } + if (len == 0) + return ("<empty>"); - if (type == LINKADDR_FRELAY) { - return q922_string(ep); - } + if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) + return (etheraddr_string(ep)); + + if (type == LINKADDR_FRELAY) + return (q922_string(ep)); tp = lookup_bytestring(ep, len); if (tp->e_name) @@ -749,7 +750,7 @@ init_eprotoarray(void) } } -static struct protoidlist { +static const struct protoidlist { const u_char protoid[5]; const char *name; } protoidlist[] = { @@ -770,7 +771,7 @@ init_protoidarray(void) { register int i; register struct protoidmem *tp; - struct protoidlist *pl; + const struct protoidlist *pl; u_char protoid[5]; protoid[0] = 0; @@ -794,7 +795,7 @@ init_protoidarray(void) } } -static struct etherlist { +static const struct etherlist { const u_char addr[6]; const char *name; } etherlist[] = { @@ -819,7 +820,7 @@ static struct etherlist { static void init_etherarray(void) { - register struct etherlist *el; + register const struct etherlist *el; register struct enamemem *tp; #ifdef USE_ETHER_NTOHOST char name[256]; @@ -863,7 +864,7 @@ init_etherarray(void) } } -static struct tok ipxsap_db[] = { +static const struct tok ipxsap_db[] = { { 0x0000, "Unknown" }, { 0x0001, "User" }, { 0x0002, "User Group" }, |