/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <fcntl.h>
#include <string.h>
#include <netinet/in_systm.h>
#include <netinet/if_ether.h>
#include "snoop.h"
#include "snoop_ospf.h"
#include "snoop_ospf6.h"
extern char *dlc_header;
static char *sum_line;
char *ospf_types[] = {
"umd", /* 0 */
"Hello", /* 1 */
"DD", /* 2 */
"LSReq", /* 3 */
"LSUpd", /* 4 */
"LSAck", /* 5 */
};
static char *ospf_authtypes[] = {
"None", /* 0 */
"simple", /* 1 */
"md5", /* 2 */
};
{ RLA_FLAG_B, "B" },
{ RLA_FLAG_E, "E" },
{ RLA_FLAG_V, "V" },
{ RLA_FLAG_W, "W" },
{ 0, NULL }
};
{ OSPF_DB_INIT, "I" },
{ OSPF_DB_MORE, "M" },
{ OSPF_DB_MASTER, "MS" },
{ 0, NULL }
};
{ OSPF_OPTION_T, "T" },
{ OSPF_OPTION_E, "E" },
{ OSPF_OPTION_MC, "MC" },
{ 0, NULL }
};
static int interpret_ospf_hello(int, struct ospfhdr *, int);
static void interpret_ospf_lsa_hdr(int, struct lsa_hdr *);
char *
{
bitstring[0] = '\0';
do {
}
/* wipe out the trailing "/" */
return (bitstring);
}
char *
{
if (hour != 0)
else if (mins != 0)
else
return (lsa_age);
}
static int
{
int j;
return (-1); /* truncated packet */
}
}
j = 0;
return (-1); /* truncated */
j++;
++nbr;
}
}
show_space();
"Hello interval = %d",
"Designated Router = %s",
}
"Backup Designated Router = %s",
}
return (-1); /* truncated */
++nbr;
}
}
return (fraglen);
}
static void
{
switch (ls_type) {
case LS_TYPE_ROUTER:
}
}
break;
case LS_TYPE_NETWORK:
}
" Interface = %s ",
}
break;
case LS_TYPE_SUM_IP:
}
" Area Border Router = %s ",
}
break;
case LS_TYPE_SUM_ABR:
}
}
break;
case LS_TYPE_ASE:
}
}
break;
case LS_TYPE_GROUP:
}
}
break;
default:
}
"Unknown LSA type %d", ls_type);
}
break;
}
}
static void
{
return;
"Options = %s",
}
}
static int
{
int rla_count, k;
return (-1);
case LS_TYPE_ROUTER:
return (-1);
(void) ospf_print_bits(ospf_rla_flag_bits,
}
return (-1);
return (-1);
while (rla_count-- != 0) {
return (-1);
case RLA_TYPE_VIRTUAL:
get_line_remain(), "Virtual Link");
}
/* fall through */
case RLA_TYPE_ROUTER:
get_line_remain(), "Neighbor = %s",
get_line_remain(), "Interface = %s",
}
break;
case RLA_TYPE_TRANSIT:
"Designated Router = %s",
get_line_remain(), "Interface = %s",
}
break;
case RLA_TYPE_STUB:
get_line_remain(), "Network = %s",
get_line_remain(), "Mask = %s",
}
break;
default:
"Unknown link type %d",
}
}
get_line_remain(), "TOS 0 metric = %d",
}
tosp = (struct tos_metric *)(
return (-1);
"TOS %d metric = %d",
}
}
return (-1); /* truncated */
}
break;
case LS_TYPE_NETWORK:
return (-1);
"Mask = %s",
"Routers:");
}
return (-1); /* truncated */
}
++addr;
}
break;
case LS_TYPE_SUM_IP:
sizeof (struct in_addr)))
return (-1);
}
/* FALLTHROUGH */
case LS_TYPE_SUM_ABR:
return (-1);
return (-1); /* truncated */
}
++tosmetric;
}
break;
case LS_TYPE_ASE:
return (-1);
}
return (-1); /* truncated */
" type %d tos %d metric %d",
}
get_line_remain(), " Forward %s",
}
}
get_line_remain(), " Tag %s",
}
}
++am;
}
break;
default:
}
break;
}
return (0);
}
int
{
if ((fraglen < OSPF_MIN_HEADER_SIZE) ||
return (fraglen); /* incomplete header */
}
show_space();
}
return (fraglen);
}
sum_line = (char *)get_sum_line();
}
show_space();
"Auth = %d (unknown auth type)",
} else {
}
}
"ospfv3 packet in ipv4 header");
} else {
return (fraglen);
}
}
case OSPF_TYPE_HELLO:
break;
case OSPF_TYPE_DB:
break;
}
}
fraglen);
show_space();
"Options = %s", ospf_print_bits(
"Flags = %s", ospf_print_bits(
/* Print all the LS advs */
break;
}
++lsah;
}
}
break;
case OSPF_TYPE_LSR:
break;
}
"Link State Request Packet");
}
break;
}
nlsah++;
}
}
++lsr;
}
}
break;
case OSPF_TYPE_LSU:
break;
}
fraglen);
show_space();
}
break;
}
while (nlsa-- != 0) {
fragend) ||
fragend)) {
break;
}
break;
}
}
break;
case OSPF_TYPE_LSA:
fraglen);
show_space();
}
nlsah = 0;
break;
}
nlsah++;
++lsah;
}
}
break;
default:
/* NOTREACHED */
break;
}
if (trunc) {
}
"--truncated");
}
return (fraglen);
}