2005-05-29 18:17:16 +00:00
|
|
|
/*
|
2017-09-18 04:10:54 +00:00
|
|
|
* Copyright (c) 1998-2004 Hannes Gredler <hannes@gredler.at>
|
2005-05-29 18:17:16 +00:00
|
|
|
* The TCPDUMP project
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that: (1) source code
|
|
|
|
* distributions retain the above copyright notice and this paragraph
|
|
|
|
* in its entirety, and (2) distributions including binary code include
|
|
|
|
* the above copyright notice and this paragraph in its entirety in
|
|
|
|
* the documentation or other materials provided with the distribution.
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
|
|
|
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
|
|
|
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE.
|
|
|
|
*/
|
|
|
|
|
2017-01-31 19:17:06 +00:00
|
|
|
/* \summary: Enhanced Interior Gateway Routing Protocol (EIGRP) printer */
|
|
|
|
|
2005-05-29 18:17:16 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2017-01-31 19:17:06 +00:00
|
|
|
#include <netdissect-stdinc.h>
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2017-01-31 19:17:06 +00:00
|
|
|
#include "netdissect.h"
|
2005-05-29 18:17:16 +00:00
|
|
|
#include "extract.h"
|
|
|
|
#include "addrtoname.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* packet format documented at
|
|
|
|
* http://www.rhyshaden.com/eigrp.htm
|
2017-09-18 04:10:54 +00:00
|
|
|
* RFC 7868
|
2005-05-29 18:17:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct eigrp_common_header {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t version;
|
|
|
|
uint8_t opcode;
|
|
|
|
uint8_t checksum[2];
|
|
|
|
uint8_t flags[4];
|
|
|
|
uint8_t seq[4];
|
|
|
|
uint8_t ack[4];
|
|
|
|
uint8_t asn[4];
|
2005-05-29 18:17:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define EIGRP_VERSION 2
|
|
|
|
|
|
|
|
#define EIGRP_OPCODE_UPDATE 1
|
|
|
|
#define EIGRP_OPCODE_QUERY 3
|
|
|
|
#define EIGRP_OPCODE_REPLY 4
|
|
|
|
#define EIGRP_OPCODE_HELLO 5
|
|
|
|
#define EIGRP_OPCODE_IPXSAP 6
|
|
|
|
#define EIGRP_OPCODE_PROBE 7
|
|
|
|
|
|
|
|
static const struct tok eigrp_opcode_values[] = {
|
|
|
|
{ EIGRP_OPCODE_UPDATE, "Update" },
|
|
|
|
{ EIGRP_OPCODE_QUERY, "Query" },
|
|
|
|
{ EIGRP_OPCODE_REPLY, "Reply" },
|
|
|
|
{ EIGRP_OPCODE_HELLO, "Hello" },
|
|
|
|
{ EIGRP_OPCODE_IPXSAP, "IPX SAP" },
|
|
|
|
{ EIGRP_OPCODE_PROBE, "Probe" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct tok eigrp_common_header_flag_values[] = {
|
|
|
|
{ 0x01, "Init" },
|
|
|
|
{ 0x02, "Conditionally Received" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct eigrp_tlv_header {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t type[2];
|
|
|
|
uint8_t length[2];
|
2005-05-29 18:17:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define EIGRP_TLV_GENERAL_PARM 0x0001
|
|
|
|
#define EIGRP_TLV_AUTH 0x0002
|
|
|
|
#define EIGRP_TLV_SEQ 0x0003
|
|
|
|
#define EIGRP_TLV_SW_VERSION 0x0004
|
|
|
|
#define EIGRP_TLV_MCAST_SEQ 0x0005
|
|
|
|
#define EIGRP_TLV_IP_INT 0x0102
|
|
|
|
#define EIGRP_TLV_IP_EXT 0x0103
|
|
|
|
#define EIGRP_TLV_AT_INT 0x0202
|
|
|
|
#define EIGRP_TLV_AT_EXT 0x0203
|
|
|
|
#define EIGRP_TLV_AT_CABLE_SETUP 0x0204
|
|
|
|
#define EIGRP_TLV_IPX_INT 0x0302
|
|
|
|
#define EIGRP_TLV_IPX_EXT 0x0303
|
|
|
|
|
|
|
|
static const struct tok eigrp_tlv_values[] = {
|
|
|
|
{ EIGRP_TLV_GENERAL_PARM, "General Parameters"},
|
|
|
|
{ EIGRP_TLV_AUTH, "Authentication"},
|
|
|
|
{ EIGRP_TLV_SEQ, "Sequence"},
|
|
|
|
{ EIGRP_TLV_SW_VERSION, "Software Version"},
|
|
|
|
{ EIGRP_TLV_MCAST_SEQ, "Next Multicast Sequence"},
|
|
|
|
{ EIGRP_TLV_IP_INT, "IP Internal routes"},
|
|
|
|
{ EIGRP_TLV_IP_EXT, "IP External routes"},
|
|
|
|
{ EIGRP_TLV_AT_INT, "AppleTalk Internal routes"},
|
|
|
|
{ EIGRP_TLV_AT_EXT, "AppleTalk External routes"},
|
|
|
|
{ EIGRP_TLV_AT_CABLE_SETUP, "AppleTalk Cable setup"},
|
|
|
|
{ EIGRP_TLV_IPX_INT, "IPX Internal routes"},
|
|
|
|
{ EIGRP_TLV_IPX_EXT, "IPX External routes"},
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct eigrp_tlv_general_parm_t {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t k1;
|
|
|
|
uint8_t k2;
|
|
|
|
uint8_t k3;
|
|
|
|
uint8_t k4;
|
|
|
|
uint8_t k5;
|
|
|
|
uint8_t res;
|
|
|
|
uint8_t holdtime[2];
|
|
|
|
};
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
struct eigrp_tlv_sw_version_t {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t ios_major;
|
|
|
|
uint8_t ios_minor;
|
|
|
|
uint8_t eigrp_major;
|
|
|
|
uint8_t eigrp_minor;
|
|
|
|
};
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
struct eigrp_tlv_ip_int_t {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t nexthop[4];
|
|
|
|
uint8_t delay[4];
|
|
|
|
uint8_t bandwidth[4];
|
|
|
|
uint8_t mtu[3];
|
|
|
|
uint8_t hopcount;
|
|
|
|
uint8_t reliability;
|
|
|
|
uint8_t load;
|
|
|
|
uint8_t reserved[2];
|
|
|
|
uint8_t plen;
|
|
|
|
uint8_t destination; /* variable length [1-4] bytes encoding */
|
|
|
|
};
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
struct eigrp_tlv_ip_ext_t {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t nexthop[4];
|
|
|
|
uint8_t origin_router[4];
|
|
|
|
uint8_t origin_as[4];
|
|
|
|
uint8_t tag[4];
|
|
|
|
uint8_t metric[4];
|
|
|
|
uint8_t reserved[2];
|
|
|
|
uint8_t proto_id;
|
|
|
|
uint8_t flags;
|
|
|
|
uint8_t delay[4];
|
|
|
|
uint8_t bandwidth[4];
|
|
|
|
uint8_t mtu[3];
|
|
|
|
uint8_t hopcount;
|
|
|
|
uint8_t reliability;
|
|
|
|
uint8_t load;
|
|
|
|
uint8_t reserved2[2];
|
|
|
|
uint8_t plen;
|
|
|
|
uint8_t destination; /* variable length [1-4] bytes encoding */
|
|
|
|
};
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
struct eigrp_tlv_at_cable_setup_t {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t cable_start[2];
|
|
|
|
uint8_t cable_end[2];
|
|
|
|
uint8_t router_id[4];
|
2005-05-29 18:17:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct eigrp_tlv_at_int_t {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t nexthop[4];
|
|
|
|
uint8_t delay[4];
|
|
|
|
uint8_t bandwidth[4];
|
|
|
|
uint8_t mtu[3];
|
|
|
|
uint8_t hopcount;
|
|
|
|
uint8_t reliability;
|
|
|
|
uint8_t load;
|
|
|
|
uint8_t reserved[2];
|
|
|
|
uint8_t cable_start[2];
|
|
|
|
uint8_t cable_end[2];
|
|
|
|
};
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
struct eigrp_tlv_at_ext_t {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t nexthop[4];
|
|
|
|
uint8_t origin_router[4];
|
|
|
|
uint8_t origin_as[4];
|
|
|
|
uint8_t tag[4];
|
|
|
|
uint8_t proto_id;
|
|
|
|
uint8_t flags;
|
|
|
|
uint8_t metric[2];
|
|
|
|
uint8_t delay[4];
|
|
|
|
uint8_t bandwidth[4];
|
|
|
|
uint8_t mtu[3];
|
|
|
|
uint8_t hopcount;
|
|
|
|
uint8_t reliability;
|
|
|
|
uint8_t load;
|
|
|
|
uint8_t reserved2[2];
|
|
|
|
uint8_t cable_start[2];
|
|
|
|
uint8_t cable_end[2];
|
2005-05-29 18:17:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct tok eigrp_ext_proto_id_values[] = {
|
|
|
|
{ 0x01, "IGRP" },
|
|
|
|
{ 0x02, "EIGRP" },
|
|
|
|
{ 0x03, "Static" },
|
|
|
|
{ 0x04, "RIP" },
|
|
|
|
{ 0x05, "Hello" },
|
|
|
|
{ 0x06, "OSPF" },
|
|
|
|
{ 0x07, "IS-IS" },
|
|
|
|
{ 0x08, "EGP" },
|
|
|
|
{ 0x09, "BGP" },
|
|
|
|
{ 0x0a, "IDRP" },
|
|
|
|
{ 0x0b, "Connected" },
|
|
|
|
{ 0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
2015-07-06 02:16:08 +00:00
|
|
|
eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int len)
|
|
|
|
{
|
2005-05-29 18:17:16 +00:00
|
|
|
const struct eigrp_common_header *eigrp_com_header;
|
|
|
|
const struct eigrp_tlv_header *eigrp_tlv_header;
|
|
|
|
const u_char *tptr,*tlv_tptr;
|
2005-07-11 03:54:22 +00:00
|
|
|
u_int tlen,eigrp_tlv_len,eigrp_tlv_type,tlv_tlen, byte_length, bit_length;
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t prefix[4];
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
union {
|
|
|
|
const struct eigrp_tlv_general_parm_t *eigrp_tlv_general_parm;
|
|
|
|
const struct eigrp_tlv_sw_version_t *eigrp_tlv_sw_version;
|
|
|
|
const struct eigrp_tlv_ip_int_t *eigrp_tlv_ip_int;
|
|
|
|
const struct eigrp_tlv_ip_ext_t *eigrp_tlv_ip_ext;
|
|
|
|
const struct eigrp_tlv_at_cable_setup_t *eigrp_tlv_at_cable_setup;
|
|
|
|
const struct eigrp_tlv_at_int_t *eigrp_tlv_at_int;
|
|
|
|
const struct eigrp_tlv_at_ext_t *eigrp_tlv_at_ext;
|
|
|
|
} tlv_ptr;
|
|
|
|
|
|
|
|
tptr=pptr;
|
|
|
|
eigrp_com_header = (const struct eigrp_common_header *)pptr;
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*eigrp_com_header);
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Sanity checking of the header.
|
|
|
|
*/
|
|
|
|
if (eigrp_com_header->version != EIGRP_VERSION) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "EIGRP version %u packet not supported",eigrp_com_header->version));
|
2005-05-29 18:17:16 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* in non-verbose mode just lets print the basic Message Type*/
|
2015-01-06 19:03:11 +00:00
|
|
|
if (ndo->ndo_vflag < 1) {
|
|
|
|
ND_PRINT((ndo, "EIGRP %s, length: %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
tok2str(eigrp_opcode_values, "unknown (%u)",eigrp_com_header->opcode),
|
2015-01-06 19:03:11 +00:00
|
|
|
len));
|
2005-05-29 18:17:16 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ok they seem to want to know everything - lets fully decode it */
|
|
|
|
|
2017-09-18 04:10:54 +00:00
|
|
|
if (len < sizeof(struct eigrp_common_header)) {
|
|
|
|
ND_PRINT((ndo, "EIGRP %s, length: %u (too short, < %u)",
|
|
|
|
tok2str(eigrp_opcode_values, "unknown (%u)",eigrp_com_header->opcode),
|
|
|
|
len, (u_int) sizeof(struct eigrp_common_header)));
|
|
|
|
return;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
tlen=len-sizeof(struct eigrp_common_header);
|
|
|
|
|
|
|
|
/* FIXME print other header info */
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\tEIGRP v%u, opcode: %s (%u), chksum: 0x%04x, Flags: [%s]\n\tseq: 0x%08x, ack: 0x%08x, AS: %u, length: %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
eigrp_com_header->version,
|
|
|
|
tok2str(eigrp_opcode_values, "unknown, type: %u",eigrp_com_header->opcode),
|
|
|
|
eigrp_com_header->opcode,
|
|
|
|
EXTRACT_16BITS(&eigrp_com_header->checksum),
|
|
|
|
tok2str(eigrp_common_header_flag_values,
|
|
|
|
"none",
|
|
|
|
EXTRACT_32BITS(&eigrp_com_header->flags)),
|
|
|
|
EXTRACT_32BITS(&eigrp_com_header->seq),
|
|
|
|
EXTRACT_32BITS(&eigrp_com_header->ack),
|
|
|
|
EXTRACT_32BITS(&eigrp_com_header->asn),
|
2015-01-06 19:03:11 +00:00
|
|
|
tlen));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
tptr+=sizeof(const struct eigrp_common_header);
|
|
|
|
|
|
|
|
while(tlen>0) {
|
|
|
|
/* did we capture enough for fully decoding the object header ? */
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*tptr, sizeof(struct eigrp_tlv_header));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
eigrp_tlv_header = (const struct eigrp_tlv_header *)tptr;
|
|
|
|
eigrp_tlv_len=EXTRACT_16BITS(&eigrp_tlv_header->length);
|
|
|
|
eigrp_tlv_type=EXTRACT_16BITS(&eigrp_tlv_header->type);
|
|
|
|
|
|
|
|
|
2005-07-11 03:54:22 +00:00
|
|
|
if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header) ||
|
|
|
|
eigrp_tlv_len > tlen) {
|
2015-01-06 19:03:11 +00:00
|
|
|
print_unknown_data(ndo,tptr+sizeof(struct eigrp_tlv_header),"\n\t ",tlen);
|
2005-05-29 18:17:16 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t %s TLV (0x%04x), length: %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
tok2str(eigrp_tlv_values,
|
|
|
|
"Unknown",
|
|
|
|
eigrp_tlv_type),
|
|
|
|
eigrp_tlv_type,
|
2015-01-06 19:03:11 +00:00
|
|
|
eigrp_tlv_len));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2017-09-18 04:10:54 +00:00
|
|
|
if (eigrp_tlv_len < sizeof(struct eigrp_tlv_header)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) sizeof(struct eigrp_tlv_header)));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
tlv_tptr=tptr+sizeof(struct eigrp_tlv_header);
|
|
|
|
tlv_tlen=eigrp_tlv_len-sizeof(struct eigrp_tlv_header);
|
|
|
|
|
|
|
|
/* did we capture enough for fully decoding the object ? */
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*tptr, eigrp_tlv_len);
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
switch(eigrp_tlv_type) {
|
|
|
|
|
|
|
|
case EIGRP_TLV_GENERAL_PARM:
|
|
|
|
tlv_ptr.eigrp_tlv_general_parm = (const struct eigrp_tlv_general_parm_t *)tlv_tptr;
|
2017-09-18 04:10:54 +00:00
|
|
|
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_general_parm)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_general_parm))));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t holdtime: %us, k1 %u, k2 %u, k3 %u, k4 %u, k5 %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_16BITS(tlv_ptr.eigrp_tlv_general_parm->holdtime),
|
|
|
|
tlv_ptr.eigrp_tlv_general_parm->k1,
|
|
|
|
tlv_ptr.eigrp_tlv_general_parm->k2,
|
|
|
|
tlv_ptr.eigrp_tlv_general_parm->k3,
|
|
|
|
tlv_ptr.eigrp_tlv_general_parm->k4,
|
2015-01-06 19:03:11 +00:00
|
|
|
tlv_ptr.eigrp_tlv_general_parm->k5));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EIGRP_TLV_SW_VERSION:
|
|
|
|
tlv_ptr.eigrp_tlv_sw_version = (const struct eigrp_tlv_sw_version_t *)tlv_tptr;
|
2017-09-18 04:10:54 +00:00
|
|
|
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_sw_version)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_sw_version))));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t IOS version: %u.%u, EIGRP version %u.%u",
|
2005-05-29 18:17:16 +00:00
|
|
|
tlv_ptr.eigrp_tlv_sw_version->ios_major,
|
|
|
|
tlv_ptr.eigrp_tlv_sw_version->ios_minor,
|
|
|
|
tlv_ptr.eigrp_tlv_sw_version->eigrp_major,
|
2015-01-06 19:03:11 +00:00
|
|
|
tlv_ptr.eigrp_tlv_sw_version->eigrp_minor));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EIGRP_TLV_IP_INT:
|
|
|
|
tlv_ptr.eigrp_tlv_ip_int = (const struct eigrp_tlv_ip_int_t *)tlv_tptr;
|
2017-09-18 04:10:54 +00:00
|
|
|
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_ip_int)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_ip_int))));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
bit_length = tlv_ptr.eigrp_tlv_ip_int->plen;
|
2005-07-11 03:54:22 +00:00
|
|
|
if (bit_length > 32) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t illegal prefix length %u",bit_length));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
byte_length = (bit_length + 7) / 8; /* variable length encoding */
|
|
|
|
memset(prefix, 0, 4);
|
2019-10-06 04:36:53 +00:00
|
|
|
ND_TCHECK2(tlv_ptr.eigrp_tlv_ip_int->destination, byte_length);
|
2005-05-29 18:17:16 +00:00
|
|
|
memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_int->destination,byte_length);
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ",
|
|
|
|
ipaddr_string(ndo, prefix),
|
|
|
|
bit_length));
|
2005-05-29 18:17:16 +00:00
|
|
|
if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0)
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "self"));
|
2005-05-29 18:17:16 +00:00
|
|
|
else
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_int->nexthop)));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100),
|
|
|
|
EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->bandwidth),
|
|
|
|
EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_int->mtu),
|
|
|
|
tlv_ptr.eigrp_tlv_ip_int->hopcount,
|
|
|
|
tlv_ptr.eigrp_tlv_ip_int->reliability,
|
2015-01-06 19:03:11 +00:00
|
|
|
tlv_ptr.eigrp_tlv_ip_int->load));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EIGRP_TLV_IP_EXT:
|
|
|
|
tlv_ptr.eigrp_tlv_ip_ext = (const struct eigrp_tlv_ip_ext_t *)tlv_tptr;
|
2017-09-18 04:10:54 +00:00
|
|
|
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_ip_ext)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_ip_ext))));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
bit_length = tlv_ptr.eigrp_tlv_ip_ext->plen;
|
2005-07-11 03:54:22 +00:00
|
|
|
if (bit_length > 32) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t illegal prefix length %u",bit_length));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
byte_length = (bit_length + 7) / 8; /* variable length encoding */
|
|
|
|
memset(prefix, 0, 4);
|
2019-10-06 04:36:53 +00:00
|
|
|
ND_TCHECK2(tlv_ptr.eigrp_tlv_ip_ext->destination, byte_length);
|
2005-05-29 18:17:16 +00:00
|
|
|
memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_ext->destination,byte_length);
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ",
|
|
|
|
ipaddr_string(ndo, prefix),
|
|
|
|
bit_length));
|
2005-05-29 18:17:16 +00:00
|
|
|
if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0)
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "self"));
|
2005-05-29 18:17:16 +00:00
|
|
|
else
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->nexthop)));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
|
|
|
|
ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router),
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as),
|
|
|
|
tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_ip_ext->proto_id),
|
|
|
|
tlv_ptr.eigrp_tlv_ip_ext->flags,
|
|
|
|
EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->tag),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->metric)));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->delay)/100),
|
|
|
|
EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->bandwidth),
|
|
|
|
EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_ip_ext->mtu),
|
|
|
|
tlv_ptr.eigrp_tlv_ip_ext->hopcount,
|
|
|
|
tlv_ptr.eigrp_tlv_ip_ext->reliability,
|
2015-01-06 19:03:11 +00:00
|
|
|
tlv_ptr.eigrp_tlv_ip_ext->load));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EIGRP_TLV_AT_CABLE_SETUP:
|
|
|
|
tlv_ptr.eigrp_tlv_at_cable_setup = (const struct eigrp_tlv_at_cable_setup_t *)tlv_tptr;
|
2017-09-18 04:10:54 +00:00
|
|
|
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_at_cable_setup)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_at_cable_setup))));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t Cable-range: %u-%u, Router-ID %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_start),
|
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->cable_end),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_cable_setup->router_id)));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EIGRP_TLV_AT_INT:
|
|
|
|
tlv_ptr.eigrp_tlv_at_int = (const struct eigrp_tlv_at_int_t *)tlv_tptr;
|
2017-09-18 04:10:54 +00:00
|
|
|
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_at_int)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_at_int))));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ",
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_start),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->cable_end)));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop) == 0)
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "self"));
|
2005-05-29 18:17:16 +00:00
|
|
|
else
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%u.%u",
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_int->nexthop[2])));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->delay)/100),
|
|
|
|
EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_int->bandwidth),
|
|
|
|
EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_int->mtu),
|
|
|
|
tlv_ptr.eigrp_tlv_at_int->hopcount,
|
|
|
|
tlv_ptr.eigrp_tlv_at_int->reliability,
|
2015-01-06 19:03:11 +00:00
|
|
|
tlv_ptr.eigrp_tlv_at_int->load));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EIGRP_TLV_AT_EXT:
|
|
|
|
tlv_ptr.eigrp_tlv_at_ext = (const struct eigrp_tlv_at_ext_t *)tlv_tptr;
|
2017-09-18 04:10:54 +00:00
|
|
|
if (tlv_tlen < sizeof(*tlv_ptr.eigrp_tlv_at_ext)) {
|
|
|
|
ND_PRINT((ndo, " (too short, < %u)",
|
|
|
|
(u_int) (sizeof(struct eigrp_tlv_header) + sizeof(*tlv_ptr.eigrp_tlv_at_ext))));
|
|
|
|
break;
|
|
|
|
}
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t Cable-Range: %u-%u, nexthop: ",
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_start),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->cable_end)));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
|
|
|
if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop) == 0)
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "self"));
|
2005-05-29 18:17:16 +00:00
|
|
|
else
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%u.%u",
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(&tlv_ptr.eigrp_tlv_at_ext->nexthop[2])));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t origin-router %u, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_router),
|
|
|
|
EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->origin_as),
|
|
|
|
tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_at_ext->proto_id),
|
|
|
|
tlv_ptr.eigrp_tlv_at_ext->flags,
|
|
|
|
EXTRACT_32BITS(tlv_ptr.eigrp_tlv_at_ext->tag),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(tlv_ptr.eigrp_tlv_at_ext->metric)));
|
2005-05-29 18:17:16 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u",
|
2005-05-29 18:17:16 +00:00
|
|
|
(EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->delay)/100),
|
|
|
|
EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_at_ext->bandwidth),
|
|
|
|
EXTRACT_24BITS(&tlv_ptr.eigrp_tlv_at_ext->mtu),
|
|
|
|
tlv_ptr.eigrp_tlv_at_ext->hopcount,
|
|
|
|
tlv_ptr.eigrp_tlv_at_ext->reliability,
|
2015-01-06 19:03:11 +00:00
|
|
|
tlv_ptr.eigrp_tlv_at_ext->load));
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME those are the defined TLVs that lack a decoder
|
|
|
|
* you are welcome to contribute code ;-)
|
|
|
|
*/
|
|
|
|
|
|
|
|
case EIGRP_TLV_AUTH:
|
|
|
|
case EIGRP_TLV_SEQ:
|
|
|
|
case EIGRP_TLV_MCAST_SEQ:
|
|
|
|
case EIGRP_TLV_IPX_INT:
|
|
|
|
case EIGRP_TLV_IPX_EXT:
|
|
|
|
|
|
|
|
default:
|
2015-01-06 19:03:11 +00:00
|
|
|
if (ndo->ndo_vflag <= 1)
|
|
|
|
print_unknown_data(ndo,tlv_tptr,"\n\t ",tlv_tlen);
|
2005-05-29 18:17:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* do we want to see an additionally hexdump ? */
|
2015-01-06 19:03:11 +00:00
|
|
|
if (ndo->ndo_vflag > 1)
|
|
|
|
print_unknown_data(ndo,tptr+sizeof(struct eigrp_tlv_header),"\n\t ",
|
2005-05-29 18:17:16 +00:00
|
|
|
eigrp_tlv_len-sizeof(struct eigrp_tlv_header));
|
|
|
|
|
|
|
|
tptr+=eigrp_tlv_len;
|
|
|
|
tlen-=eigrp_tlv_len;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "\n\t\t packet exceeded snapshot"));
|
2005-05-29 18:17:16 +00:00
|
|
|
}
|