| 121 | static const char hexlist[] = "0123456789abcdef"; |
| 122 | |
| 123 | char * |
| 124 | link_ntoa(const struct sockaddr_dl *sdl) |
| 125 | { |
| 126 | static char obuf[64]; |
| 127 | char *out = obuf; |
| 128 | int i; |
| 129 | u_char *in = (u_char *)LLADDR(sdl); |
| 130 | u_char *inlim = in + sdl->sdl_alen; |
| 131 | int firsttime = 1; |
| 132 | |
| 133 | if (sdl->sdl_nlen) { |
| 134 | bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen); |
| 135 | out += sdl->sdl_nlen; |
| 136 | if (sdl->sdl_alen) |
| 137 | *out++ = ':'; |
| 138 | } |
| 139 | while (in < inlim) { |
| 140 | if (firsttime) |
| 141 | firsttime = 0; |
| 142 | else |
| 143 | *out++ = '.'; |
| 144 | i = *in++; |
| 145 | if (i > 0xf) { |
| 146 | out[1] = hexlist[i & 0xf]; |
| 147 | i >>= 4; |
| 148 | out[0] = hexlist[i]; |
| 149 | out += 2; |
| 150 | } else |
| 151 | *out++ = hexlist[i]; |
| 152 | } |
| 153 | *out = 0; |
| 154 | return (obuf); |
| 155 | } |
no outgoing calls
no test coverage detected