diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-06 06:52:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-06 06:52:57 +0000 |
commit | 5376fd31099347e7811afd4a22b69886a4fd7669 (patch) | |
tree | f95b62e81bf3460491d2eab767ed604844abd600 /usr.sbin/arp/arp.c | |
parent | e02a3ff82cc56db1a75728f20c50cb2770516f62 (diff) |
not very well tested ether_aton() cleanup
Diffstat (limited to 'usr.sbin/arp/arp.c')
-rw-r--r-- | usr.sbin/arp/arp.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 6198ad7a22d..3633b087d03 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -75,7 +75,6 @@ static char *rcsid = "$NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $"; int delete __P((const char *, const char *)); void dump __P((u_long)); -int ether_aton __P((const char *, u_char *)); void ether_print __P((const u_char *)); int file __P((char *)); void get __P((const char *)); @@ -193,8 +192,9 @@ set(argc, argv) register struct sockaddr_inarp *sin; register struct sockaddr_dl *sdl; register struct rt_msghdr *rtm; - u_char *ea; - char *host = argv[0], *eaddr; + u_char *eaddr; + struct ether_addr *ea; + char *host = argv[0]; sin = &sin_m; rtm = &(m_rtmsg.m_rtm); @@ -207,9 +207,9 @@ set(argc, argv) sin_m = blank_sin; /* struct copy */ if (getinetaddr(host, &sin->sin_addr) == -1) return (1); - ea = (u_char *)LLADDR(&sdl_m); - if (ether_aton(eaddr, ea) == 0) - sdl_m.sdl_alen = 6; + ea = ether_aton(eaddr); + memcpy(LLADDR(&sdl_m), ea, sizeof (*ea)); + sdl_m.sdl_alen = 6; doing_proxy = flags = export_only = expire_time = 0; while (argc-- > 0) { if (strncmp(argv[0], "temp", 4) == 0) { @@ -424,24 +424,6 @@ ether_print(cp) cp[5]); } -int -ether_aton(a, n) - const char *a; - u_char *n; -{ - int i, o[6]; - - i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o[0], &o[1], &o[2], &o[3], &o[4], - &o[5]); - if (i != 6) { - warnx("invalid Ethernet address '%s'", a); - return (1); - } - for (i=0; i<6; i++) - n[i] = o[i]; - return (0); -} - void usage() { |