snoop_rip.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 1991-2002 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>
#define RIPVERSION RIPv2
#include "snoop.h"
static char *show_cmd(int);
int
{
const struct sockaddr_in *sin;
/* 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;
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) {
((char *)nip - dlc_header,
sizeof (*nip)),
" *** 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;
}
dlc_header, sizeof (*nip)),
" *** All routes");
continue;
}
dlc_header, sizeof (*nip)),
" *** Address Family %d?",
continue;
}
} else {
sizeof (addrstr));
}
/* LINTED */
if (mval == INADDR_ANY) {
/* No mask */;
0) {
} else {
}
}
dlc_header, sizeof (*nip)),
"%-31s %-15s %-6d %d%s",
mval,
(mval == HOPCNT_INFINITY ?
" (not reachable)" : ""));
}
break;
case RIPCMD_POLLENTRY:
break;
/* LINTED */
sizeof (struct sockaddr)), get_line_remain(),
"Destination = %s %s",
/* LINTED */
sizeof (struct sockaddr)), get_line_remain(),
"Router = %s %s",
break;
case RIPCMD_TRACEON:
case RIPCMD_TRACEOFF:
len = 0;
break;
}
}
}
static 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");
}
return ("?");
}