diff options
Diffstat (limited to 'contrib/tcpdump/addrtoname.c')
-rw-r--r-- | contrib/tcpdump/addrtoname.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/tcpdump/addrtoname.c b/contrib/tcpdump/addrtoname.c index 2f5b466..41ddcc6 100644 --- a/contrib/tcpdump/addrtoname.c +++ b/contrib/tcpdump/addrtoname.c @@ -510,6 +510,34 @@ etheraddr_string(register const u_char *ep) } const char * +le64addr_string(const u_char *ep) +{ + const unsigned int len = 8; + register u_int i; + register char *cp; + register struct enamemem *tp; + char buf[BUFSIZE]; + + tp = lookup_bytestring(ep, len); + if (tp->e_name) + return (tp->e_name); + + cp = buf; + for (i = len; i > 0 ; --i) { + *cp++ = hex[*(ep + i - 1) >> 4]; + *cp++ = hex[*(ep + i - 1) & 0xf]; + *cp++ = ':'; + } + cp --; + + *cp = '\0'; + + tp->e_name = strdup(buf); + + return (tp->e_name); +} + +const char * linkaddr_string(const u_char *ep, const unsigned int type, const unsigned int len) { register u_int i; |