summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dconschat/dconschat.c
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2004-05-26 22:59:55 +0000
committerbrooks <brooks@FreeBSD.org>2004-05-26 22:59:55 +0000
commit5b46c790ee2be794d0ddffea63668fec51c8f260 (patch)
tree911a427f57cebda0e7dc45f2fcb3047e0dfcc019 /usr.sbin/dconschat/dconschat.c
parent5ae1bd47055bb0a8824b70db8ecac0a96fa662c1 (diff)
downloadFreeBSD-src-5b46c790ee2be794d0ddffea63668fec51c8f260.zip
FreeBSD-src-5b46c790ee2be794d0ddffea63668fec51c8f260.tar.gz
Use new eui64(3) functions to print EUI-64s and to allow access to nodes
by EUI-64 and name. Reviewed by: simokawa
Diffstat (limited to 'usr.sbin/dconschat/dconschat.c')
-rw-r--r--usr.sbin/dconschat/dconschat.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/dconschat/dconschat.c b/usr.sbin/dconschat/dconschat.c
index 9c8b89d..d343811 100644
--- a/usr.sbin/dconschat/dconschat.c
+++ b/usr.sbin/dconschat/dconschat.c
@@ -50,6 +50,7 @@
#include <netdb.h>
#include <err.h>
#include <string.h>
+#include <sys/eui64.h>
#include <sys/event.h>
#include <sys/time.h>
#include <arpa/telnet.h>
@@ -809,11 +810,11 @@ main(int argc, char **argv)
{
struct dcons_state *dc;
struct fw_eui64 eui;
+ struct eui64 target;
char devname[256], *core = NULL, *system = NULL;
int i, ch, error;
int unit=0, wildcard=0;
int port[DCONS_NPORT];
- u_int64_t target = 0;
bzero(&sc, sizeof(sc));
dc = &sc;
@@ -841,9 +842,11 @@ main(int argc, char **argv)
dc->flags |= F_REPLAY;
break;
case 't':
- target = strtoull(optarg, NULL, 0);
- eui.hi = target >> 32;
- eui.lo = target & (((u_int64_t)1 << 32) - 1);
+ if (eui64_hostton(optarg, &target) != 0 &&
+ eui64_aton(optarg, &target) != 0)
+ errx(1, "invalid target: %s", optarg);
+ eui.hi = ntohl(*(u_int32_t*)&(target.octet[0]));
+ eui.lo = ntohl(*(u_int32_t*)&(target.octet[4]));
dc->type = TYPE_FW;
break;
case 'u':
OpenPOWER on IntegriCloud