/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include "snoop.h"
static const char *show_cmd(int);
static int get_numtokens(unsigned int);
static const struct rip_sec_entry *rip_next_sec_entry(
const struct rip_sec_entry *, int);
int
{
/* Room for IP destination + "/" + IP mask */
/* Room for "RIPv" + uint8_t as %d */
/* RIP header is 4 octets long */
return (0);
default: cmdstr = "?"; break;
}
else
case RIPCMD_REQUEST:
case RIPCMD_RESPONSE:
case RIPCMD_POLL:
auth = "";
auth = " +Auth";
}
break;
case RIPCMD_TRACEON:
case RIPCMD_TRACEOFF:
rip->rip_tracefile);
len = 0;
break;
case RIPCMD_SEC_RESPONSE:
case RIPCMD_SEC_T_RESPONSE:
break;
count = 0;
while (len > 0) {
break;
count++;
}
break;
default:
len = 0;
break;
}
}
show_space();
case RIPCMD_REQUEST:
case RIPCMD_RESPONSE:
case RIPCMD_POLL:
show_space();
"Destination Next Hop "
"Tag Metric");
((char *)nip - dlc_header,
sizeof (*nip)),
" *** Auth None");
((char *)nip - dlc_header,
sizeof (*nip)),
" *** Auth PW \"%.*s\"",
RIP_AUTH_MD5) {
" *** Auth MD5 pkt len %d, "
"keyid %d, sequence %08lX, "
"authlen %d",
md5_auth_len));
else
} else {
((char *)nip - dlc_header,
sizeof (*nip)),
" *** Auth Type %d?",
}
continue;
}
" *** All routes");
continue;
}
" *** Address Family %d?",
continue;
}
} else {
sizeof (addrstr));
}
/* LINTED */
if (mval == INADDR_ANY) {
/* No mask */;
0) {
} else {
}
}
"%-31s %-15s %-6d %d%s",
mval,
(mval == HOPCNT_INFINITY ?
" (not reachable)" : ""));
}
break;
case RIPCMD_POLLENTRY:
break;
/* LINTED */
"Destination = %s %s",
/* LINTED */
"Router = %s %s",
break;
case RIPCMD_SEC_RESPONSE:
case RIPCMD_SEC_T_RESPONSE:
break;
show_space();
"Generation = %u",
"Address E-METRIC");
while (len > 0) {
char *cp;
break;
blen = get_line_remain();
cp += 17;
blen -= 17;
count--) {
num = get_numtokens(
/* advance to the next emetric */
rep = (const struct rip_emetric *)
if (num > 0) {
",tokens=%lx",
tokp++;
num--;
} else {
blen);
}
while (num > 0) {
",%lx",
tokp++;
num--;
}
}
"NULL (not reachable)", blen);
}
}
break;
case RIPCMD_TRACEON:
case RIPCMD_TRACEOFF:
len = 0;
break;
}
}
}
static const char *
show_cmd(int c)
{
switch (c) {
case RIPCMD_REQUEST:
return ("route request");
case RIPCMD_RESPONSE:
return ("route response");
case RIPCMD_TRACEON:
return ("route trace on");
case RIPCMD_TRACEOFF:
return ("route trace off");
case RIPCMD_POLL:
return ("route poll");
case RIPCMD_POLLENTRY:
return ("route poll entry");
case RIPCMD_SEC_RESPONSE:
return ("route sec response");
case RIPCMD_SEC_T_RESPONSE:
return ("route sec_t response");
}
return ("?");
}
static int
{
int num = 0;
while (mask != 0) {
num++;
}
return (num);
}
static const struct rip_sec_entry *
{
long count;
return (NULL);
while (count > 0) {
return (NULL);
rep = (struct rip_emetric *)
return (NULL);
count--;
}
return ((const struct rip_sec_entry *)rep);
}