This is a discussion on [patch] tcpdump: leading zeros in MAC address parts within the mailing.openbsd.tech forums, part of the OpenBSD category; --> Hello. This trivial patch keeps leading zeros in MAC address bytes, so that they had a fixed length. Sample ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello. This trivial patch keeps leading zeros in MAC address bytes, so that they had a fixed length. Sample of tcpdump output before: 18:08:24.293100 0:e0:4c:a0:a5:56 ff:ff:ff:ff:ff:ff 18:08:24.293665 0:e0:4c:a0:a5:8 ff:ff:ff:ff:ff:ff after: 18:08:24.293100 00:e0:4c:a0:a5:56 ff:ff:ff:ff:ff:ff 18:08:24.293665 00:e0:4c:a0:a5:08 ff:ff:ff:ff:ff:ff ================================================== ================= RCS file: /cvs/src/usr.sbin/tcpdump/addrtoname.c,v retrieving revision 1.28 diff -u -p -r1.28 addrtoname.c --- addrtoname.c 26 Feb 2006 21:10:54 -0000 1.28 +++ addrtoname.c 18 Jun 2007 02:24:12 -0000 @@ -474,13 +474,13 @@ etheraddr_string(register const u_char * } #endif cp = buf; - if ((j = *ep >> 4) != 0) - *cp++ = hex[j]; + j = *ep >> 4; + *cp++ = hex[j]; *cp++ = hex[*ep++ & 0xf]; for (i = 5; (int)--i >= 0 *cp++ = ':'; - if ((j = *ep >> 4) != 0) - *cp++ = hex[j]; + j = *ep >> 4; + *cp++ = hex[j]; *cp++ = hex[*ep++ & 0xf]; } *cp = '\0'; |