xref: /titanic_41/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_mip.c (revision 2e3b64671f0fdac42d7fb21a8fa7e3ce9fce3359)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*2e3b6467Skcpoon  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*2e3b6467Skcpoon  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <stdio.h>
307c478bd9Sstevel@tonic-gate #include <fcntl.h>
317c478bd9Sstevel@tonic-gate #include <sys/socket.h>
327c478bd9Sstevel@tonic-gate #include <netinet/in.h>
337c478bd9Sstevel@tonic-gate #include <protocols/routed.h>
347c478bd9Sstevel@tonic-gate #include <string.h>
357c478bd9Sstevel@tonic-gate #include <arpa/inet.h>
367c478bd9Sstevel@tonic-gate #include "snoop.h"
377c478bd9Sstevel@tonic-gate #include "snoop_mip.h"
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
407c478bd9Sstevel@tonic-gate  * This defines the length of internal, unbounded buffers. We set
417c478bd9Sstevel@tonic-gate  * this to be MAXLINE (the maximum verbose display line length) -
427c478bd9Sstevel@tonic-gate  * 64, which should be enough for all necessary descriptions.
437c478bd9Sstevel@tonic-gate  */
447c478bd9Sstevel@tonic-gate #define	BUFLEN	MAXLINE - 64
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate extern char *dlc_header;
477c478bd9Sstevel@tonic-gate extern char *addrtoname();
487c478bd9Sstevel@tonic-gate 
49*2e3b6467Skcpoon enum EXT_TYPE { ADV, REG };
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * This defines the interface for all extention interpreter
537c478bd9Sstevel@tonic-gate  * functions. The function will be called with following
547c478bd9Sstevel@tonic-gate  * parameters:
557c478bd9Sstevel@tonic-gate  *
567c478bd9Sstevel@tonic-gate  * type:	IN	The type code for this extention
577c478bd9Sstevel@tonic-gate  * len		IN	The length of the payload (i.e. the
587c478bd9Sstevel@tonic-gate  *			length field in an extension header)
597c478bd9Sstevel@tonic-gate  * payload	IN	A pointer to the beginning of the
607c478bd9Sstevel@tonic-gate  *			extension payload
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate typedef void interpreter_f(uint8_t type, uint8_t len, uchar_t *payload);
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate struct ext_dispatch {
657c478bd9Sstevel@tonic-gate 	uint8_t type;
667c478bd9Sstevel@tonic-gate 	interpreter_f *pfunc;
677c478bd9Sstevel@tonic-gate };
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* Description structure -- maps type to description */
707c478bd9Sstevel@tonic-gate struct ext_desc {
717c478bd9Sstevel@tonic-gate 	uint8_t type;
727c478bd9Sstevel@tonic-gate 	const char *desc;
737c478bd9Sstevel@tonic-gate };
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /*
767c478bd9Sstevel@tonic-gate  * Interpreter function prototypes for both adv and reg. These
777c478bd9Sstevel@tonic-gate  * all must implement the interpret_f interface defined above.
787c478bd9Sstevel@tonic-gate  */
797c478bd9Sstevel@tonic-gate static void spi_ext(uint8_t, uint8_t, uchar_t *);
807c478bd9Sstevel@tonic-gate static void key_ext(uint8_t, uint8_t, uchar_t *);
817c478bd9Sstevel@tonic-gate static void trav_ext(uint8_t, uint8_t, uchar_t *);
827c478bd9Sstevel@tonic-gate static void empty_ext(uint8_t, uint8_t, uchar_t *);
837c478bd9Sstevel@tonic-gate static void nai_ext(uint8_t, uint8_t, uchar_t *);
847c478bd9Sstevel@tonic-gate static void chall_ext(uint8_t, uint8_t, uchar_t *);
857c478bd9Sstevel@tonic-gate static void ma_ext(uint8_t, uint8_t, uchar_t *);
867c478bd9Sstevel@tonic-gate static void prefix_ext(uint8_t, uint8_t, uchar_t *);
877c478bd9Sstevel@tonic-gate static void unk_ext(uint8_t, uint8_t, uchar_t *);
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate /* R E G I S T R A T I O N */
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #define	REG_TBL_LEN	10	/* update this when adding to the table */
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate /* Reg: type to description mapping table */
947c478bd9Sstevel@tonic-gate static struct ext_desc reg_desc[] = {
957c478bd9Sstevel@tonic-gate 	MN_HA_AUTH,	"(Mobile-Home Authentication Extension)",
967c478bd9Sstevel@tonic-gate 	MN_FA_AUTH,	"(Mobile-Foreign Authentication Extension",
977c478bd9Sstevel@tonic-gate 	FA_HA_AUTH,	"(Foreign-Home Authentication Extension)",
987c478bd9Sstevel@tonic-gate 	GEN_AUTH,	"(Generalized Authentication Extension)",
997c478bd9Sstevel@tonic-gate 	MN_HA_KEY,	"(Mobile-Home Key Extension)",
1007c478bd9Sstevel@tonic-gate 	MN_FA_KEY,	"(Mobile-Foreign Key Extension)",
1017c478bd9Sstevel@tonic-gate 	MN_HA_TRAVERSE,	"(Firewall Traversal Extension)",
1027c478bd9Sstevel@tonic-gate 	ENCAP_DELIV,	"(Encapsulating Delivery Style Extension)",
1037c478bd9Sstevel@tonic-gate 	MN_NAI,		"(Mobile Node Network Access Identifier)",
1047c478bd9Sstevel@tonic-gate 	FA_CHALLENGE,	"(Mobile-Foreign Agent Challenge)",
1057c478bd9Sstevel@tonic-gate 	0,		"(Unrecognized Extension)"
1067c478bd9Sstevel@tonic-gate };
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate #define	GENAUTH_TBL_LEN	1	/* update this when adding to the table */
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /* Subtypes for Generic Authentication Extension type (type 36) */
1117c478bd9Sstevel@tonic-gate static struct ext_desc genauth_desc[] = {
1127c478bd9Sstevel@tonic-gate 	GEN_AUTH_MN_AAA,	"(MN-AAA Authentication Subtype)",
1137c478bd9Sstevel@tonic-gate 	0,			"(Unrecognized Subtype)"
1147c478bd9Sstevel@tonic-gate };
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /* Reg: type to function mapping table */
1177c478bd9Sstevel@tonic-gate static struct ext_dispatch reg_dispatch[] = {
1187c478bd9Sstevel@tonic-gate 	MN_HA_AUTH,	spi_ext,
1197c478bd9Sstevel@tonic-gate 	MN_FA_AUTH,	spi_ext,
1207c478bd9Sstevel@tonic-gate 	FA_HA_AUTH,	spi_ext,
1217c478bd9Sstevel@tonic-gate 	GEN_AUTH,	spi_ext,
1227c478bd9Sstevel@tonic-gate 	MN_HA_KEY,	key_ext,
1237c478bd9Sstevel@tonic-gate 	MN_FA_KEY,	key_ext,
1247c478bd9Sstevel@tonic-gate 	MN_HA_TRAVERSE,	trav_ext,
1257c478bd9Sstevel@tonic-gate 	ENCAP_DELIV,	empty_ext,
1267c478bd9Sstevel@tonic-gate 	MN_NAI,		nai_ext,
1277c478bd9Sstevel@tonic-gate 	FA_CHALLENGE,	chall_ext,
1287c478bd9Sstevel@tonic-gate 	0,		unk_ext
1297c478bd9Sstevel@tonic-gate };
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /* A D V E R T I S E M E N T */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate #define	ADV_TBL_LEN	5	/* update this when adding to the table */
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate /* Adv: type to description mapping table */
1367c478bd9Sstevel@tonic-gate static struct ext_desc adv_desc[] = {
1377c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_PADDING_EXT,	"(Padding)",
1387c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_MOBILITY_AGT_EXT,	"(Mobility Agent Extension)",
1397c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_PREFIX_LENGTH_EXT,	"(Prefix Lengths)",
1407c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_FA_CHALLENGE,	"(Foreign Agent Challenge)",
1417c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_FA_NAI,		"(Foreign Agent NAI)",
1427c478bd9Sstevel@tonic-gate 	0,				"(Unrecognized Extension)"
1437c478bd9Sstevel@tonic-gate };
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate /* Adv: type to function mapping table */
1467c478bd9Sstevel@tonic-gate static struct ext_dispatch adv_dispatch[] = {
1477c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_PADDING_EXT,	NULL,	/* never called */
1487c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_MOBILITY_AGT_EXT,	ma_ext,
1497c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_PREFIX_LENGTH_EXT,	prefix_ext,
1507c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_FA_CHALLENGE,	chall_ext,
1517c478bd9Sstevel@tonic-gate 	ICMP_ADV_MSG_FA_NAI,		nai_ext,
1527c478bd9Sstevel@tonic-gate 	0,				unk_ext
1537c478bd9Sstevel@tonic-gate };
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate #define	GETSPI(payload, hi, low) \
1567c478bd9Sstevel@tonic-gate 	(void) memcpy(&hi, payload, sizeof (hi)); \
1577c478bd9Sstevel@tonic-gate 	(void) memcpy(&low, payload + sizeof (hi), sizeof (low))
1587c478bd9Sstevel@tonic-gate 
dumphex(uchar_t * payload,int payload_len,char * buf,char * msg)1597c478bd9Sstevel@tonic-gate static void dumphex(uchar_t *payload, int payload_len, char *buf, char *msg) {
1607c478bd9Sstevel@tonic-gate 	int index;
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate 	for (index = 0; index < payload_len; index++) {
1637c478bd9Sstevel@tonic-gate 		(void) sprintf(&buf[index * 3], " %.2x", payload[index]);
1647c478bd9Sstevel@tonic-gate 	}
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line((char *)payload-dlc_header, 1), msg, buf);
1677c478bd9Sstevel@tonic-gate }
1687c478bd9Sstevel@tonic-gate 
get_desc(struct ext_desc table[],uint8_t type,int max)1697c478bd9Sstevel@tonic-gate static const char *get_desc(struct ext_desc table[], uint8_t type, int max) {
1707c478bd9Sstevel@tonic-gate 	int i;
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate 	for (i = 0; i < max && table[i].type != type; i++)
1737c478bd9Sstevel@tonic-gate 	    /* NO_OP */;
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate 	return (table[i].desc);
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /*
1797c478bd9Sstevel@tonic-gate  * The following is an accessor for the description table, used by
1807c478bd9Sstevel@tonic-gate  * snoop_icmp.c. This maintains the encapsulation of the internal
1817c478bd9Sstevel@tonic-gate  * description table.
1827c478bd9Sstevel@tonic-gate  */
get_mip_adv_desc(uint8_t type)1837c478bd9Sstevel@tonic-gate const char *get_mip_adv_desc(uint8_t type) {
1847c478bd9Sstevel@tonic-gate 	return (get_desc(adv_desc, type, ADV_TBL_LEN));
1857c478bd9Sstevel@tonic-gate }
1867c478bd9Sstevel@tonic-gate 
get_interpreter(struct ext_dispatch table[],uint8_t type,int max)1877c478bd9Sstevel@tonic-gate static interpreter_f *get_interpreter(struct ext_dispatch table[],
1887c478bd9Sstevel@tonic-gate 				uint8_t type,
1897c478bd9Sstevel@tonic-gate 				int max) {
1907c478bd9Sstevel@tonic-gate 	int i;
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate 	for (i = 0; i < max && table[i].type != type; i++)
1937c478bd9Sstevel@tonic-gate 	    /* NO_OP */;
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate 	return (table[i].pfunc);
1967c478bd9Sstevel@tonic-gate }
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate static int
interpret_extensions(uchar_t * ext,int regext_size,enum EXT_TYPE etype)1997c478bd9Sstevel@tonic-gate interpret_extensions(uchar_t *ext,
2007c478bd9Sstevel@tonic-gate 			int regext_size,
2017c478bd9Sstevel@tonic-gate 			enum EXT_TYPE etype) {
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate 	int curr_size  =  regext_size; /* remaining total for all exts */
2047c478bd9Sstevel@tonic-gate 	exthdr_t *exthdr;
2057c478bd9Sstevel@tonic-gate 	gen_exthdr_t *gen_exthdr;
2067c478bd9Sstevel@tonic-gate 	const char *st;
2077c478bd9Sstevel@tonic-gate 	uchar_t	*p;
2087c478bd9Sstevel@tonic-gate 	interpreter_f *f;
2097c478bd9Sstevel@tonic-gate 	uint8_t	ext_type;
2107c478bd9Sstevel@tonic-gate 	uint16_t ext_len;
2117c478bd9Sstevel@tonic-gate 	uint_t ext_hdrlen;
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate 	show_space();
2147c478bd9Sstevel@tonic-gate 	exthdr = (exthdr_t *)ALIGN(ext);
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate 	do {
2187c478bd9Sstevel@tonic-gate 	    ext_type = exthdr->type;
2197c478bd9Sstevel@tonic-gate 	    if (ext_type == GEN_AUTH) {
2207c478bd9Sstevel@tonic-gate 		gen_exthdr = (gen_exthdr_t *)exthdr;
2217c478bd9Sstevel@tonic-gate 		ext_hdrlen = sizeof (gen_exthdr_t);
2227c478bd9Sstevel@tonic-gate 		ext_len = ntohs(gen_exthdr->length);
2237c478bd9Sstevel@tonic-gate 	    } else {
2247c478bd9Sstevel@tonic-gate 		ext_hdrlen = sizeof (exthdr_t);
2257c478bd9Sstevel@tonic-gate 		ext_len = exthdr->length;
2267c478bd9Sstevel@tonic-gate 	    }
2277c478bd9Sstevel@tonic-gate 
2287c478bd9Sstevel@tonic-gate 	    if (!((etype == ADV && ext_type == ICMP_ADV_MSG_PADDING_EXT &&
2297c478bd9Sstevel@tonic-gate 		curr_size >= 1) ||
2307c478bd9Sstevel@tonic-gate 		curr_size >= ext_hdrlen + ext_len))
2317c478bd9Sstevel@tonic-gate 		    break;
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate 	    /* Print description for this extension */
2347c478bd9Sstevel@tonic-gate 	    if (etype == ADV) {
2357c478bd9Sstevel@tonic-gate 		st = get_desc(adv_desc, ext_type, ADV_TBL_LEN);
2367c478bd9Sstevel@tonic-gate 	    } else /* REG */ {
2377c478bd9Sstevel@tonic-gate 		st = get_desc(reg_desc, ext_type, REG_TBL_LEN);
2387c478bd9Sstevel@tonic-gate 	    }
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line((char *)exthdr-dlc_header, 1),
2417c478bd9Sstevel@tonic-gate 			"Extension header type = %d  %s", ext_type, st);
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate 	    if (ext_type == GEN_AUTH) {
2447c478bd9Sstevel@tonic-gate 		st = get_desc(genauth_desc, gen_exthdr->subtype,
2457c478bd9Sstevel@tonic-gate 		    GENAUTH_TBL_LEN);
2467c478bd9Sstevel@tonic-gate 		(void) sprintf(get_line((char *)exthdr-dlc_header, 1),
2477c478bd9Sstevel@tonic-gate 		    "Subtype = %d %s", gen_exthdr->subtype, st);
2487c478bd9Sstevel@tonic-gate 	    }
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate 	    /* Special case for 1-byte padding */
2517c478bd9Sstevel@tonic-gate 	    if (etype == ADV && ext_type == ICMP_ADV_MSG_PADDING_EXT) {
2527c478bd9Sstevel@tonic-gate 		exthdr = (exthdr_t *)((uchar_t *)exthdr + 1);
2537c478bd9Sstevel@tonic-gate 		curr_size--;
2547c478bd9Sstevel@tonic-gate 		continue;
2557c478bd9Sstevel@tonic-gate 	    }
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line((char *)&exthdr->length-dlc_header, 1),
2587c478bd9Sstevel@tonic-gate 			"Length = %d", ext_len);
2597c478bd9Sstevel@tonic-gate 
2607c478bd9Sstevel@tonic-gate 	    /* Parse out the extension's payload */
2617c478bd9Sstevel@tonic-gate 	    p = (uchar_t *)exthdr + ext_hdrlen;
2627c478bd9Sstevel@tonic-gate 	    curr_size -= (ext_hdrlen + ext_len);
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate 	    if (etype == ADV) {
2657c478bd9Sstevel@tonic-gate 		f = get_interpreter(adv_dispatch, ext_type, ADV_TBL_LEN);
2667c478bd9Sstevel@tonic-gate 	    } else /* REG */ {
2677c478bd9Sstevel@tonic-gate 		f = get_interpreter(reg_dispatch, ext_type, REG_TBL_LEN);
2687c478bd9Sstevel@tonic-gate 	    }
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate 	    f(ext_type, ext_len, p);
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate 	    show_space();
2737c478bd9Sstevel@tonic-gate 	    exthdr = (exthdr_t *)(p + ext_len);
2747c478bd9Sstevel@tonic-gate 	} while (B_TRUE);
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate 	return (0);
2777c478bd9Sstevel@tonic-gate }
2787c478bd9Sstevel@tonic-gate 
interpret_icmp_mip_ext(uchar_t * p,int len)2797c478bd9Sstevel@tonic-gate void interpret_icmp_mip_ext(uchar_t *p, int len) {
2807c478bd9Sstevel@tonic-gate 	show_space();
2817c478bd9Sstevel@tonic-gate 	show_header("ICMP:  ", " MIP Advertisement Extensions ", len);
2827c478bd9Sstevel@tonic-gate 	show_space();
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate 	interpret_extensions(p, len, ADV);
2857c478bd9Sstevel@tonic-gate }
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate void
interpret_mip_cntrlmsg(int flags,uchar_t * msg,int fraglen)2887c478bd9Sstevel@tonic-gate interpret_mip_cntrlmsg(int flags, uchar_t *msg, int fraglen) {
2897c478bd9Sstevel@tonic-gate 	char		*pt, *pc = NULL;
2907c478bd9Sstevel@tonic-gate 	char		*line;
2917c478bd9Sstevel@tonic-gate 	regreq_t	rreq[1];
2927c478bd9Sstevel@tonic-gate 	regrep_t	rrep[1];
2937c478bd9Sstevel@tonic-gate 	int		regext_size;
2947c478bd9Sstevel@tonic-gate 	uchar_t		*regext_data;
2957c478bd9Sstevel@tonic-gate 	struct in_addr	addr_temp;
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 	/* First byte of the message should be the type */
2997c478bd9Sstevel@tonic-gate 	switch (*msg) {
3007c478bd9Sstevel@tonic-gate 	case REG_TYPE_REQ:
3017c478bd9Sstevel@tonic-gate 		if (fraglen < sizeof (regreq_t))
3027c478bd9Sstevel@tonic-gate 			return;
3037c478bd9Sstevel@tonic-gate 		pt = (flags & F_DTAIL ? "registration request ":"reg rqst ");
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate 		(void) memcpy(rreq, msg, sizeof (*rreq));
3067c478bd9Sstevel@tonic-gate 		regext_size = fraglen - sizeof (regreq_t);
3077c478bd9Sstevel@tonic-gate 		regext_data = msg + sizeof (*rreq);
3087c478bd9Sstevel@tonic-gate 		break;
3097c478bd9Sstevel@tonic-gate 	case REG_TYPE_REP:
3107c478bd9Sstevel@tonic-gate 		if (fraglen < sizeof (regrep_t))
3117c478bd9Sstevel@tonic-gate 			return;
3127c478bd9Sstevel@tonic-gate 		pt = (flags & F_DTAIL ? "registration reply ":"reg reply ");
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate 		(void) memcpy(rrep, msg, sizeof (*rrep));
3157c478bd9Sstevel@tonic-gate 		regext_size = fraglen - sizeof (regrep_t);
3167c478bd9Sstevel@tonic-gate 		regext_data = msg + sizeof (*rrep);
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate 		switch (rrep->code) {
3197c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_ACK:
3207c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL)) ?
3217c478bd9Sstevel@tonic-gate 			    "OK" : "OK code 0";
3227c478bd9Sstevel@tonic-gate 			break;
3237c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_ACK_NO_SIMULTANEOUS:
3247c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3257c478bd9Sstevel@tonic-gate 			    "OK simultaneous bindings" : "OK code 1";
3267c478bd9Sstevel@tonic-gate 			break;
3277c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_UNSPECIFIED:
3287c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3297c478bd9Sstevel@tonic-gate 			    "FA denial: unspecified":"FA denial: code 64";
3307c478bd9Sstevel@tonic-gate 			break;
3317c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_PROHIBITED:
3327c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3337c478bd9Sstevel@tonic-gate 			    "FA denial: prohibited":"FA denial: code 65";
3347c478bd9Sstevel@tonic-gate 			break;
3357c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_RESOURCES:
3367c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3377c478bd9Sstevel@tonic-gate 			    "FA denial: no resources":"FA denial: code 66";
3387c478bd9Sstevel@tonic-gate 			break;
3397c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_MN_AUTH:
3407c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3417c478bd9Sstevel@tonic-gate 			    "FA denial: MN auth failed":"FA denial: code 67";
3427c478bd9Sstevel@tonic-gate 			break;
3437c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_HA_AUTH:
3447c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3457c478bd9Sstevel@tonic-gate 			    "FA denial: HA auth failed":
3467c478bd9Sstevel@tonic-gate 			    "FA denial: code 68";
3477c478bd9Sstevel@tonic-gate 			break;
3487c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_LIFETIME:
3497c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3507c478bd9Sstevel@tonic-gate 			    "FA denial: lifetime":"FA denial: code 69";
3517c478bd9Sstevel@tonic-gate 			break;
3527c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_BAD_REQUEST:
3537c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3547c478bd9Sstevel@tonic-gate 			    "FA denial: bad request": "FA: code 70";
3557c478bd9Sstevel@tonic-gate 			break;
3567c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_BAD_REPLY:
3577c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3587c478bd9Sstevel@tonic-gate 			    "FA denial: bad Reply":"FA denial: code 71";
3597c478bd9Sstevel@tonic-gate 			break;
3607c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_ENCAP_UNAVAILABLE:
3617c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3627c478bd9Sstevel@tonic-gate 			    "FA denial: encapsulation":"FA denial: code 72";
3637c478bd9Sstevel@tonic-gate 			break;
3647c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_VJ_UNAVAILABLE:
3657c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3667c478bd9Sstevel@tonic-gate 			    "FA denial: VJ compression":"FA denial: code 73";
3677c478bd9Sstevel@tonic-gate 			break;
3687c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_BIDIR_TUNNEL_UNAVAILABLE:
3697c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3707c478bd9Sstevel@tonic-gate 			    "FA denial: reverse tunnel unavailable":
3717c478bd9Sstevel@tonic-gate 				"FA denial: code 74";
3727c478bd9Sstevel@tonic-gate 			break;
3737c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_BIDIR_TUNNEL_NO_TBIT:
3747c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3757c478bd9Sstevel@tonic-gate 			    "FA denial: reverse tunnel: missing T-bit":
3767c478bd9Sstevel@tonic-gate 				"FA denial: code 75";
3777c478bd9Sstevel@tonic-gate 			break;
3787c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_BIDIR_TUNNEL_TOO_DISTANT:
3797c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3807c478bd9Sstevel@tonic-gate 			    "FA denial: reverse tunnel: too distant":
3817c478bd9Sstevel@tonic-gate 				"FA denial: code 76";
3827c478bd9Sstevel@tonic-gate 			break;
3837c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_ICMP_HA_NET_UNREACHABLE:
3847c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3857c478bd9Sstevel@tonic-gate 			    "FA denial: home network unreachable":
3867c478bd9Sstevel@tonic-gate 			    "FA denial: code 80";
3877c478bd9Sstevel@tonic-gate 			break;
3887c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_ICMP_HA_HOST_UNREACHABLE:
3897c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3907c478bd9Sstevel@tonic-gate 			    "FA denial: HA host unreachable":
3917c478bd9Sstevel@tonic-gate 			    "FA denial: code 81";
3927c478bd9Sstevel@tonic-gate 			break;
3937c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_ICMP_HA_PORT_UNREACHABLE:
3947c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
3957c478bd9Sstevel@tonic-gate 			    "FA denial: HA port unreachable":
3967c478bd9Sstevel@tonic-gate 			    "FA denial: code 82";
3977c478bd9Sstevel@tonic-gate 			break;
3987c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_FA_NACK_ICMP_HA_UNREACHABLE:
3997c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4007c478bd9Sstevel@tonic-gate 			    "FA denial: HA unreachable":"FA denial: code 88";
4017c478bd9Sstevel@tonic-gate 			break;
4027c478bd9Sstevel@tonic-gate 		case REPLY_CODE_FA_NACK_UNIQUE_HOMEADDR_REQD:
4037c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4047c478bd9Sstevel@tonic-gate 			    "FA denial: Unique Home Addr Required":
4057c478bd9Sstevel@tonic-gate 				"FA denial: code 96";
4067c478bd9Sstevel@tonic-gate 			break;
4077c478bd9Sstevel@tonic-gate 		case REPLY_CODE_FA_NACK_MISSING_NAI:
4087c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4097c478bd9Sstevel@tonic-gate 			    "FA denial: Missing NAI":
4107c478bd9Sstevel@tonic-gate 				"FA denial: code 97";
4117c478bd9Sstevel@tonic-gate 			break;
4127c478bd9Sstevel@tonic-gate 		case REPLY_CODE_FA_NACK_MISSING_HOME_AGENT:
4137c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4147c478bd9Sstevel@tonic-gate 			    "FA denial: Missing Home Agent":
4157c478bd9Sstevel@tonic-gate 				"FA denial: code 98";
4167c478bd9Sstevel@tonic-gate 			break;
4177c478bd9Sstevel@tonic-gate 		case REPLY_CODE_FA_NACK_UNKNOWN_CHALLENGE:
4187c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4197c478bd9Sstevel@tonic-gate 			    "FA denial: Unknown Challenge":
4207c478bd9Sstevel@tonic-gate 				"FA denial: code 104";
4217c478bd9Sstevel@tonic-gate 			break;
4227c478bd9Sstevel@tonic-gate 		case REPLY_CODE_FA_NACK_MISSING_CHALLENGE:
4237c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4247c478bd9Sstevel@tonic-gate 			    "FA denial: Missing Challenge":
4257c478bd9Sstevel@tonic-gate 				"FA denial: code 105";
4267c478bd9Sstevel@tonic-gate 			break;
4277c478bd9Sstevel@tonic-gate 		case REPLY_CODE_FA_NACK_MISSING_MN_FA:
4287c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4297c478bd9Sstevel@tonic-gate 			    "FA denial: Missing Mobile-Foreign Key Extension":
4307c478bd9Sstevel@tonic-gate 				"FA denial: code 106";
4317c478bd9Sstevel@tonic-gate 			break;
4327c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_UNSPECIFIED:
4337c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4347c478bd9Sstevel@tonic-gate 			    "HA denial: unspecified":"HA denial: code 128";
4357c478bd9Sstevel@tonic-gate 			break;
4367c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_PROHIBITED:
4377c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4387c478bd9Sstevel@tonic-gate 			    "HA denial: prohibited":"HA denial: code 129";
4397c478bd9Sstevel@tonic-gate 			break;
4407c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_RESOURCES:
4417c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4427c478bd9Sstevel@tonic-gate 			    "HA denial: no resources":"HA denial: code 130";
4437c478bd9Sstevel@tonic-gate 			break;
4447c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_MN_AUTH:
4457c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4467c478bd9Sstevel@tonic-gate 			    "HA denial: MN auth failed":"HA denial: code 131";
4477c478bd9Sstevel@tonic-gate 			break;
4487c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_FA_AUTH:
4497c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4507c478bd9Sstevel@tonic-gate 			    "HA denial: FA auth failed":"HA denial: code 132";
4517c478bd9Sstevel@tonic-gate 			break;
4527c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_ID_MISMATCH:
4537c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4547c478bd9Sstevel@tonic-gate 			    "HA denial: ID mismatch":"HA denial: code 133";
4557c478bd9Sstevel@tonic-gate 			break;
4567c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_BAD_REQUEST:
4577c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4587c478bd9Sstevel@tonic-gate 			    "HA denial: bad request":"HA denial: code 134";
4597c478bd9Sstevel@tonic-gate 			break;
4607c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_TOO_MANY_BINDINGS:
4617c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4627c478bd9Sstevel@tonic-gate 			    "HA denial: too many bindings":
4637c478bd9Sstevel@tonic-gate 			    "HA denial: code 135";
4647c478bd9Sstevel@tonic-gate 			break;
4657c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_BAD_HA_ADDRESS:
4667c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4677c478bd9Sstevel@tonic-gate 			    "HA denial: bad HA address":"HA denial: code 136";
4687c478bd9Sstevel@tonic-gate 			break;
4697c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_BIDIR_TUNNEL_UNAVAILABLE:
4707c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4717c478bd9Sstevel@tonic-gate 			    "HA denial: no reverse tunnel":
4727c478bd9Sstevel@tonic-gate 			    "HA denial: code 137";
4737c478bd9Sstevel@tonic-gate 			break;
4747c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_BIDIR_TUNNEL_NO_TBIT:
4757c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4767c478bd9Sstevel@tonic-gate 			    "HA denial: reverse tunnel: no T-bit":
4777c478bd9Sstevel@tonic-gate 			    "HA denial: code 138";
4787c478bd9Sstevel@tonic-gate 			break;
4797c478bd9Sstevel@tonic-gate 		case  REPLY_CODE_HA_NACK_BIDIR_ENCAP_UNAVAILABLE:
4807c478bd9Sstevel@tonic-gate 			pc = ((flags & F_ALLSUM) || (flags & F_DTAIL))?
4817c478bd9Sstevel@tonic-gate 			    "HA denial: encapsulation unavailable":
4827c478bd9Sstevel@tonic-gate 			    "HA denial: code 139";
4837c478bd9Sstevel@tonic-gate 			break;
4847c478bd9Sstevel@tonic-gate 		default:
4857c478bd9Sstevel@tonic-gate 			pc = "?";
4867c478bd9Sstevel@tonic-gate 			break;
4877c478bd9Sstevel@tonic-gate 		}
4887c478bd9Sstevel@tonic-gate 		break;
4897c478bd9Sstevel@tonic-gate 
4907c478bd9Sstevel@tonic-gate 	default :
4917c478bd9Sstevel@tonic-gate 		break;
4927c478bd9Sstevel@tonic-gate 	}
4937c478bd9Sstevel@tonic-gate 	if (flags & F_SUM) {
4947c478bd9Sstevel@tonic-gate 		line = get_sum_line();
4957c478bd9Sstevel@tonic-gate 
4967c478bd9Sstevel@tonic-gate 		if (pc != NULL)
4977c478bd9Sstevel@tonic-gate 			(void) sprintf(line, "Mobile IP %s(%s)", pt, pc);
4987c478bd9Sstevel@tonic-gate 		else
4997c478bd9Sstevel@tonic-gate 			(void) sprintf(line, "Mobile IP %s", pt);
5007c478bd9Sstevel@tonic-gate 	}
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate 	if (flags & F_DTAIL) {
5037c478bd9Sstevel@tonic-gate 		show_header("MIP:  ", "Mobile IP Header", fraglen);
5047c478bd9Sstevel@tonic-gate 		show_space();
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate 		if (*msg == REG_TYPE_REQ) {
5077c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line((char *)&rreq -
5087c478bd9Sstevel@tonic-gate 			    dlc_header, 1), "Registration header type = %s",
5097c478bd9Sstevel@tonic-gate 			    pt);
5107c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5117c478bd9Sstevel@tonic-gate 			    (char *)(((uchar_t *)&rreq) + 1) - dlc_header, 1),
5127c478bd9Sstevel@tonic-gate 			    "%d... .... = %s simultaneous bindings  ",
5137c478bd9Sstevel@tonic-gate 			    (rreq->Simultaneous_registration == 1)? 1 : 0,
5147c478bd9Sstevel@tonic-gate 			    (rreq->Simultaneous_registration == 1)? "":"no");
5157c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5167c478bd9Sstevel@tonic-gate 			    (char *)(((uchar_t *)&rreq) + 1) - dlc_header, 1),
5177c478bd9Sstevel@tonic-gate 			    ".%d.. .... = %s broadcast datagrams ",
5187c478bd9Sstevel@tonic-gate 			    (rreq->Broadcasts_desired == 1) ?  1 : 0,
5197c478bd9Sstevel@tonic-gate 			    (rreq->Broadcasts_desired == 1) ? "":"no");
5207c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5217c478bd9Sstevel@tonic-gate 			    (char *)(((uchar_t *)&rreq) + 1) - dlc_header, 1),
5227c478bd9Sstevel@tonic-gate 			    "..%d. .... = %s decapsulation by MN",
5237c478bd9Sstevel@tonic-gate 			    (rreq->Decapsulation_done_locally == 1) ? 1 : 0,
5247c478bd9Sstevel@tonic-gate 			    (rreq->Decapsulation_done_locally == 1) ?
5257c478bd9Sstevel@tonic-gate 				"" : "no");
5267c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5277c478bd9Sstevel@tonic-gate 			    (char *)(((uchar_t *)&rreq) + 1) - dlc_header, 1),
5287c478bd9Sstevel@tonic-gate 			    "...%d .... = %s minimum encapsulation ",
5297c478bd9Sstevel@tonic-gate 			    (rreq->Minimal_encap_desired == 1) ? 1 : 0,
5307c478bd9Sstevel@tonic-gate 			    (rreq->Minimal_encap_desired == 1) ? "" : "no");
5317c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5327c478bd9Sstevel@tonic-gate 			    (char *)(((uchar_t *)&rreq) + 1) - dlc_header, 1),
5337c478bd9Sstevel@tonic-gate 			    ".... %d... = %s GRE encapsulation ",
5347c478bd9Sstevel@tonic-gate 			    (rreq->GRE_encap_desired == 1) ? 1 : 0,
5357c478bd9Sstevel@tonic-gate 			    (rreq->GRE_encap_desired == 1) ? "" : "no");
5367c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5377c478bd9Sstevel@tonic-gate 			    (char *)(((uchar_t *)&rreq) + 1) - dlc_header, 1),
5387c478bd9Sstevel@tonic-gate 			    ".... .%d.. = %s VJ hdr Compression ",
5397c478bd9Sstevel@tonic-gate 			    (rreq->VJ_compression_desired == 1) ? 1 : 0,
5407c478bd9Sstevel@tonic-gate 			    (rreq->VJ_compression_desired == 1) ? "" : "no");
5417c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5427c478bd9Sstevel@tonic-gate 			    (char *)(((uchar_t *)&rreq) + 1) - dlc_header, 1),
5437c478bd9Sstevel@tonic-gate 			    ".... ..%d. = %s reverse tunnel",
5447c478bd9Sstevel@tonic-gate 			    (rreq->BiDirectional_Tunnel_desired == 1) ? 1 : 0,
5457c478bd9Sstevel@tonic-gate 			    (rreq->BiDirectional_Tunnel_desired == 1) ?
5467c478bd9Sstevel@tonic-gate 				"" : "no");
5477c478bd9Sstevel@tonic-gate 			if (ntohs(rreq->lifetime) == 0xffff) {
5487c478bd9Sstevel@tonic-gate 				(void) sprintf(get_line(
5497c478bd9Sstevel@tonic-gate 				    (char *)&rreq->lifetime - dlc_header, 1),
5507c478bd9Sstevel@tonic-gate 				    "Life Time = 0xFFFF (infinity)");
5517c478bd9Sstevel@tonic-gate 			} else if (ntohs(rreq->lifetime) == 0) {
5527c478bd9Sstevel@tonic-gate 				(void) sprintf(get_line(
5537c478bd9Sstevel@tonic-gate 				    (char *)&rreq->lifetime - dlc_header, 1),
5547c478bd9Sstevel@tonic-gate 				    "Life Time = 0 "
5557c478bd9Sstevel@tonic-gate 				    "(request for de-registration)");
5567c478bd9Sstevel@tonic-gate 			} else {
5577c478bd9Sstevel@tonic-gate 				(void) sprintf(get_line(
5587c478bd9Sstevel@tonic-gate 				    (char *)&rreq->lifetime - dlc_header, 1),
5597c478bd9Sstevel@tonic-gate 				    "Life time = %d seconds",
5607c478bd9Sstevel@tonic-gate 				    ntohs(rreq->lifetime));
5617c478bd9Sstevel@tonic-gate 			}
5627c478bd9Sstevel@tonic-gate 			addr_temp.s_addr = rreq->home_addr;
5637c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5647c478bd9Sstevel@tonic-gate 			    (char *)&rreq->home_addr - dlc_header, 1),
5657c478bd9Sstevel@tonic-gate 			    "Home address = %s, %s",
5667c478bd9Sstevel@tonic-gate 			    inet_ntoa(addr_temp),
5677c478bd9Sstevel@tonic-gate 			    addrtoname(AF_INET, &addr_temp));
5687c478bd9Sstevel@tonic-gate 			addr_temp.s_addr = rreq->home_agent_addr;
5697c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5707c478bd9Sstevel@tonic-gate 			    (char *)&rreq->home_agent_addr - dlc_header, 1),
5717c478bd9Sstevel@tonic-gate 			    "Home Agent address = %s, %s",
5727c478bd9Sstevel@tonic-gate 			    inet_ntoa(addr_temp),
5737c478bd9Sstevel@tonic-gate 			    addrtoname(AF_INET, &addr_temp));
5747c478bd9Sstevel@tonic-gate 			addr_temp.s_addr = rreq->care_of_addr;
5757c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5767c478bd9Sstevel@tonic-gate 			    (char *)&rreq->care_of_addr - dlc_header, 1),
5777c478bd9Sstevel@tonic-gate 			    "Care of address = %s, %s",
5787c478bd9Sstevel@tonic-gate 			    inet_ntoa(addr_temp),
5797c478bd9Sstevel@tonic-gate 			    addrtoname(AF_INET, &addr_temp));
5807c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
5817c478bd9Sstevel@tonic-gate 			    (char *)&rreq->identification - dlc_header, 1),
5827c478bd9Sstevel@tonic-gate 			    "Identification = 0x%x-%x",
5837c478bd9Sstevel@tonic-gate 			    ntohl(rreq->identification.high_bits),
5847c478bd9Sstevel@tonic-gate 			    ntohl(rreq->identification.low_bits));
5857c478bd9Sstevel@tonic-gate 		} else if (*msg == REG_TYPE_REP) {
5867c478bd9Sstevel@tonic-gate 			(void) sprintf(
5877c478bd9Sstevel@tonic-gate 			    get_line((char *)&rrep->type - dlc_header, 1),
5887c478bd9Sstevel@tonic-gate 			    "Registration header type = %d (%s)",
5897c478bd9Sstevel@tonic-gate 			    (int)rrep->type, pt);
5907c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line((char *)&rrep - dlc_header, 1),
5917c478bd9Sstevel@tonic-gate 			    "Code = %d %s", (int)rrep->code, pc);
5927c478bd9Sstevel@tonic-gate 			if (ntohs(rrep->lifetime) == 0xffff) {
5937c478bd9Sstevel@tonic-gate 				(void) sprintf(get_line(
5947c478bd9Sstevel@tonic-gate 				    (char *)&rrep->lifetime - dlc_header, 1),
5957c478bd9Sstevel@tonic-gate 				    "Life time = 0xFFFF (infinity)");
5967c478bd9Sstevel@tonic-gate 			} else if (ntohs(rrep->lifetime) == 0) {
5977c478bd9Sstevel@tonic-gate 				(void) sprintf(get_line(
5987c478bd9Sstevel@tonic-gate 				    (char *)&rrep->lifetime - dlc_header, 1),
5997c478bd9Sstevel@tonic-gate 				    ((rrep->code == REPLY_CODE_ACK) ||
6007c478bd9Sstevel@tonic-gate 				    (rrep->code ==
6017c478bd9Sstevel@tonic-gate 					REPLY_CODE_ACK_NO_SIMULTANEOUS))?
6027c478bd9Sstevel@tonic-gate 				    "Life time = 0 (de-registeration success)" :
6037c478bd9Sstevel@tonic-gate 				    "Life time = 0 (de-registration failed)");
6047c478bd9Sstevel@tonic-gate 			} else {
6057c478bd9Sstevel@tonic-gate 				(void) sprintf(get_line(
6067c478bd9Sstevel@tonic-gate 				    (char *)&rrep->lifetime - dlc_header, 1),
6077c478bd9Sstevel@tonic-gate 				    "Life time = %d seconds",
6087c478bd9Sstevel@tonic-gate 				    ntohs(rrep->lifetime));
6097c478bd9Sstevel@tonic-gate 			}
6107c478bd9Sstevel@tonic-gate 			addr_temp.s_addr = rrep->home_addr;
6117c478bd9Sstevel@tonic-gate 			(void) sprintf(
6127c478bd9Sstevel@tonic-gate 			    get_line((char *)&rrep->home_addr - dlc_header, 1),
6137c478bd9Sstevel@tonic-gate 			    "Home address = %s, %s",
6147c478bd9Sstevel@tonic-gate 			    inet_ntoa(addr_temp),
6157c478bd9Sstevel@tonic-gate 			    addrtoname(AF_INET, &addr_temp));
6167c478bd9Sstevel@tonic-gate 			addr_temp.s_addr = rrep->home_agent_addr;
6177c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
6187c478bd9Sstevel@tonic-gate 			    (char *)&rrep->home_agent_addr - dlc_header, 1),
6197c478bd9Sstevel@tonic-gate 			    "Home Agent address = %s, %s",
6207c478bd9Sstevel@tonic-gate 			    inet_ntoa(addr_temp),
6217c478bd9Sstevel@tonic-gate 			    addrtoname(AF_INET, &addr_temp));
6227c478bd9Sstevel@tonic-gate 			(void) sprintf(get_line(
6237c478bd9Sstevel@tonic-gate 			    (char *)&rrep->identification - dlc_header, 1),
6247c478bd9Sstevel@tonic-gate 			    "Identification = 0x%x-%x",
6257c478bd9Sstevel@tonic-gate 			    ntohl(rrep->identification.high_bits),
6267c478bd9Sstevel@tonic-gate 			    ntohl(rrep->identification.low_bits));
6277c478bd9Sstevel@tonic-gate 		}
6287c478bd9Sstevel@tonic-gate 		fraglen = interpret_extensions(regext_data, regext_size, REG);
6297c478bd9Sstevel@tonic-gate 	}
6307c478bd9Sstevel@tonic-gate }
6317c478bd9Sstevel@tonic-gate 
6327c478bd9Sstevel@tonic-gate /*ARGSUSED*/
spi_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)6337c478bd9Sstevel@tonic-gate static void spi_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
6347c478bd9Sstevel@tonic-gate 	uint16_t spi_hi, spi_low;
6357c478bd9Sstevel@tonic-gate 	char	auth_prn_str[BUFLEN];
6367c478bd9Sstevel@tonic-gate 
6377c478bd9Sstevel@tonic-gate 	/* SPI */
6387c478bd9Sstevel@tonic-gate 	GETSPI(p, spi_hi, spi_low);
6397c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line((char *)p - dlc_header, 1),
6407c478bd9Sstevel@tonic-gate 			"Security Parameter Index = 0x%x%x",
6417c478bd9Sstevel@tonic-gate 			ntohs(spi_hi), ntohs(spi_low));
6427c478bd9Sstevel@tonic-gate 	p += sizeof (spi_hi) + sizeof (spi_low);
6437c478bd9Sstevel@tonic-gate 	this_ext_len -= sizeof (spi_hi) + sizeof (spi_low);
6447c478bd9Sstevel@tonic-gate 
6457c478bd9Sstevel@tonic-gate 	/* The rest is the authenticator; dump it in hex */
6467c478bd9Sstevel@tonic-gate 	dumphex(p,
6477c478bd9Sstevel@tonic-gate 		/* don't write past our string buffer ... */
6487c478bd9Sstevel@tonic-gate 		(this_ext_len*3 > BUFLEN ? BUFLEN : this_ext_len),
6497c478bd9Sstevel@tonic-gate 		auth_prn_str,
6507c478bd9Sstevel@tonic-gate 		"Authenticator = %s");
6517c478bd9Sstevel@tonic-gate }
6527c478bd9Sstevel@tonic-gate 
key_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)6537c478bd9Sstevel@tonic-gate static void key_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
6547c478bd9Sstevel@tonic-gate 	uint16_t alg, spi_hi, spi_low;
6557c478bd9Sstevel@tonic-gate 	char *alg_string;
6567c478bd9Sstevel@tonic-gate 	char *hafa = (type == MN_HA_KEY ? "HA" : "FA");
6577c478bd9Sstevel@tonic-gate 	char sec_msg[32];
6587c478bd9Sstevel@tonic-gate 	char auth_prn_str[BUFLEN];
6597c478bd9Sstevel@tonic-gate 
6607c478bd9Sstevel@tonic-gate 	/* Algorithm Type */
6617c478bd9Sstevel@tonic-gate 	(void) memcpy(&alg, p, sizeof (alg));
6627c478bd9Sstevel@tonic-gate 	alg = ntohs(alg);
6637c478bd9Sstevel@tonic-gate 	switch (alg) {
6647c478bd9Sstevel@tonic-gate 	case KEY_ALG_NONE:
6657c478bd9Sstevel@tonic-gate 	    alg_string = "None";
6667c478bd9Sstevel@tonic-gate 	    break;
6677c478bd9Sstevel@tonic-gate 	case SA_MD5_MODE_PREF_SUF:
6687c478bd9Sstevel@tonic-gate 	    alg_string = "MD5/prefix+suffix";
6697c478bd9Sstevel@tonic-gate 	    break;
6707c478bd9Sstevel@tonic-gate 	case SA_HMAC_MD5:
6717c478bd9Sstevel@tonic-gate 	    alg_string = "HMAC MD5";
6727c478bd9Sstevel@tonic-gate 	    break;
6737c478bd9Sstevel@tonic-gate 	default:
6747c478bd9Sstevel@tonic-gate 	    alg_string = "Unknown";
6757c478bd9Sstevel@tonic-gate 	    break;
6767c478bd9Sstevel@tonic-gate 	}
6777c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line((char *)p-dlc_header, 1),
6787c478bd9Sstevel@tonic-gate 			"Algorithm = 0x%x: %s", alg, alg_string);
6797c478bd9Sstevel@tonic-gate 	p += sizeof (alg);
6807c478bd9Sstevel@tonic-gate 	this_ext_len -= sizeof (alg);
6817c478bd9Sstevel@tonic-gate 
6827c478bd9Sstevel@tonic-gate 	/* AAA SPI */
6837c478bd9Sstevel@tonic-gate 	GETSPI(p, spi_hi, spi_low);
6847c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line((char *)p - dlc_header, 1),
6857c478bd9Sstevel@tonic-gate 			"AAA Security Parameter Index = 0x%x%x",
6867c478bd9Sstevel@tonic-gate 			ntohs(spi_hi), ntohs(spi_low));
6877c478bd9Sstevel@tonic-gate 	p += sizeof (spi_hi) + sizeof (spi_low);
6887c478bd9Sstevel@tonic-gate 	this_ext_len -= sizeof (spi_hi) + sizeof (spi_low);
6897c478bd9Sstevel@tonic-gate 
6907c478bd9Sstevel@tonic-gate 	/* HA / FA SPI */
6917c478bd9Sstevel@tonic-gate 	GETSPI(p, spi_hi, spi_low);
6927c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line((char *)p - dlc_header, 1),
6937c478bd9Sstevel@tonic-gate 			"%s Security Parameter Index = 0x%x%x",
6947c478bd9Sstevel@tonic-gate 			hafa, ntohs(spi_hi), ntohs(spi_low));
6957c478bd9Sstevel@tonic-gate 	p += sizeof (spi_hi) + sizeof (spi_low);
6967c478bd9Sstevel@tonic-gate 	this_ext_len -= sizeof (spi_hi) + sizeof (spi_low);
6977c478bd9Sstevel@tonic-gate 
6987c478bd9Sstevel@tonic-gate 	/* The rest is the security info; dump it in hex */
6997c478bd9Sstevel@tonic-gate 	sprintf(sec_msg, "%s Security Info = %%s", hafa);
7007c478bd9Sstevel@tonic-gate 	dumphex(p,
7017c478bd9Sstevel@tonic-gate 		/* don't write past our string buffer ... */
7027c478bd9Sstevel@tonic-gate 		(this_ext_len*3 > BUFLEN ? BUFLEN : this_ext_len),
7037c478bd9Sstevel@tonic-gate 		auth_prn_str,
7047c478bd9Sstevel@tonic-gate 		sec_msg);
7057c478bd9Sstevel@tonic-gate }
7067c478bd9Sstevel@tonic-gate 
7077c478bd9Sstevel@tonic-gate /*ARGSUSED*/
trav_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)7087c478bd9Sstevel@tonic-gate static void trav_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
7097c478bd9Sstevel@tonic-gate 	struct in_addr addr_temp;
7107c478bd9Sstevel@tonic-gate 
7117c478bd9Sstevel@tonic-gate 	/* skip reserved */
7127c478bd9Sstevel@tonic-gate 	p += 2;
7137c478bd9Sstevel@tonic-gate 	this_ext_len -= 2;
7147c478bd9Sstevel@tonic-gate 
7157c478bd9Sstevel@tonic-gate 	/* Mobile-Home Traversal Address */
7167c478bd9Sstevel@tonic-gate 	(void) memcpy(&(addr_temp.s_addr), p, sizeof (addr_temp.s_addr));
7177c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line((char *)p-dlc_header, 1),
7187c478bd9Sstevel@tonic-gate 			"Mobile-Home Traversal Address= %s, %s",
7197c478bd9Sstevel@tonic-gate 			inet_ntoa(addr_temp),
7207c478bd9Sstevel@tonic-gate 			addrtoname(AF_INET, &addr_temp));
7217c478bd9Sstevel@tonic-gate 	p += sizeof (addr_temp.s_addr);
7227c478bd9Sstevel@tonic-gate 	this_ext_len -= sizeof (addr_temp.s_addr);
7237c478bd9Sstevel@tonic-gate 
7247c478bd9Sstevel@tonic-gate 	/* Home-Mobile Traversal Address */
7257c478bd9Sstevel@tonic-gate 	(void) memcpy(&(addr_temp.s_addr), p, sizeof (addr_temp.s_addr));
7267c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line((char *)p-dlc_header, 1),
7277c478bd9Sstevel@tonic-gate 			"Home-Mobile Traversal Address= %s, %s",
7287c478bd9Sstevel@tonic-gate 			inet_ntoa(addr_temp),
7297c478bd9Sstevel@tonic-gate 			addrtoname(AF_INET, &addr_temp));
7307c478bd9Sstevel@tonic-gate }
7317c478bd9Sstevel@tonic-gate 
7327c478bd9Sstevel@tonic-gate /*ARGSUSED*/
empty_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)7337c478bd9Sstevel@tonic-gate static void empty_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
7347c478bd9Sstevel@tonic-gate 	/* no payload */
7357c478bd9Sstevel@tonic-gate }
7367c478bd9Sstevel@tonic-gate 
7377c478bd9Sstevel@tonic-gate /*ARGSUSED*/
nai_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)7387c478bd9Sstevel@tonic-gate static void nai_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
7397c478bd9Sstevel@tonic-gate 	/* payload points to the NAI */
7407c478bd9Sstevel@tonic-gate 	char *desc = "Network Access Identifier = ";
7417c478bd9Sstevel@tonic-gate 	size_t desclen = strlen(desc) + 1 + this_ext_len;
7427c478bd9Sstevel@tonic-gate 
7437c478bd9Sstevel@tonic-gate 	(void) snprintf(get_line((char *)p-dlc_header, 1),
7447c478bd9Sstevel@tonic-gate 			desclen > MAXLINE ? MAXLINE : desclen,
7457c478bd9Sstevel@tonic-gate 			"%s%s", desc, p);
7467c478bd9Sstevel@tonic-gate }
7477c478bd9Sstevel@tonic-gate 
7487c478bd9Sstevel@tonic-gate /*ARGSUSED*/
chall_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)7497c478bd9Sstevel@tonic-gate static void chall_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
7507c478bd9Sstevel@tonic-gate 	char	auth_prn_str[BUFLEN];
7517c478bd9Sstevel@tonic-gate 
7527c478bd9Sstevel@tonic-gate 	/* payload points to the challenge */
7537c478bd9Sstevel@tonic-gate 	dumphex(p,
7547c478bd9Sstevel@tonic-gate 		/* don't write past our string buffer ... */
7557c478bd9Sstevel@tonic-gate 		(this_ext_len*3 > BUFLEN ? BUFLEN / 3 : this_ext_len),
7567c478bd9Sstevel@tonic-gate 		auth_prn_str,
7577c478bd9Sstevel@tonic-gate 		"Challenge = %s");
7587c478bd9Sstevel@tonic-gate }
7597c478bd9Sstevel@tonic-gate 
7607c478bd9Sstevel@tonic-gate /*ARGSUSED*/
ma_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)7617c478bd9Sstevel@tonic-gate static void ma_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
7627c478bd9Sstevel@tonic-gate 	mobagtadvext_t adv_ext[1];
7637c478bd9Sstevel@tonic-gate 	int i, len;
7647c478bd9Sstevel@tonic-gate 	struct in_addr temp_addr;
7657c478bd9Sstevel@tonic-gate 
7667c478bd9Sstevel@tonic-gate 	(void) memcpy(adv_ext, p - sizeof (exthdr_t), sizeof (*adv_ext));
7677c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0), "Sequence number = %d",
7687c478bd9Sstevel@tonic-gate 			ntohs(adv_ext->sequence_num));
7697c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0),
7707c478bd9Sstevel@tonic-gate 			"Registration lifetime = %d seconds",
7717c478bd9Sstevel@tonic-gate 			ntohs(adv_ext->reg_lifetime));
7727c478bd9Sstevel@tonic-gate 	if (adv_ext->reg_bit) {
7737c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
7747c478bd9Sstevel@tonic-gate 				"1... .... = registration required "
7757c478bd9Sstevel@tonic-gate 				"through FA");
7767c478bd9Sstevel@tonic-gate 	} else {
7777c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
7787c478bd9Sstevel@tonic-gate 				"0... .... = registration not required "
7797c478bd9Sstevel@tonic-gate 				"through FA");
7807c478bd9Sstevel@tonic-gate 	}
7817c478bd9Sstevel@tonic-gate 	if (adv_ext->busy_bit) {
7827c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0), ".1.. .... = FA busy");
7837c478bd9Sstevel@tonic-gate 	} else {
7847c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0), ".0.. .... = FA not busy");
7857c478bd9Sstevel@tonic-gate 	}
7867c478bd9Sstevel@tonic-gate 	if (adv_ext->ha_bit) {
7877c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0), "..1. .... = node is HA");
7887c478bd9Sstevel@tonic-gate 	} else {
7897c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0), "..0. .... = node not HA");
7907c478bd9Sstevel@tonic-gate 	}
7917c478bd9Sstevel@tonic-gate 	if (adv_ext->fa_bit) {
7927c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0), "...1 .... = node is FA ");
7937c478bd9Sstevel@tonic-gate 	} else {
7947c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0), "...0 .... = node not FA ");
7957c478bd9Sstevel@tonic-gate 	}
7967c478bd9Sstevel@tonic-gate 	if (adv_ext->minencap_bit) {
7977c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0), ".... 1... = minimal encapsulation "
7987c478bd9Sstevel@tonic-gate 							"supported");
7997c478bd9Sstevel@tonic-gate 	} else {
8007c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8017c478bd9Sstevel@tonic-gate 				".... 0... = no minimal encapsulation");
8027c478bd9Sstevel@tonic-gate 	}
8037c478bd9Sstevel@tonic-gate 	if (adv_ext->greencap_bit) {
8047c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8057c478bd9Sstevel@tonic-gate 				".... .1.. =  GRE encapsulation supported");
8067c478bd9Sstevel@tonic-gate 	} else {
8077c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8087c478bd9Sstevel@tonic-gate 				".... .0.. = no GRE encapsulation");
8097c478bd9Sstevel@tonic-gate 	}
8107c478bd9Sstevel@tonic-gate 	if (adv_ext->vanjacob_hdr_comp_bit) {
8117c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8127c478bd9Sstevel@tonic-gate 				".... ..1. = VJ header compression");
8137c478bd9Sstevel@tonic-gate 	} else {
8147c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8157c478bd9Sstevel@tonic-gate 				".... ..0. = no VJ header compression");
8167c478bd9Sstevel@tonic-gate 	}
8177c478bd9Sstevel@tonic-gate 	if (adv_ext->reverse_tunnel_bit) {
8187c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8197c478bd9Sstevel@tonic-gate 				".... ...1 = reverse tunneling supported");
8207c478bd9Sstevel@tonic-gate 	} else {
8217c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8227c478bd9Sstevel@tonic-gate 				".... ...0 = no reverse tunneling");
8237c478bd9Sstevel@tonic-gate 	}
8247c478bd9Sstevel@tonic-gate 	(void) sprintf(get_line(0, 0),
8257c478bd9Sstevel@tonic-gate 			"Reserved Byte = 0x%x", adv_ext->reserved);
8267c478bd9Sstevel@tonic-gate 
8277c478bd9Sstevel@tonic-gate 	/* Parse out COA's */
8287c478bd9Sstevel@tonic-gate 	p += sizeof (*adv_ext);
8297c478bd9Sstevel@tonic-gate 	len = this_ext_len + sizeof (exthdr_t);
8307c478bd9Sstevel@tonic-gate 	/* this_ext_len is unsigned, and here we need a signed number */
8317c478bd9Sstevel@tonic-gate 	len -= sizeof (*adv_ext);
8327c478bd9Sstevel@tonic-gate 
8337c478bd9Sstevel@tonic-gate 	for (i = 0; len >= sizeof (temp_addr.s_addr); i++) {
8347c478bd9Sstevel@tonic-gate 	    memcpy(&(temp_addr.s_addr), p - sizeof (exthdr_t),
8357c478bd9Sstevel@tonic-gate 		sizeof (temp_addr.s_addr));
8367c478bd9Sstevel@tonic-gate 
8377c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8387c478bd9Sstevel@tonic-gate 				"Care of address-%d = %s, %s", i,
8397c478bd9Sstevel@tonic-gate 				inet_ntoa(temp_addr),
8407c478bd9Sstevel@tonic-gate 				addrtoname(AF_INET, &temp_addr));
8417c478bd9Sstevel@tonic-gate 
8427c478bd9Sstevel@tonic-gate 	    p += sizeof (temp_addr);
8437c478bd9Sstevel@tonic-gate 	    len -= sizeof (temp_addr);
8447c478bd9Sstevel@tonic-gate 	}
8457c478bd9Sstevel@tonic-gate }
8467c478bd9Sstevel@tonic-gate 
8477c478bd9Sstevel@tonic-gate /*ARGSUSED*/
prefix_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)8487c478bd9Sstevel@tonic-gate static void prefix_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
8497c478bd9Sstevel@tonic-gate 	int i;
8507c478bd9Sstevel@tonic-gate 
8517c478bd9Sstevel@tonic-gate 	for (i = 0; i < this_ext_len; i++) {
8527c478bd9Sstevel@tonic-gate 	    (void) sprintf(get_line(0, 0),
8537c478bd9Sstevel@tonic-gate 				"Prefix length of router address[%d] "
8547c478bd9Sstevel@tonic-gate 				"= %d bits",
8557c478bd9Sstevel@tonic-gate 				i, p[i]);
8567c478bd9Sstevel@tonic-gate 	}
8577c478bd9Sstevel@tonic-gate }
8587c478bd9Sstevel@tonic-gate 
8597c478bd9Sstevel@tonic-gate /*ARGSUSED*/
unk_ext(uint8_t type,uint8_t this_ext_len,uchar_t * p)8607c478bd9Sstevel@tonic-gate static void unk_ext(uint8_t type, uint8_t this_ext_len, uchar_t *p) {
8617c478bd9Sstevel@tonic-gate 	char	auth_prn_str[BUFLEN];
8627c478bd9Sstevel@tonic-gate 
8637c478bd9Sstevel@tonic-gate 	/* Unknown extension; just dump the rest of the payload */
8647c478bd9Sstevel@tonic-gate 	dumphex(p,
8657c478bd9Sstevel@tonic-gate 		/* don't write past our string buffer ... */
8667c478bd9Sstevel@tonic-gate 		(this_ext_len*3 > BUFLEN ? BUFLEN : this_ext_len),
8677c478bd9Sstevel@tonic-gate 		auth_prn_str,
8687c478bd9Sstevel@tonic-gate 		"Payload = %s");
8697c478bd9Sstevel@tonic-gate }
870