Loading...
--- Libc/Libc-1725.40.4/net/FreeBSD/linkaddr.c
+++ Libc/Libc-320/net/FreeBSD/linkaddr.c
@@ -10,6 +10,10 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
@@ -31,7 +35,7 @@
static char sccsid[] = "@(#)linkaddr.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/net/linkaddr.c,v 1.4 2007/01/09 00:28:02 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/net/linkaddr.c,v 1.3 2002/03/21 18:49:23 obrien Exp $");
#include <sys/types.h>
#include <sys/socket.h>
@@ -50,7 +54,9 @@
#define LETTER (4*3)
void
-link_addr(const char *addr, struct sockaddr_dl *sdl)
+link_addr(addr, sdl)
+ const char *addr;
+ struct sockaddr_dl *sdl;
{
char *cp = sdl->sdl_data;
char *cplim = sdl->sdl_len + (char *)sdl;
@@ -116,10 +122,11 @@
return;
}
-static const char hexlist[] = "0123456789abcdef";
+static char hexlist[] = "0123456789abcdef";
char *
-link_ntoa(const struct sockaddr_dl *sdl)
+link_ntoa(sdl)
+ const struct sockaddr_dl *sdl;
{
static char obuf[64];
char *out = obuf;
@@ -127,18 +134,6 @@
u_char *in = (u_char *)LLADDR(sdl);
u_char *inlim = in + sdl->sdl_alen;
int firsttime = 1;
-
- /*
- * the length of the output string is length of network name (eg "le0")
- * plus 3 * each byte (eg. "XX.") assuming the print representation is
- * two bytes plus the period
- *
- * The ":" is accounted for as the last byte doesn't have a "." at the
- * end
- */
- if (sdl->sdl_nlen + 3*sdl->sdl_alen >= sizeof(obuf)) {
- goto exit;
- }
if (sdl->sdl_nlen) {
bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen);
@@ -157,12 +152,9 @@
i >>= 4;
out[0] = hexlist[i];
out += 2;
- } else {
+ } else
*out++ = hexlist[i];
- }
}
-
-exit:
*out = 0;
return (obuf);
}