/*
* 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 (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <sys/sysmacros.h>
#include "snoop.h"
/*
* These two macros extract the version and type fields respectively from
* the first byte of the PPPoE header.
*/
typedef struct taginfo {
char *tag_name;
} taginfo_t;
static char *pppoe_codetoname(int, boolean_t);
static void print_utf8string(char *, char *, uint16_t);
static char *print_linetag(char *);
{ "Unknown TAG", 0, NULL }
};
int
{
return (len);
} else { /* flags & F_DTAIL */
show_space();
show_space();
}
}
}
return (len);
}
/*
* interpret_tags() prints PPPoE Discovery Stage TAGs in detail.
*/
static void
{
while (length >= POET_HDRLEN) {
"Tag Type = %d", tag_type);
"Tag Length = %d bytes", tag_length);
length -= POET_HDRLEN;
if (tag_length > length) {
"Warning: Truncated Packet");
show_space();
break;
}
/*
* unknown tags or tags which should always have 0 length
* are not interpreted any further.
*/
show_space();
length -= tag_length;
}
}
static char *
{
char *name;
switch (code) {
case POECODE_DATA:
name = "Session";
break;
case POECODE_PADO:
if (verbose)
name = "Active Discovery Offer";
else
name = "PADO";
break;
case POECODE_PADI:
if (verbose)
name = "Active Discovery Initiation";
else
name = "PADI";
break;
case POECODE_PADR:
if (verbose)
name = "Active Discovery Request";
else
name = "PADR";
break;
case POECODE_PADS:
if (verbose)
name = "Active Discovery Session-Confirmation";
else
name = "PADS";
break;
case POECODE_PADT:
if (verbose)
name = "Active Discovery Terminate";
else
name = "PADT";
break;
case POECODE_PADM:
if (verbose)
name = "Active Discovery Message";
else
name = "PADM";
break;
case POECODE_PADN:
if (verbose)
name = "Active Discovery Network";
else
name = "PADN";
break;
default:
name = "Unknown Code";
}
return (name);
}
static taginfo_t *
{
int i = 0;
taginfo_ptr = &taginfo_array[++i];
}
return (taginfo_ptr);
}
static void
{
char *endofline;
}
static void
{
char *endofline;
}
static void
{
char *endofline;
}
static void
{
char *endofline;
}
static void
{
char *endofline;
"Vendor ID = %d", vendorid);
if (tag_length > 4) {
}
}
static void
{
char *endofline;
}
static void
{
char *endofline;
}
static void
{
char *endofline;
}
static void
{
char *endofline;
}
static void
{
if (tag_length == 16) {
"Destination\tNetmask\tGateway\tMetric");
}
}
static void
{
}
}
static void
{
}
static char *
{
}