/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include "snoop.h"
#include "snoop_mip.h"
/*
* This defines the length of internal, unbounded buffers. We set
* this to be MAXLINE (the maximum verbose display line length) -
* 64, which should be enough for all necessary descriptions.
*/
extern char *dlc_header;
extern char *addrtoname();
/*
* This defines the interface for all extention interpreter
* functions. The function will be called with following
* parameters:
*
* type: IN The type code for this extention
* len IN The length of the payload (i.e. the
* length field in an extension header)
* payload IN A pointer to the beginning of the
* extension payload
*/
struct ext_dispatch {
};
/* Description structure -- maps type to description */
struct ext_desc {
const char *desc;
};
/*
* Interpreter function prototypes for both adv and reg. These
* all must implement the interpret_f interface defined above.
*/
/* R E G I S T R A T I O N */
/* Reg: type to description mapping table */
MN_HA_AUTH, "(Mobile-Home Authentication Extension)",
MN_FA_AUTH, "(Mobile-Foreign Authentication Extension",
FA_HA_AUTH, "(Foreign-Home Authentication Extension)",
GEN_AUTH, "(Generalized Authentication Extension)",
MN_HA_KEY, "(Mobile-Home Key Extension)",
MN_FA_KEY, "(Mobile-Foreign Key Extension)",
MN_HA_TRAVERSE, "(Firewall Traversal Extension)",
ENCAP_DELIV, "(Encapsulating Delivery Style Extension)",
MN_NAI, "(Mobile Node Network Access Identifier)",
FA_CHALLENGE, "(Mobile-Foreign Agent Challenge)",
0, "(Unrecognized Extension)"
};
/* Subtypes for Generic Authentication Extension type (type 36) */
GEN_AUTH_MN_AAA, "(MN-AAA Authentication Subtype)",
0, "(Unrecognized Subtype)"
};
/* Reg: type to function mapping table */
0, unk_ext
};
/* A D V E R T I S E M E N T */
/* Adv: type to description mapping table */
ICMP_ADV_MSG_PADDING_EXT, "(Padding)",
ICMP_ADV_MSG_MOBILITY_AGT_EXT, "(Mobility Agent Extension)",
ICMP_ADV_MSG_PREFIX_LENGTH_EXT, "(Prefix Lengths)",
ICMP_ADV_MSG_FA_CHALLENGE, "(Foreign Agent Challenge)",
ICMP_ADV_MSG_FA_NAI, "(Foreign Agent NAI)",
0, "(Unrecognized Extension)"
};
/* Adv: type to function mapping table */
0, unk_ext
};
int index;
}
}
int i;
/* NO_OP */;
}
/*
* The following is an accessor for the description table, used by
* snoop_icmp.c. This maintains the encapsulation of the internal
* description table.
*/
}
int max) {
int i;
/* NO_OP */;
}
static int
int regext_size,
const char *st;
uchar_t *p;
interpreter_f *f;
show_space();
do {
ext_hdrlen = sizeof (gen_exthdr_t);
} else {
ext_hdrlen = sizeof (exthdr_t);
}
curr_size >= 1) ||
break;
/* Print description for this extension */
} else /* REG */ {
}
}
/* Special case for 1-byte padding */
curr_size--;
continue;
}
/* Parse out the extension's payload */
} else /* REG */ {
}
show_space();
} while (B_TRUE);
return (0);
}
show_space();
show_space();
}
void
char *line;
int regext_size;
/* First byte of the message should be the type */
switch (*msg) {
case REG_TYPE_REQ:
return;
break;
case REG_TYPE_REP:
return;
case REPLY_CODE_ACK:
"OK" : "OK code 0";
break;
"OK simultaneous bindings" : "OK code 1";
break;
"FA denial: unspecified":"FA denial: code 64";
break;
"FA denial: prohibited":"FA denial: code 65";
break;
"FA denial: no resources":"FA denial: code 66";
break;
"FA denial: MN auth failed":"FA denial: code 67";
break;
"FA denial: HA auth failed":
"FA denial: code 68";
break;
"FA denial: lifetime":"FA denial: code 69";
break;
"FA denial: bad request": "FA: code 70";
break;
"FA denial: bad Reply":"FA denial: code 71";
break;
"FA denial: encapsulation":"FA denial: code 72";
break;
"FA denial: VJ compression":"FA denial: code 73";
break;
"FA denial: reverse tunnel unavailable":
"FA denial: code 74";
break;
"FA denial: reverse tunnel: missing T-bit":
"FA denial: code 75";
break;
"FA denial: reverse tunnel: too distant":
"FA denial: code 76";
break;
"FA denial: home network unreachable":
"FA denial: code 80";
break;
"FA denial: HA host unreachable":
"FA denial: code 81";
break;
"FA denial: HA port unreachable":
"FA denial: code 82";
break;
"FA denial: HA unreachable":"FA denial: code 88";
break;
"FA denial: Unique Home Addr Required":
"FA denial: code 96";
break;
"FA denial: Missing NAI":
"FA denial: code 97";
break;
"FA denial: Missing Home Agent":
"FA denial: code 98";
break;
"FA denial: Unknown Challenge":
"FA denial: code 104";
break;
"FA denial: Missing Challenge":
"FA denial: code 105";
break;
"FA denial: Missing Mobile-Foreign Key Extension":
"FA denial: code 106";
break;
"HA denial: unspecified":"HA denial: code 128";
break;
"HA denial: prohibited":"HA denial: code 129";
break;
"HA denial: no resources":"HA denial: code 130";
break;
"HA denial: MN auth failed":"HA denial: code 131";
break;
"HA denial: FA auth failed":"HA denial: code 132";
break;
"HA denial: ID mismatch":"HA denial: code 133";
break;
"HA denial: bad request":"HA denial: code 134";
break;
"HA denial: too many bindings":
"HA denial: code 135";
break;
"HA denial: bad HA address":"HA denial: code 136";
break;
"HA denial: no reverse tunnel":
"HA denial: code 137";
break;
"HA denial: reverse tunnel: no T-bit":
"HA denial: code 138";
break;
"HA denial: encapsulation unavailable":
"HA denial: code 139";
break;
default:
pc = "?";
break;
}
break;
default :
break;
}
line = get_sum_line();
else
}
show_space();
if (*msg == REG_TYPE_REQ) {
pt);
"%d... .... = %s simultaneous bindings ",
".%d.. .... = %s broadcast datagrams ",
"..%d. .... = %s decapsulation by MN",
"" : "no");
"...%d .... = %s minimum encapsulation ",
".... %d... = %s GRE encapsulation ",
".... .%d.. = %s VJ hdr Compression ",
".... ..%d. = %s reverse tunnel",
"" : "no");
"Life Time = 0xFFFF (infinity)");
"Life Time = 0 "
"(request for de-registration)");
} else {
"Life time = %d seconds",
}
"Home address = %s, %s",
"Home Agent address = %s, %s",
"Care of address = %s, %s",
"Identification = 0x%x-%x",
} else if (*msg == REG_TYPE_REP) {
(void) sprintf(
"Registration header type = %d (%s)",
"Life time = 0xFFFF (infinity)");
"Life time = 0 (de-registeration success)" :
"Life time = 0 (de-registration failed)");
} else {
"Life time = %d seconds",
}
(void) sprintf(
"Home address = %s, %s",
"Home Agent address = %s, %s",
"Identification = 0x%x-%x",
}
}
}
/*ARGSUSED*/
/* SPI */
"Security Parameter Index = 0x%x%x",
/* The rest is the authenticator; dump it in hex */
dumphex(p,
/* don't write past our string buffer ... */
"Authenticator = %s");
}
char *alg_string;
/* Algorithm Type */
switch (alg) {
case KEY_ALG_NONE:
alg_string = "None";
break;
case SA_MD5_MODE_PREF_SUF:
alg_string = "MD5/prefix+suffix";
break;
case SA_HMAC_MD5:
alg_string = "HMAC MD5";
break;
default:
alg_string = "Unknown";
break;
}
p += sizeof (alg);
this_ext_len -= sizeof (alg);
/* AAA SPI */
"AAA Security Parameter Index = 0x%x%x",
/* HA / FA SPI */
"%s Security Parameter Index = 0x%x%x",
/* The rest is the security info; dump it in hex */
dumphex(p,
/* don't write past our string buffer ... */
sec_msg);
}
/*ARGSUSED*/
/* skip reserved */
p += 2;
this_ext_len -= 2;
/* Mobile-Home Traversal Address */
"Mobile-Home Traversal Address= %s, %s",
/* Home-Mobile Traversal Address */
"Home-Mobile Traversal Address= %s, %s",
}
/*ARGSUSED*/
/* no payload */
}
/*ARGSUSED*/
/* payload points to the NAI */
"%s%s", desc, p);
}
/*ARGSUSED*/
/* payload points to the challenge */
dumphex(p,
/* don't write past our string buffer ... */
"Challenge = %s");
}
/*ARGSUSED*/
int i, len;
"Registration lifetime = %d seconds",
"1... .... = registration required "
"through FA");
} else {
"0... .... = registration not required "
"through FA");
}
} else {
}
} else {
}
} else {
}
if (adv_ext->minencap_bit) {
"supported");
} else {
".... 0... = no minimal encapsulation");
}
if (adv_ext->greencap_bit) {
".... .1.. = GRE encapsulation supported");
} else {
".... .0.. = no GRE encapsulation");
}
if (adv_ext->vanjacob_hdr_comp_bit) {
".... ..1. = VJ header compression");
} else {
".... ..0. = no VJ header compression");
}
if (adv_ext->reverse_tunnel_bit) {
".... ...1 = reverse tunneling supported");
} else {
".... ...0 = no reverse tunneling");
}
/* Parse out COA's */
p += sizeof (*adv_ext);
/* this_ext_len is unsigned, and here we need a signed number */
"Care of address-%d = %s, %s", i,
p += sizeof (temp_addr);
}
}
/*ARGSUSED*/
int i;
for (i = 0; i < this_ext_len; i++) {
"Prefix length of router address[%d] "
"= %d bits",
i, p[i]);
}
}
/*ARGSUSED*/
/* Unknown extension; just dump the rest of the payload */
dumphex(p,
/* don't write past our string buffer ... */
"Payload = %s");
}