aclocal.m4
addrtoname.c
addrtoname.h
+af.c
+af.h
ah.h
aodv.h
appletalk.h
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
-# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.298 2006-02-10 04:52:25 hannes Exp $ (LBL)
+# @(#) $Header: /tcpdump/master/tcpdump/Makefile.in,v 1.299 2006-02-21 10:27:40 hannes Exp $ (LBL)
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
@rm -f $@
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
-CSRC = addrtoname.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \
+CSRC = addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c \
nlpid.c l2vpn.c machdep.c parsenfsfh.c \
print-802_11.c print-ap1394.c print-ah.c print-arcnet.c \
print-aodv.c print-arp.c print-ascii.c print-atalk.c print-atm.c \
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.100 2006-02-02 12:36:09 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.101 2006-02-21 10:27:40 hannes Exp $";
#endif
#include <tcpdump-stdinc.h>
#include "addrtoname.h"
#include "extract.h"
#include "bgp.h"
+#include "af.h"
#include "l2vpn.h"
struct bgp {
#define BGP_COMMUNITY_NO_ADVERT 0xffffff02
#define BGP_COMMUNITY_NO_EXPORT_SUBCONFED 0xffffff03
-/* RFC1700 address family numbers */
-#define AFNUM_INET 1
-#define AFNUM_INET6 2
-#define AFNUM_NSAP 3
-#define AFNUM_HDLC 4
-#define AFNUM_BBN1822 5
-#define AFNUM_802 6
-#define AFNUM_E163 7
-#define AFNUM_E164 8
-#define AFNUM_F69 9
-#define AFNUM_X121 10
-#define AFNUM_IPX 11
-#define AFNUM_ATALK 12
-#define AFNUM_DECNET 13
-#define AFNUM_BANYAN 14
-#define AFNUM_E164NSAP 15
-#define AFNUM_VPLS 25
-/* draft-kompella-ppvpn-l2vpn */
-#define AFNUM_L2VPN 196 /* still to be approved by IANA */
-
-static struct tok bgp_afi_values[] = {
- { 0, "Reserved"},
- { AFNUM_INET, "IPv4"},
- { AFNUM_INET6, "IPv6"},
- { AFNUM_NSAP, "NSAP"},
- { AFNUM_HDLC, "HDLC"},
- { AFNUM_BBN1822, "BBN 1822"},
- { AFNUM_802, "802"},
- { AFNUM_E163, "E.163"},
- { AFNUM_E164, "E.164"},
- { AFNUM_F69, "F.69"},
- { AFNUM_X121, "X.121"},
- { AFNUM_IPX, "Novell IPX"},
- { AFNUM_ATALK, "Appletalk"},
- { AFNUM_DECNET, "Decnet IV"},
- { AFNUM_BANYAN, "Banyan Vines"},
- { AFNUM_E164NSAP, "E.164 with NSAP subaddress"},
- { AFNUM_L2VPN, "Layer-2 VPN"},
- { AFNUM_VPLS, "VPLS"},
- { 0, NULL},
-};
-
/* Extended community type - draft-ietf-idr-bgp-ext-communities-05 */
#define BGP_EXT_COM_RT_0 0x0002 /* Route Target,Format AS(2bytes):AN(4bytes) */
#define BGP_EXT_COM_RT_1 0x0102 /* Route Target,Format IP address:AN(2bytes) */
safi = tptr[2];
printf("\n\t AFI: %s (%u), %sSAFI: %s (%u)",
- tok2strbuf(bgp_afi_values, "Unknown AFI", af,
+ tok2strbuf(af_values, "Unknown AFI", af,
tokbuf, sizeof(tokbuf)),
af,
(safi>128) ? "vendor specific " : "", /* 128 is meanwhile wellknown */
safi = tptr[2];
printf("\n\t AFI: %s (%u), %sSAFI: %s (%u)",
- tok2strbuf(bgp_afi_values, "Unknown AFI", af,
+ tok2strbuf(af_values, "Unknown AFI", af,
tokbuf, sizeof(tokbuf)),
af,
(safi>128) ? "vendor specific " : "", /* 128 is meanwhile wellknown */
switch(cap_type) {
case BGP_CAPCODE_MP:
printf("\n\t\tAFI %s (%u), SAFI %s (%u)",
- tok2strbuf(bgp_afi_values, "Unknown",
+ tok2strbuf(af_values, "Unknown",
EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+2),
tokbuf, sizeof(tokbuf)),
EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+2),
cap_offset=4;
while(tcap_len>=4) {
printf("\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s",
- tok2strbuf(bgp_afi_values,"Unknown",
+ tok2strbuf(af_values,"Unknown",
EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+cap_offset),
tokbuf, sizeof(tokbuf)),
EXTRACT_16BITS(opt+i+BGP_OPT_SIZE+cap_offset),
tptr = dat + BGP_NOTIFICATION_SIZE;
TCHECK2(*tptr, 7);
printf(", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u",
- tok2strbuf(bgp_afi_values, "Unknown",
+ tok2strbuf(af_values, "Unknown",
EXTRACT_16BITS(tptr), tokbuf, sizeof(tokbuf)),
EXTRACT_16BITS(tptr),
tok2strbuf(bgp_safi_values, "Unknown", *(tptr+2),
bgp_route_refresh_header = (const struct bgp_route_refresh *)pptr;
printf("\n\t AFI %s (%u), SAFI %s (%u)",
- tok2strbuf(bgp_afi_values,"Unknown",
+ tok2strbuf(af_values,"Unknown",
/* this stinks but the compiler pads the structure
* weird */
EXTRACT_16BITS(&bgp_route_refresh_header->afi),
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.154 2005-11-12 22:22:59 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-isoclns.c,v 1.155 2006-02-21 10:27:40 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "gmpls.h"
#include "oui.h"
-#define IPV4 1 /* AFI value */
-#define IPV6 2 /* AFI value */
-
/*
* IS-IS is defined in ISO 10589. Look there for protocol definitions.
*/
processed=4;
tptr+=4;
- if (afi == IPV4) {
+ if (afi == AF_INET) {
if (!TTEST2(*tptr, 1)) /* fetch status byte */
return (0);
status_byte=*(tptr++);
}
processed++;
#ifdef INET6
- } else if (afi == IPV6) {
+ } else if (afi == AF_INET6) {
if (!TTEST2(*tptr, 1)) /* fetch status & prefix_len byte */
return (0);
status_byte=*(tptr++);
tptr+=byte_length;
processed+=byte_length;
- if (afi == IPV4)
+ if (afi == AF_INET)
printf("%sIPv4 prefix: %15s/%u",
ident,
ipaddr_string(prefix),
bit_length);
#ifdef INET6
- if (afi == IPV6)
+ if (afi == AF_INET6)
printf("%sIPv6 prefix: %s/%u",
ident,
ip6addr_string(prefix),
ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte) ? "down" : "up",
metric);
- if (afi == IPV4 && ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte))
+ if (afi == AF_INET && ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte))
printf(", sub-TLVs present");
#ifdef INET6
- if (afi == IPV6)
+ if (afi == AF_INET6)
printf(", %s%s",
ISIS_MASK_TLV_EXTD_IP6_IE(status_byte) ? "External" : "Internal",
ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte) ? ", sub-TLVs present" : "");
#endif
- if ((ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte) && afi == IPV4) ||
- (ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte) && afi == IPV6)) {
+ if ((ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte) && afi == AF_INET) ||
+ (ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte) && afi == AF_INET6)) {
/* assume that one prefix can hold more
than one subTLV - therefore the first byte must reflect
the aggregate bytecount of the subTLVs for this prefix
case ISIS_TLV_EXTD_IP_REACH:
while (tmp>0) {
- ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV4);
+ ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", AF_INET);
if (ext_ip_len == 0) /* did something go wrong ? */
goto trunctlv;
tptr+=ext_ip_len;
tptr+=mt_len;
tmp-=mt_len;
- ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV4);
+ ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", AF_INET);
if (ext_ip_len == 0) /* did something go wrong ? */
goto trunctlv;
tptr+=ext_ip_len;
#ifdef INET6
case ISIS_TLV_IP6_REACH:
while (tmp>0) {
- ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV6);
+ ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", AF_INET6);
if (ext_ip_len == 0) /* did something go wrong ? */
goto trunctlv;
tptr+=ext_ip_len;
tptr+=mt_len;
tmp-=mt_len;
- ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", IPV6);
+ ext_ip_len = isis_print_extd_ip_reach(tptr, "\n\t ", AF_INET6);
if (ext_ip_len == 0) /* did something go wrong ? */
goto trunctlv;
tptr+=ext_ip_len;
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.17 2006-02-03 08:32:39 hannes Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ldp.c,v 1.18 2006-02-21 10:27:40 hannes Exp $";
#endif
#ifdef HAVE_CONFIG_H
#include "addrtoname.h"
#include "l2vpn.h"
+#include "af.h"
/*
* ldp common header
#define LDP_TLV_FEC 0x0100
#define LDP_TLV_ADDRESS_LIST 0x0101
+#define LDP_TLV_ADDRESS_LIST_AFNUM_LEN 2
#define LDP_TLV_HOP_COUNT 0x0103
#define LDP_TLV_PATH_VECTOR 0x0104
#define LDP_TLV_GENERIC_LABEL 0x0200
{ 0, NULL}
};
-/* RFC1700 address family numbers, same definition in print-bgp.c */
-/* FIXME: move all AF stuff into dedicated files */
-#define AFNUM_INET 1
-#define AFNUM_INET6 2
-#define AFNUM_LEN 2
-
#define FALSE 0
#define TRUE 1
case LDP_TLV_ADDRESS_LIST:
af = EXTRACT_16BITS(tptr);
- tptr+=AFNUM_LEN;
- tlv_tlen -= AFNUM_LEN;
- printf("\n\t Address Family: ");
- if (af == AFNUM_INET) {
- printf("IPv4, addresses:");
+ tptr+=LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
+ tlv_tlen -= LDP_TLV_ADDRESS_LIST_AFNUM_LEN;
+ printf("\n\t Address Family: %s, addresses",
+ tok2str(af_values, "Unknown (%u)", af));
+ switch (af) {
+ case AFNUM_INET:
while(tlv_tlen >= sizeof(struct in_addr)) {
printf(" %s",ipaddr_string(tptr));
tlv_tlen-=sizeof(struct in_addr);
tptr+=sizeof(struct in_addr);
}
- }
+ break;
#ifdef INET6
- else if (af == AFNUM_INET6) {
- printf("IPv6, addresses:");
+ case AFNUM_INET6:
while(tlv_tlen >= sizeof(struct in6_addr)) {
printf(" %s",ip6addr_string(tptr));
tlv_tlen-=sizeof(struct in6_addr);
tptr+=sizeof(struct in6_addr);
}
- }
+ break;
#endif
+ default:
+ /* unknown AF */
+ break;
+ }
break;
case LDP_TLV_COMMON_SESSION:
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.57 2003-11-16 09:36:34 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-rip.c,v 1.58 2006-02-21 10:27:40 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include "addrtoname.h"
#include "extract.h" /* must come after interface.h */
+#include "af.h"
+
struct rip {
u_int8_t rip_cmd; /* request/response */
u_int8_t rip_vers; /* protocol version # */
/* RFC 1058 */
family = EXTRACT_16BITS(&ni->rip_family);
if (family != AF_INET) {
- printf("\n\t AFI: %u:", family);
+ printf("\n\t AFI %s, ", tok2str(af_values, "Unknown (%u)", family));
print_unknown_data((u_int8_t *)&ni->rip_family,"\n\t ",RIP_ROUTELEN);
return;
}
print_unknown_data((u_int8_t *)&ni->rip_dest,"\n\t ",RIP_AUTHLEN);
}
} else if (family != AF_INET) {
- printf("\n\t AFI: %u", family);
+ printf("\n\t AFI %s", tok2str(af_values, "Unknown (%u)", family));
print_unknown_data((u_int8_t *)&ni->rip_tag,"\n\t ",RIP_ROUTELEN-2);
return;
} else { /* AF_INET */
- printf("\n\t AFI: IPv4: %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ",
+ printf("\n\t AFI %s, %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ",
+ tok2str(af_values, "Unknown (%u)", family),
ipaddr_string(&ni->rip_dest),
mask2plen(EXTRACT_32BITS(&ni->rip_dest_mask)),
EXTRACT_16BITS(&ni->rip_tag),
LIBS = -L ${PCAP_DIR}/WPCAP/LIB -lwpcap -lws2_32
OBJS = \
../../addrtoname.o \
+ ../../af.o \
../../checksum.o \
../../gmpls.o \
../../gmt2local.o \
# End Source File
# Begin Source File
+SOURCE=..\..\af.c
+# End Source File
+# Begin Source File
+
SOURCE=..\..\bpf_dump.c
# End Source File
# Begin Source File