+ Summary for 4.8.0 tcpdump release
+ Fix "-x" for Apple PKTAP and PPI packets
+
+ Summary for 4.7.4 tcpdump release
+ RPKI to Router Protocol: Fix Segmentation Faults and other problems
+ RPKI to Router Protocol: print strings with fn_printn()
+ wb: fix some bounds checks
+
Summary for 4.7.3 tcpdump release
Capsicum fixes for FreeBSD 10
Summary for 4.7.2 tcpdump release
DCCP: update Packet Types with RFC4340/IANA names
fixes for CVE-2015-0261: IPv6 mobility header check issue
appletalk.h - AppleTalk definitions
atime.awk - TCP ack awk script
atm.h - ATM traffic type definitions
-atmuni31.h - ATM Q.2931 definitions
bpf_dump.c - BPF program printing routines, in case libpcap doesn't
have them
chdlc.h - Cisco HDLC definitions
@rm -f $@
$(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
-CSRC = setsignal.c tcpdump.c
+CSRC = setsignal.c tcpdump.c util.c
LIBNETDISSECT_SRC=\
addrtoname.c \
nlpid.c \
oui.c \
parsenfsfh.c \
+ print.c \
print-802_11.c \
print-802_15_4.c \
print-ah.c \
print-zephyr.c \
print-zeromq.c \
signature.c \
- util.c
+ util-print.c
LOCALSRC = @LOCALSRC@
GENSRC = version.c
ah.h \
appletalk.h \
atm.h \
- atmuni31.h \
chdlc.h \
cpack.h \
ether.h \
+++ /dev/null
-1. update credits
-2. review "FILES"
-3. search for version info
-4. get PLATFORMS filled in
-5. update CHANGES file
-6. do same for libpcap
* and address to string conversion routines
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+++ /dev/null
-/*
- * Copyright (c) 1997 Yen Yen Lim and North Dakota State University
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Yen Yen Lim and
- North Dakota State University
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Based on UNI3.1 standard by ATM Forum */
-
-/* ATM traffic types based on VPI=0 and (the following VCI */
-#define VCI_PPC 0x05 /* Point-to-point signal msg */
-#define VCI_BCC 0x02 /* Broadcast signal msg */
-#define VCI_OAMF4SC 0x03 /* Segment OAM F4 flow cell */
-#define VCI_OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */
-#define VCI_METAC 0x01 /* Meta signal msg */
-#define VCI_ILMIC 0x10 /* ILMI msg */
-
-/* Q.2931 signalling messages */
-#define CALL_PROCEED 0x02 /* call proceeding */
-#define CONNECT 0x07 /* connect */
-#define CONNECT_ACK 0x0f /* connect_ack */
-#define SETUP 0x05 /* setup */
-#define RELEASE 0x4d /* release */
-#define RELEASE_DONE 0x5a /* release_done */
-#define RESTART 0x46 /* restart */
-#define RESTART_ACK 0x4e /* restart ack */
-#define STATUS 0x7d /* status */
-#define STATUS_ENQ 0x75 /* status ack */
-#define ADD_PARTY 0x80 /* add party */
-#define ADD_PARTY_ACK 0x81 /* add party ack */
-#define ADD_PARTY_REJ 0x82 /* add party rej */
-#define DROP_PARTY 0x83 /* drop party */
-#define DROP_PARTY_ACK 0x84 /* drop party ack */
-
-/* Information Element Parameters in the signalling messages */
-#define CAUSE 0x08 /* cause */
-#define ENDPT_REF 0x54 /* endpoint reference */
-#define AAL_PARA 0x58 /* ATM adaptation layer parameters */
-#define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */
-#define CONNECT_ID 0x5a /* connection identifier */
-#define QOS_PARA 0x5c /* quality of service parameters */
-#define B_HIGHER 0x5d /* broadband higher layer information */
-#define B_BEARER 0x5e /* broadband bearer capability */
-#define B_LOWER 0x5f /* broadband lower information */
-#define CALLING_PARTY 0x6c /* calling party number */
-#define CALLED_PARTY 0x70 /* called party nmber */
-
-#define Q2931 0x09
-
-/* Q.2931 signalling general messages format */
-#define PROTO_POS 0 /* offset of protocol discriminator */
-#define CALL_REF_POS 2 /* offset of call reference value */
-#define MSG_TYPE_POS 5 /* offset of message type */
-#define MSG_LEN_POS 7 /* offset of mesage length */
-#define IE_BEGIN_POS 9 /* offset of first information element */
-
-/* format of signalling messages */
-#define TYPE_POS 0
-#define LEN_POS 2
-#define FIELD_BEGIN_POS 4
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#endif
#include "netdissect.h"
-
-/* forward compatibility */
-
-#ifndef NETDISSECT_REWORKED
-extern netdissect_options *gndo;
-
-#define bflag gndo->ndo_bflag
-#define eflag gndo->ndo_eflag
-#define fflag gndo->ndo_fflag
-#define jflag gndo->ndo_jflag
-#define Kflag gndo->ndo_Kflag
-#define nflag gndo->ndo_nflag
-#define Nflag gndo->ndo_Nflag
-#define Oflag gndo->ndo_Oflag
-#define pflag gndo->ndo_pflag
-#define qflag gndo->ndo_qflag
-#define Rflag gndo->ndo_Rflag
-#define sflag gndo->ndo_sflag
-#define Sflag gndo->ndo_Sflag
-#define tflag gndo->ndo_tflag
-#define Uflag gndo->ndo_Uflag
-#define uflag gndo->ndo_uflag
-#define vflag gndo->ndo_vflag
-#define xflag gndo->ndo_xflag
-#define Xflag gndo->ndo_Xflag
-#define Cflag gndo->ndo_Cflag
-#define Gflag gndo->ndo_Gflag
-#define Aflag gndo->ndo_Aflag
-#define Bflag gndo->ndo_Bflag
-#define Iflag gndo->ndo_Iflag
-#define suppress_default_print gndo->ndo_suppress_default_print
-#define packettype gndo->ndo_packettype
-#define sigsecret gndo->ndo_sigsecret
-#define Wflag gndo->ndo_Wflag
-#define WflagChars gndo->ndo_WflagChars
-#define Cflag_count gndo->ndo_Cflag_count
-#define Gflag_count gndo->ndo_Gflag_count
-#define Gflag_time gndo->ndo_Gflag_time
-#define Hflag gndo->ndo_Hflag
-#define snaplen gndo->ndo_snaplen
-#define snapend gndo->ndo_snapend
-
-extern void default_print(const u_char *, u_int);
-
-#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
char *buf, size_t bufsize);
/* tok2str is deprecated */
-extern const char *tok2str(const struct tok *, const char *, int);
-extern char *bittok2str(const struct tok *, const char *, int);
-extern char *bittok2str_nosep(const struct tok *, const char *, int);
+extern const char *tok2str(const struct tok *, const char *, u_int);
+extern char *bittok2str(const struct tok *, const char *, u_int);
+extern char *bittok2str_nosep(const struct tok *, const char *, u_int);
typedef struct netdissect_options netdissect_options;
* http://www.kb.cert.org/vuls/id/162289
*/
#define ND_TTEST2(var, l) \
+ ((l) >= 0 && \
((uintptr_t)ndo->ndo_snapend - (l) <= (uintptr_t)ndo->ndo_snapend && \
- (uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l))
+ (uintptr_t)&(var) <= (uintptr_t)ndo->ndo_snapend - (l)))
/* True if "var" was captured */
#define ND_TTEST(var) ND_TTEST2(var, sizeof(var))
extern int fn_print(netdissect_options *, const u_char *, const u_char *);
extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *);
extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *);
-extern const char *tok2str(const struct tok *, const char *, int);
/*
* Flags for txtproto_print().
extern void loopback_print(netdissect_options *, const u_char *, const u_int);
extern void carp_print(netdissect_options *, const u_char *, u_int, int);
-extern void ether_print(netdissect_options *,
- const u_char *, u_int, u_int,
- void (*)(netdissect_options *, const u_char *),
- const u_char *);
+extern u_int ether_print(netdissect_options *,
+ const u_char *, u_int, u_int,
+ void (*)(netdissect_options *, const u_char *),
+ const u_char *);
extern u_int ether_if_print(netdissect_options *,
const struct pcap_pkthdr *,const u_char *);
extern u_int token_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
extern void vqp_print(netdissect_options *, register const u_char *, register u_int);
extern void zephyr_print(netdissect_options *, const u_char *, int);
-extern void fddi_print(netdissect_options *, const u_char *, u_int, u_int);
+extern u_int fddi_print(netdissect_options *, const u_char *, u_int, u_int);
extern u_int fddi_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
extern void mpcp_print(netdissect_options *, const u_char *, u_int);
extern void rpki_rtr_print(netdissect_options *, const u_char *, u_int);
extern u_int sll_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *);
extern void dccp_print(netdissect_options *, const u_char *, const u_char *, u_int);
-extern int llc_print(netdissect_options *, const u_char *, u_int, u_int, const u_char *, const u_char *, u_short *);
-extern int snap_print(netdissect_options *, const u_char *, u_int, u_int, u_int);
+extern int llc_print(netdissect_options *, const u_char *, u_int, u_int, const u_char *, const u_char *);
+extern int snap_print(netdissect_options *, const u_char *, u_int, u_int,
+ const u_char *, const u_char *, u_int);
extern void eigrp_print(netdissect_options *, const u_char *, u_int);
extern void stp_print(netdissect_options *, const u_char *, u_int);
extern void l2tp_print(netdissect_options *, const u_char *, u_int);
extern void geonet_print(netdissect_options *ndo,const u_char *eth_hdr,const u_char *geo_pck, u_int len);
extern void calm_fast_print(netdissect_options *ndo,const u_char *eth_hdr,const u_char *calm_pck, u_int len);
+extern netdissect_options *gndo;
+
#endif /* netdissect_h */
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* Western Research Laboratory
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define IEEE802_11_BSSID_LEN 6
#define IEEE802_11_RA_LEN 6
#define IEEE802_11_TA_LEN 6
+#define IEEE802_11_ADDR1_LEN 6
#define IEEE802_11_SEQ_LEN 2
#define IEEE802_11_CTL_LEN 2
+#define IEEE802_11_CARRIED_FC_LEN 2
+#define IEEE802_11_HT_CONTROL_LEN 4
#define IEEE802_11_IV_LEN 3
#define IEEE802_11_KID_LEN 1
#define FC_RETRY(fc) ((fc) & 0x0800)
#define FC_POWER_MGMT(fc) ((fc) & 0x1000)
#define FC_MORE_DATA(fc) ((fc) & 0x2000)
-#define FC_WEP(fc) ((fc) & 0x4000)
+#define FC_PROTECTED(fc) ((fc) & 0x4000)
#define FC_ORDER(fc) ((fc) & 0x8000)
struct mgmt_header_t {
uint16_t fc;
uint16_t duration;
- uint8_t da[6];
- uint8_t sa[6];
- uint8_t bssid[6];
+ uint8_t da[IEEE802_11_DA_LEN];
+ uint8_t sa[IEEE802_11_SA_LEN];
+ uint8_t bssid[IEEE802_11_BSSID_LEN];
uint16_t seq_ctrl;
};
struct tim_t tim;
};
-struct ctrl_rts_t {
+struct ctrl_control_wrapper_hdr_t {
uint16_t fc;
uint16_t duration;
- uint8_t ra[6];
- uint8_t ta[6];
- uint8_t fcs[4];
+ uint8_t addr1[IEEE802_11_ADDR1_LEN];
+ uint16_t carried_fc[IEEE802_11_CARRIED_FC_LEN];
+ uint16_t ht_control[IEEE802_11_HT_CONTROL_LEN];
+};
+
+#define CTRL_CONTROL_WRAPPER_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
+ IEEE802_11_ADDR1_LEN+\
+ IEEE802_11_CARRIED_FC_LEN+\
+ IEEE802_11_HT_CONTROL_LEN)
+
+struct ctrl_rts_hdr_t {
+ uint16_t fc;
+ uint16_t duration;
+ uint8_t ra[IEEE802_11_RA_LEN];
+ uint8_t ta[IEEE802_11_TA_LEN];
};
#define CTRL_RTS_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
IEEE802_11_RA_LEN+IEEE802_11_TA_LEN)
-struct ctrl_cts_t {
+struct ctrl_cts_hdr_t {
uint16_t fc;
uint16_t duration;
- uint8_t ra[6];
- uint8_t fcs[4];
+ uint8_t ra[IEEE802_11_RA_LEN];
};
#define CTRL_CTS_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN)
-struct ctrl_ack_t {
+struct ctrl_ack_hdr_t {
uint16_t fc;
uint16_t duration;
- uint8_t ra[6];
- uint8_t fcs[4];
+ uint8_t ra[IEEE802_11_RA_LEN];
};
#define CTRL_ACK_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN)
-struct ctrl_ps_poll_t {
+struct ctrl_ps_poll_hdr_t {
uint16_t fc;
uint16_t aid;
- uint8_t bssid[6];
- uint8_t ta[6];
- uint8_t fcs[4];
+ uint8_t bssid[IEEE802_11_BSSID_LEN];
+ uint8_t ta[IEEE802_11_TA_LEN];
};
#define CTRL_PS_POLL_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_AID_LEN+\
IEEE802_11_BSSID_LEN+IEEE802_11_TA_LEN)
-struct ctrl_end_t {
+struct ctrl_end_hdr_t {
uint16_t fc;
uint16_t duration;
- uint8_t ra[6];
- uint8_t bssid[6];
- uint8_t fcs[4];
+ uint8_t ra[IEEE802_11_RA_LEN];
+ uint8_t bssid[IEEE802_11_BSSID_LEN];
};
#define CTRL_END_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
IEEE802_11_RA_LEN+IEEE802_11_BSSID_LEN)
-struct ctrl_end_ack_t {
+struct ctrl_end_ack_hdr_t {
uint16_t fc;
uint16_t duration;
- uint8_t ra[6];
- uint8_t bssid[6];
- uint8_t fcs[4];
+ uint8_t ra[IEEE802_11_RA_LEN];
+ uint8_t bssid[IEEE802_11_BSSID_LEN];
};
#define CTRL_END_ACK_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
IEEE802_11_RA_LEN+IEEE802_11_BSSID_LEN)
-struct ctrl_ba_t {
+struct ctrl_ba_hdr_t {
uint16_t fc;
uint16_t duration;
- uint8_t ra[6];
- uint8_t fcs[4];
+ uint8_t ra[IEEE802_11_RA_LEN];
};
#define CTRL_BA_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+IEEE802_11_RA_LEN)
-struct ctrl_bar_t {
+struct ctrl_bar_hdr_t {
uint16_t fc;
uint16_t dur;
- uint8_t ra[6];
- uint8_t ta[6];
+ uint8_t ra[IEEE802_11_RA_LEN];
+ uint8_t ta[IEEE802_11_TA_LEN];
uint16_t ctl;
uint16_t seq;
- uint8_t fcs[4];
};
#define CTRL_BAR_HDRLEN (IEEE802_11_FC_LEN+IEEE802_11_DUR_LEN+\
return 0;
iv = EXTRACT_LE_32BITS(p);
- ND_PRINT((ndo, "Data IV:%3x Pad %x KeyID %x", IV_IV(iv), IV_PAD(iv),
+ ND_PRINT((ndo, " IV:%3x Pad %x KeyID %x", IV_IV(iv), IV_PAD(iv),
IV_KEYID(iv)));
return 1;
static int
handle_deauth(netdissect_options *ndo,
- const struct mgmt_header_t *pmh, const u_char *p, u_int length)
+ const uint8_t *src, const u_char *p, u_int length)
{
struct mgmt_body_t pbody;
const char *reason = NULL;
if (ndo->ndo_eflag) {
ND_PRINT((ndo, ": %s", reason));
} else {
- ND_PRINT((ndo, " (%s): %s", etheraddr_string(ndo, pmh->sa), reason));
+ ND_PRINT((ndo, " (%s): %s", etheraddr_string(ndo, src), reason));
}
return 1;
}
static int
handle_action(netdissect_options *ndo,
- const struct mgmt_header_t *pmh, const u_char *p, u_int length)
+ const uint8_t *src, const u_char *p, u_int length)
{
if (!ND_TTEST2(*p, 2))
return 0;
if (ndo->ndo_eflag) {
ND_PRINT((ndo, ": "));
} else {
- ND_PRINT((ndo, " (%s): ", etheraddr_string(ndo, pmh->sa)));
+ ND_PRINT((ndo, " (%s): ", etheraddr_string(ndo, src)));
}
switch (p[0]) {
case 0: ND_PRINT((ndo, "Spectrum Management Act#%d", p[1])); break;
static int
mgmt_body_print(netdissect_options *ndo,
- uint16_t fc, const struct mgmt_header_t *pmh,
- const u_char *p, u_int length)
+ uint16_t fc, const uint8_t *src, const u_char *p, u_int length)
{
ND_PRINT((ndo, "%s", tok2str(st_str, "Unhandled Management subtype(%x)", FC_SUBTYPE(fc))));
+
+ /* There may be a problem w/ AP not having this bit set */
+ if (FC_PROTECTED(fc))
+ return wep_print(ndo, p);
switch (FC_SUBTYPE(fc)) {
case ST_ASSOC_REQUEST:
return handle_assoc_request(ndo, p, length);
case ST_DISASSOC:
return handle_disassoc(ndo, p, length);
case ST_AUTH:
- if (!ND_TTEST2(*p, 3))
- return 0;
- if ((p[0] == 0 ) && (p[1] == 0) && (p[2] == 0)) {
- ND_PRINT((ndo, "Authentication (Shared-Key)-3 "));
- return wep_print(ndo, p);
- }
return handle_auth(ndo, p, length);
case ST_DEAUTH:
- return handle_deauth(ndo, pmh, p, length);
+ return handle_deauth(ndo, src, p, length);
case ST_ACTION:
- return handle_action(ndo, pmh, p, length);
+ return handle_action(ndo, src, p, length);
default:
return 1;
}
return 0;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ",
- etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ra),
- etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ta),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->ctl)),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->seq))));
+ etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ra),
+ etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ta),
+ EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->ctl)),
+ EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->seq))));
break;
case CTRL_BA:
if (!ND_TTEST2(*p, CTRL_BA_HDRLEN))
return 0;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, " RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_ba_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_ba_hdr_t *)p)->ra)));
break;
case CTRL_PS_POLL:
if (!ND_TTEST2(*p, CTRL_PS_POLL_HDRLEN))
return 0;
ND_PRINT((ndo, " AID(%x)",
- EXTRACT_LE_16BITS(&(((const struct ctrl_ps_poll_t *)p)->aid))));
+ EXTRACT_LE_16BITS(&(((const struct ctrl_ps_poll_hdr_t *)p)->aid))));
break;
case CTRL_RTS:
if (!ND_TTEST2(*p, CTRL_RTS_HDRLEN))
return 0;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, " TA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_rts_t *)p)->ta)));
+ etheraddr_string(ndo, ((const struct ctrl_rts_hdr_t *)p)->ta)));
break;
case CTRL_CTS:
if (!ND_TTEST2(*p, CTRL_CTS_HDRLEN))
return 0;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, " RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_cts_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_cts_hdr_t *)p)->ra)));
break;
case CTRL_ACK:
if (!ND_TTEST2(*p, CTRL_ACK_HDRLEN))
return 0;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, " RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_ack_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_ack_hdr_t *)p)->ra)));
break;
case CTRL_CF_END:
if (!ND_TTEST2(*p, CTRL_END_HDRLEN))
return 0;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, " RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_end_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_end_hdr_t *)p)->ra)));
break;
case CTRL_END_ACK:
if (!ND_TTEST2(*p, CTRL_END_ACK_HDRLEN))
return 0;
if (!ndo->ndo_eflag)
ND_PRINT((ndo, " RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_end_ack_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_end_ack_hdr_t *)p)->ra)));
break;
}
return 1;
}
-/*
- * Print Header funcs
- */
-
/*
* Data Frame - Address field contents
*
* 1 | 1 | RA | TA | DA | SA
*/
+/*
+ * Function to get source and destination MAC addresses for a data frame.
+ */
+static void
+get_data_src_dst_mac(uint16_t fc, const u_char *p, const uint8_t **srcp,
+ const uint8_t **dstp)
+{
+#define ADDR1 (p + 4)
+#define ADDR2 (p + 10)
+#define ADDR3 (p + 16)
+#define ADDR4 (p + 24)
+
+ if (!FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
+ *srcp = ADDR2;
+ *dstp = ADDR1;
+ } else if (!FC_TO_DS(fc) && FC_FROM_DS(fc)) {
+ *srcp = ADDR3;
+ *dstp = ADDR1;
+ } else if (FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
+ *srcp = ADDR2;
+ *dstp = ADDR3;
+ } else if (FC_TO_DS(fc) && FC_FROM_DS(fc)) {
+ *srcp = ADDR4;
+ *dstp = ADDR3;
+ }
+
+#undef ADDR1
+#undef ADDR2
+#undef ADDR3
+#undef ADDR4
+}
+
+static void
+get_mgmt_src_dst_mac(const u_char *p, const uint8_t **srcp, const uint8_t **dstp)
+{
+ const struct mgmt_header_t *hp = (const struct mgmt_header_t *) p;
+
+ if (srcp != NULL)
+ *srcp = hp->sa;
+ if (dstp != NULL)
+ *dstp = hp->da;
+}
+
+/*
+ * Print Header funcs
+ */
+
static void
-data_header_print(netdissect_options *ndo,
- uint16_t fc, const u_char *p, const uint8_t **srcp,
- const uint8_t **dstp)
+data_header_print(netdissect_options *ndo, uint16_t fc, const u_char *p)
{
u_int subtype = FC_SUBTYPE(fc);
#define ADDR4 (p + 24)
if (!FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
- if (srcp != NULL)
- *srcp = ADDR2;
- if (dstp != NULL)
- *dstp = ADDR1;
- if (!ndo->ndo_eflag)
- return;
ND_PRINT((ndo, "DA:%s SA:%s BSSID:%s ",
etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2),
etheraddr_string(ndo, ADDR3)));
} else if (!FC_TO_DS(fc) && FC_FROM_DS(fc)) {
- if (srcp != NULL)
- *srcp = ADDR3;
- if (dstp != NULL)
- *dstp = ADDR1;
- if (!ndo->ndo_eflag)
- return;
ND_PRINT((ndo, "DA:%s BSSID:%s SA:%s ",
etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2),
etheraddr_string(ndo, ADDR3)));
} else if (FC_TO_DS(fc) && !FC_FROM_DS(fc)) {
- if (srcp != NULL)
- *srcp = ADDR2;
- if (dstp != NULL)
- *dstp = ADDR3;
- if (!ndo->ndo_eflag)
- return;
ND_PRINT((ndo, "BSSID:%s SA:%s DA:%s ",
etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2),
etheraddr_string(ndo, ADDR3)));
} else if (FC_TO_DS(fc) && FC_FROM_DS(fc)) {
- if (srcp != NULL)
- *srcp = ADDR4;
- if (dstp != NULL)
- *dstp = ADDR3;
- if (!ndo->ndo_eflag)
- return;
ND_PRINT((ndo, "RA:%s TA:%s DA:%s SA:%s ",
etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2),
etheraddr_string(ndo, ADDR3), etheraddr_string(ndo, ADDR4)));
}
static void
-mgmt_header_print(netdissect_options *ndo,
- const u_char *p, const uint8_t **srcp, const uint8_t **dstp)
+mgmt_header_print(netdissect_options *ndo, const u_char *p)
{
const struct mgmt_header_t *hp = (const struct mgmt_header_t *) p;
- if (srcp != NULL)
- *srcp = hp->sa;
- if (dstp != NULL)
- *dstp = hp->da;
- if (!ndo->ndo_eflag)
- return;
-
ND_PRINT((ndo, "BSSID:%s DA:%s SA:%s ",
etheraddr_string(ndo, (hp)->bssid), etheraddr_string(ndo, (hp)->da),
etheraddr_string(ndo, (hp)->sa)));
}
static void
-ctrl_header_print(netdissect_options *ndo,
- uint16_t fc, const u_char *p, const uint8_t **srcp,
- const uint8_t **dstp)
+ctrl_header_print(netdissect_options *ndo, uint16_t fc, const u_char *p)
{
- if (srcp != NULL)
- *srcp = NULL;
- if (dstp != NULL)
- *dstp = NULL;
- if (!ndo->ndo_eflag)
- return;
-
switch (FC_SUBTYPE(fc)) {
case CTRL_BAR:
ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ",
- etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ra),
- etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ta),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->ctl)),
- EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->seq))));
+ etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ra),
+ etheraddr_string(ndo, ((const struct ctrl_bar_hdr_t *)p)->ta),
+ EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->ctl)),
+ EXTRACT_LE_16BITS(&(((const struct ctrl_bar_hdr_t *)p)->seq))));
break;
case CTRL_BA:
ND_PRINT((ndo, "RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_ba_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_ba_hdr_t *)p)->ra)));
break;
case CTRL_PS_POLL:
ND_PRINT((ndo, "BSSID:%s TA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_ps_poll_t *)p)->bssid),
- etheraddr_string(ndo, ((const struct ctrl_ps_poll_t *)p)->ta)));
+ etheraddr_string(ndo, ((const struct ctrl_ps_poll_hdr_t *)p)->bssid),
+ etheraddr_string(ndo, ((const struct ctrl_ps_poll_hdr_t *)p)->ta)));
break;
case CTRL_RTS:
ND_PRINT((ndo, "RA:%s TA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_rts_t *)p)->ra),
- etheraddr_string(ndo, ((const struct ctrl_rts_t *)p)->ta)));
+ etheraddr_string(ndo, ((const struct ctrl_rts_hdr_t *)p)->ra),
+ etheraddr_string(ndo, ((const struct ctrl_rts_hdr_t *)p)->ta)));
break;
case CTRL_CTS:
ND_PRINT((ndo, "RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_cts_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_cts_hdr_t *)p)->ra)));
break;
case CTRL_ACK:
ND_PRINT((ndo, "RA:%s ",
- etheraddr_string(ndo, ((const struct ctrl_ack_t *)p)->ra)));
+ etheraddr_string(ndo, ((const struct ctrl_ack_hdr_t *)p)->ra)));
break;
case CTRL_CF_END:
ND_PRINT((ndo, "RA:%s BSSID:%s ",
- etheraddr_string(ndo, ((const struct ctrl_end_t *)p)->ra),
- etheraddr_string(ndo, ((const struct ctrl_end_t *)p)->bssid)));
+ etheraddr_string(ndo, ((const struct ctrl_end_hdr_t *)p)->ra),
+ etheraddr_string(ndo, ((const struct ctrl_end_hdr_t *)p)->bssid)));
break;
case CTRL_END_ACK:
ND_PRINT((ndo, "RA:%s BSSID:%s ",
- etheraddr_string(ndo, ((const struct ctrl_end_ack_t *)p)->ra),
- etheraddr_string(ndo, ((const struct ctrl_end_ack_t *)p)->bssid)));
+ etheraddr_string(ndo, ((const struct ctrl_end_ack_hdr_t *)p)->ra),
+ etheraddr_string(ndo, ((const struct ctrl_end_ack_hdr_t *)p)->bssid)));
break;
default:
- ND_PRINT((ndo, "(H) Unknown Ctrl Subtype"));
+ /* We shouldn't get here - we should already have quit */
break;
}
}
return MGMT_HDRLEN;
case T_CTRL:
switch (FC_SUBTYPE(fc)) {
+ case CTRL_CONTROL_WRAPPER:
+ return CTRL_CONTROL_WRAPPER_HDRLEN;
case CTRL_BAR:
return CTRL_BAR_HDRLEN;
+ case CTRL_BA:
+ return CTRL_BA_HDRLEN;
case CTRL_PS_POLL:
return CTRL_PS_POLL_HDRLEN;
case CTRL_RTS:
case CTRL_END_ACK:
return CTRL_END_ACK_HDRLEN;
default:
+ ND_PRINT((ndo, "unknown 802.11 ctrl frame subtype (%d)", FC_SUBTYPE(fc)));
return 0;
}
case T_DATA:
len += 2;
return len;
default:
- ND_PRINT((ndo, "unknown IEEE802.11 frame type (%d)", FC_TYPE(fc)));
+ ND_PRINT((ndo, "unknown 802.11 frame type (%d)", FC_TYPE(fc)));
return 0;
}
}
}
/*
- * Print the 802.11 MAC header if eflag is set, and set "*srcp" and "*dstp"
- * to point to the source and destination MAC addresses in any case if
- * "srcp" and "dstp" aren't null.
+ * Print the 802.11 MAC header.
*/
static void
ieee_802_11_hdr_print(netdissect_options *ndo,
uint16_t fc, const u_char *p, u_int hdrlen,
- u_int meshdrlen, const uint8_t **srcp,
- const uint8_t **dstp)
+ u_int meshdrlen)
{
if (ndo->ndo_vflag) {
if (FC_MORE_DATA(fc))
ND_PRINT((ndo, "Retry "));
if (FC_ORDER(fc))
ND_PRINT((ndo, "Strictly Ordered "));
- if (FC_WEP(fc))
- ND_PRINT((ndo, "WEP Encrypted "));
+ if (FC_PROTECTED(fc))
+ ND_PRINT((ndo, "Protected "));
if (FC_TYPE(fc) != T_CTRL || FC_SUBTYPE(fc) != CTRL_PS_POLL)
ND_PRINT((ndo, "%dus ",
EXTRACT_LE_16BITS(
switch (FC_TYPE(fc)) {
case T_MGMT:
- mgmt_header_print(ndo, p, srcp, dstp);
+ mgmt_header_print(ndo, p);
break;
case T_CTRL:
- ctrl_header_print(ndo, fc, p, srcp, dstp);
+ ctrl_header_print(ndo, fc, p);
break;
case T_DATA:
- data_header_print(ndo, fc, p, srcp, dstp);
+ data_header_print(ndo, fc, p);
break;
default:
- ND_PRINT((ndo, "(header) unknown IEEE802.11 frame type (%d)",
- FC_TYPE(fc)));
- *srcp = NULL;
- *dstp = NULL;
break;
}
}
uint16_t fc;
u_int caplen, hdrlen, meshdrlen;
const uint8_t *src, *dst;
- u_short extracted_ethertype;
+ int llc_hdrlen;
caplen = orig_caplen;
/* Remove FCS, if present */
fc = EXTRACT_LE_16BITS(p);
hdrlen = extract_header_length(ndo, fc);
+ if (hdrlen == 0) {
+ /* Unknown frame type or control frame subtype; quit. */
+ return (0);
+ }
if (pad)
hdrlen = roundup2(hdrlen, 4);
if (ndo->ndo_Hflag && FC_TYPE(fc) == T_DATA &&
} else
meshdrlen = 0;
-
if (caplen < hdrlen) {
ND_PRINT((ndo, "%s", tstr));
return hdrlen;
}
- ieee_802_11_hdr_print(ndo, fc, p, hdrlen, meshdrlen, &src, &dst);
+ if (ndo->ndo_eflag)
+ ieee_802_11_hdr_print(ndo, fc, p, hdrlen, meshdrlen);
/*
* Go past the 802.11 header.
switch (FC_TYPE(fc)) {
case T_MGMT:
- if (!mgmt_body_print(ndo, fc,
- (const struct mgmt_header_t *)(p - hdrlen), p, length)) {
+ get_mgmt_src_dst_mac(p - hdrlen, &src, &dst);
+ if (!mgmt_body_print(ndo, fc, src, p, length)) {
ND_PRINT((ndo, "%s", tstr));
return hdrlen;
}
if (DATA_FRAME_IS_NULL(FC_SUBTYPE(fc)))
return hdrlen; /* no-data frame */
/* There may be a problem w/ AP not having this bit set */
- if (FC_WEP(fc)) {
+ if (FC_PROTECTED(fc)) {
+ ND_PRINT((ndo, "Data"));
if (!wep_print(ndo, p)) {
ND_PRINT((ndo, "%s", tstr));
return hdrlen;
}
- } else if (llc_print(ndo, p, length, caplen, dst, src,
- &extracted_ethertype) == 0) {
- /*
- * Some kinds of LLC packet we cannot
- * handle intelligently
- */
- if (!ndo->ndo_eflag)
- ieee_802_11_hdr_print(ndo, fc, p - hdrlen, hdrlen,
- meshdrlen, NULL, NULL);
- if (extracted_ethertype)
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(
- htons(extracted_ethertype))));
- if (!ndo->ndo_suppress_default_print)
- ND_DEFAULTPRINT(p, caplen);
+ } else {
+ get_data_src_dst_mac(fc, p - hdrlen, &src, &dst);
+ llc_hdrlen = llc_print(ndo, p, length, caplen, dst, src);
+ if (llc_hdrlen < 0) {
+ /*
+ * Some kinds of LLC packet we cannot
+ * handle intelligently
+ */
+ if (!ndo->ndo_suppress_default_print)
+ ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
+ }
+ hdrlen += llc_hdrlen;
}
break;
default:
- ND_PRINT((ndo, "unknown 802.11 frame type (%d)", FC_TYPE(fc)));
+ /* We shouldn't get here - we should already have quit */
break;
}
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
fp = (const struct firewire_header *)bp;
ND_PRINT((ndo, "%s > %s",
- linkaddr_string(ndo, fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN),
- linkaddr_string(ndo, fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN)));
+ linkaddr_string(ndo, fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN),
+ linkaddr_string(ndo, fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN)));
firewire_type = EXTRACT_16BITS(&fp->firewire_type);
if (!ndo->ndo_qflag) {
* From: NetBSD: print-arcnet.c,v 1.2 2000/04/24 13:02:28 itojun Exp
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* Format and print AppleTalk packets.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "extract.h"
#include "addrtoname.h"
#include "atm.h"
-#include "atmuni31.h"
#include "llc.h"
+/* start of the original atmuni31.h */
+
+/*
+ * Copyright (c) 1997 Yen Yen Lim and North Dakota State University
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Yen Yen Lim and
+ North Dakota State University
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Based on UNI3.1 standard by ATM Forum */
+
+/* ATM traffic types based on VPI=0 and (the following VCI */
+#define VCI_PPC 0x05 /* Point-to-point signal msg */
+#define VCI_BCC 0x02 /* Broadcast signal msg */
+#define VCI_OAMF4SC 0x03 /* Segment OAM F4 flow cell */
+#define VCI_OAMF4EC 0x04 /* End-to-end OAM F4 flow cell */
+#define VCI_METAC 0x01 /* Meta signal msg */
+#define VCI_ILMIC 0x10 /* ILMI msg */
+
+/* Q.2931 signalling messages */
+#define CALL_PROCEED 0x02 /* call proceeding */
+#define CONNECT 0x07 /* connect */
+#define CONNECT_ACK 0x0f /* connect_ack */
+#define SETUP 0x05 /* setup */
+#define RELEASE 0x4d /* release */
+#define RELEASE_DONE 0x5a /* release_done */
+#define RESTART 0x46 /* restart */
+#define RESTART_ACK 0x4e /* restart ack */
+#define STATUS 0x7d /* status */
+#define STATUS_ENQ 0x75 /* status ack */
+#define ADD_PARTY 0x80 /* add party */
+#define ADD_PARTY_ACK 0x81 /* add party ack */
+#define ADD_PARTY_REJ 0x82 /* add party rej */
+#define DROP_PARTY 0x83 /* drop party */
+#define DROP_PARTY_ACK 0x84 /* drop party ack */
+
+/* Information Element Parameters in the signalling messages */
+#define CAUSE 0x08 /* cause */
+#define ENDPT_REF 0x54 /* endpoint reference */
+#define AAL_PARA 0x58 /* ATM adaptation layer parameters */
+#define TRAFF_DESCRIP 0x59 /* atm traffic descriptors */
+#define CONNECT_ID 0x5a /* connection identifier */
+#define QOS_PARA 0x5c /* quality of service parameters */
+#define B_HIGHER 0x5d /* broadband higher layer information */
+#define B_BEARER 0x5e /* broadband bearer capability */
+#define B_LOWER 0x5f /* broadband lower information */
+#define CALLING_PARTY 0x6c /* calling party number */
+#define CALLED_PARTY 0x70 /* called party nmber */
+
+#define Q2931 0x09
+
+/* Q.2931 signalling general messages format */
+#define PROTO_POS 0 /* offset of protocol discriminator */
+#define CALL_REF_POS 2 /* offset of call reference value */
+#define MSG_TYPE_POS 5 /* offset of message type */
+#define MSG_LEN_POS 7 /* offset of mesage length */
+#define IE_BEGIN_POS 9 /* offset of first information element */
+
+/* format of signalling messages */
+#define TYPE_POS 0
+#define LEN_POS 2
+#define FIELD_BEGIN_POS 4
+
+/* end of the original atmuni31.h */
+
static const char tstr[] = "[|atm]";
#define OAM_CRC10_MASK 0x3ff
/*
* Print an RFC 1483 LLC-encapsulated ATM frame.
*/
-static void
+static u_int
atm_llc_print(netdissect_options *ndo,
const u_char *p, int length, int caplen)
{
- u_short extracted_ethertype;
-
- if (!llc_print(ndo, p, length, caplen, NULL, NULL,
- &extracted_ethertype)) {
- /* ether_type not known, print raw packet */
- if (extracted_ethertype) {
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(htons(extracted_ethertype))));
- }
+ int llc_hdrlen;
+
+ llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
+ if (llc_hdrlen < 0) {
+ /* packet not known, print raw packet */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
+ return (llc_hdrlen);
}
/*
caplen -= 20;
hdrlen += 20;
}
- atm_llc_print(ndo, p, length, caplen);
+ hdrlen += atm_llc_print(ndo, p, length, caplen);
return (hdrlen);
}
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* complete BGP support.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* Format and print bootp packets.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
{
u_int caplen = h->caplen;
u_int length = h->len;
- u_short extracted_ethertype;
+ int llc_hdrlen;
if (memcmp(rfcllc, p, sizeof(rfcllc))==0 && caplen < RFC1483LLC_LEN) {
ND_PRINT((ndo, "[|cip]"));
/*
* LLC header is present. Try to print it & higher layers.
*/
- if (llc_print(ndo, p, length, caplen, NULL, NULL,
- &extracted_ethertype) == 0) {
- /* ether_type not known, print raw packet */
- if (!ndo->ndo_eflag)
- cip_print(ndo, length);
- if (extracted_ethertype) {
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(htons(extracted_ethertype))));
- }
+ llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
+ if (llc_hdrlen < 0) {
+ /* packet type not known, print raw packet */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
} else {
/*
* LLC header is absent; treat it as just IP.
*/
+ llc_hdrlen = 0;
ip_print(ndo, p, length);
}
- return (0);
+ return (llc_hdrlen);
}
* http://www.cisco.com/c/en/us/td/docs/net_mgmt/netflow_collection_engine/3-6/user/guide/format.html#wp1005892
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* BSD-style license that accompanies tcpdump or the GNU GPL version 2
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* RFC6334: Dual-Stack Lite option,
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* a pointer to a function that can print header information for that
* frame's protocol, and an argument to pass to that function.
*/
-void
+u_int
ether_print(netdissect_options *ndo,
const u_char *p, u_int length, u_int caplen,
void (*print_encap_header)(netdissect_options *ndo, const u_char *), const u_char *encap_header_arg)
struct ether_header *ep;
u_int orig_length;
u_short ether_type;
- u_short extracted_ether_type;
+ u_int hdrlen;
+ int llc_hdrlen;
- if (caplen < ETHER_HDRLEN || length < ETHER_HDRLEN) {
+ if (caplen < ETHER_HDRLEN) {
+ ND_PRINT((ndo, "[|ether]"));
+ return (caplen);
+ }
+ if (length < ETHER_HDRLEN) {
ND_PRINT((ndo, "[|ether]"));
- return;
+ return (length);
}
if (ndo->ndo_eflag) {
caplen -= ETHER_HDRLEN;
ep = (struct ether_header *)p;
p += ETHER_HDRLEN;
+ hdrlen = ETHER_HDRLEN;
ether_type = EXTRACT_16BITS(&ep->ether_type);
*/
if (ether_type <= ETHERMTU) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep),
- &extracted_ether_type) == 0) {
- /* ether_type not known, print raw packet */
- if (!ndo->ndo_eflag) {
- if (print_encap_header != NULL)
- (*print_encap_header)(ndo, encap_header_arg);
- ether_hdr_print(ndo, (u_char *)ep, orig_length);
- }
-
+ llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep));
+ if (llc_hdrlen < 0) {
+ /* packet type not known, print raw packet */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
+ hdrlen += llc_hdrlen;
} else if (ether_type == ETHERTYPE_8021Q ||
ether_type == ETHERTYPE_8021Q9100 ||
ether_type == ETHERTYPE_8021Q9200 ||
* Print VLAN information, and then go back and process
* the enclosed type field.
*/
- if (caplen < 4 || length < 4) {
+ if (caplen < 4) {
+ ND_PRINT((ndo, "[|vlan]"));
+ return (hdrlen + caplen);
+ }
+ if (length < 4) {
ND_PRINT((ndo, "[|vlan]"));
- return;
+ return (hdrlen + length);
}
if (ndo->ndo_eflag) {
uint16_t tag = EXTRACT_16BITS(p);
p += 4;
length -= 4;
caplen -= 4;
+ hdrlen += 4;
goto recurse;
} else if (ether_type == ETHERTYPE_JUMBO) {
/*
* there's an LLC header and payload.
*/
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep),
- &extracted_ether_type) == 0) {
- /* ether_type not known, print raw packet */
- if (!ndo->ndo_eflag) {
- if (print_encap_header != NULL)
- (*print_encap_header)(ndo, encap_header_arg);
- ether_hdr_print(ndo, (u_char *)ep, orig_length);
- }
-
+ llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep));
+ if (llc_hdrlen < 0) {
+ /* packet type not known, print raw packet */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
+ hdrlen += llc_hdrlen;
} else {
if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
/* ether_type not known, print raw packet */
ND_DEFAULTPRINT(p, caplen);
}
}
+ return (hdrlen);
}
/*
ether_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
const u_char *p)
{
- ether_print(ndo, p, h->len, h->caplen, NULL, NULL);
-
- return (ETHER_HDRLEN);
+ return (ether_print(ndo, p, h->len, h->caplen, NULL, NULL));
}
/*
}
/* Skip the pseudo-header. */
- ether_print(ndo, p + 4, h->len - 4, h->caplen - 4, NULL, NULL);
-
- return (4 + ETHER_HDRLEN);
+ return (4 + ether_print(ndo, p + 4, h->len - 4, h->caplen - 4, NULL, NULL));
}
/*
}
/* Skip the pseudo-header, preamble, and SOF. */
- ether_print(ndo, p + 12, h->len - 12, h->caplen - 12, NULL, NULL);
-
- return (12 + ETHER_HDRLEN);
+ return (12 + ether_print(ndo, p + 12, h->len - 12, h->caplen - 12, NULL, NULL));
}
/*
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
srcname = etheraddr_string(ndo, fsrc);
dstname = etheraddr_string(ndo, fdst);
- if (ndo->ndo_vflag)
- ND_PRINT((ndo, "%02x %s %s %d: ",
- fddip->fddi_fc,
- srcname, dstname,
- length));
- else if (ndo->ndo_qflag)
- ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length));
- else {
+ if (!ndo->ndo_qflag)
print_fddi_fc(ndo, fddip->fddi_fc);
- ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length));
- }
+ ND_PRINT((ndo, "%s > %s, length %u: ",
+ srcname, dstname,
+ length));
}
static inline void
ND_PRINT((ndo, "<SMT printer not yet implemented>"));
}
-void
+u_int
fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
const struct fddi_header *fddip = (const struct fddi_header *)p;
struct ether_header ehdr;
- u_short extracted_ethertype;
+ int llc_hdrlen;
if (caplen < FDDI_HDRLEN) {
ND_PRINT((ndo, "[|fddi]"));
- return;
+ return (caplen);
}
/*
/* Frame Control field determines interpretation of packet */
if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_LLC_ASYNC) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
- &extracted_ethertype) == 0) {
+ llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr));
+ if (llc_hdrlen < 0) {
/*
* Some kinds of LLC packet we cannot
* handle intelligently
*/
- if (!ndo->ndo_eflag)
- fddi_hdr_print(ndo, fddip, length + FDDI_HDRLEN,
- ESRC(&ehdr), EDST(&ehdr));
- if (extracted_ethertype) {
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(htons(extracted_ethertype))));
- }
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
- } else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT)
+ } else if ((fddip->fddi_fc & FDDIFC_CLFF) == FDDIFC_SMT) {
fddi_smt_print(ndo, p, caplen);
- else {
+ llc_hdrlen = 0;
+ } else {
/* Some kinds of FDDI packet we cannot handle intelligently */
if (!ndo->ndo_eflag)
fddi_hdr_print(ndo, fddip, length + FDDI_HDRLEN, ESRC(&ehdr),
EDST(&ehdr));
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = 0;
}
+ return (FDDI_HDRLEN + llc_hdrlen);
}
/*
u_int
fddi_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p)
{
- fddi_print(ndo, p, h->len, h->caplen);
-
- return (FDDI_HDRLEN);
+ return (fddi_print(ndo, p, h->len, h->caplen));
}
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
{0, NULL}
};
+/* this is defined in RFC5810 section A.2 */
+/* http://www.iana.org/assignments/forces/forces.xhtml#oper-tlv-types */
enum {
- F_OP_RSV,
- F_OP_SET,
- F_OP_SETPROP,
- F_OP_SETRESP,
- F_OP_SETPRESP,
- F_OP_DEL,
- F_OP_DELRESP,
- F_OP_GET,
- F_OP_GETPROP,
- F_OP_GETRESP,
- F_OP_GETPRESP,
- F_OP_REPORT,
- F_OP_COMMIT,
- F_OP_RCOMMIT,
- F_OP_RTRCOMP,
+ F_OP_RSV = 0,
+ F_OP_SET = 1,
+ F_OP_SETPROP = 2,
+ F_OP_SETRESP = 3,
+ F_OP_SETPRESP = 4,
+ F_OP_DEL = 5,
+ F_OP_DELRESP = 6,
+ F_OP_GET = 7,
+ F_OP_GETPROP = 8,
+ F_OP_GETRESP = 9,
+ F_OP_GETPRESP = 10,
+ F_OP_REPORT = 11,
+ F_OP_COMMIT = 12,
+ F_OP_RCOMMIT = 13,
+ F_OP_RTRCOMP = 14,
_F_OP_MAX
};
-
#define F_OP_MAX (_F_OP_MAX - 1)
+
enum {
B_OP_SET = 1 << (F_OP_SET - 1),
B_OP_SETPROP = 1 << (F_OP_SETPROP - 1),
}
/* XXX - do anything with ops->flags? */
- rc = ops->print(ndo, dp, tll, ops->op_msk, indent + 1);
+ if(ops->print) {
+ rc = ops->print(ndo, dp, tll, ops->op_msk, indent + 1);
+ }
return rc;
trunc:
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
break;
case NLPID_SNAP:
- if (snap_print(ndo, p, length, length, 0) == 0) {
+ if (snap_print(ndo, p, length, length, NULL, NULL, 0) == 0) {
/* ether_type not known, print raw packet */
if (!ndo->ndo_eflag)
fr_hdr_print(ndo, length + hdr_len, hdr_len,
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* RFC1701 (GRE), RFC1702 (GRE IPv4), and RFC2637 (Enhanced GRE)
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* Cisco Hot Standby Router Protocol (HSRP). */
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/*
* XXX - show the upper 16 bits? Do so only if "vflag" is set?
*/
- ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length));
+ ND_PRINT((ndo, "%s > %s, length %u: ", srcname, dstname, length));
}
-static void
+static u_int
ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
const struct ipfc_header *ipfcp = (const struct ipfc_header *)p;
struct ether_header ehdr;
- u_short extracted_ethertype;
+ int llc_hdrlen;
if (caplen < IPFC_HDRLEN) {
ND_PRINT((ndo, "[|ipfc]"));
- return;
+ return (caplen);
}
/*
* Get the network addresses into a canonical form
caplen -= IPFC_HDRLEN;
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
- &extracted_ethertype) == 0) {
+ llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr));
+ if (llc_hdrlen < 0) {
/*
* Some kinds of LLC packet we cannot
* handle intelligently
*/
- if (!ndo->ndo_eflag)
- ipfc_hdr_print(ndo, ipfcp, length + IPFC_HDRLEN,
- ESRC(&ehdr), EDST(&ehdr));
- if (extracted_ethertype) {
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(htons(extracted_ethertype))));
- }
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
+ return (IPFC_HDRLEN + llc_hdrlen);
}
/*
u_int
ipfc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p)
{
- ipfc_print(ndo, p, h->len, h->caplen);
-
- return (IPFC_HDRLEN);
+ return (ipfc_print(ndo, p, h->len, h->caplen));
}
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* complete IS-IS & CLNP support.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
{
uint16_t calculated_checksum;
- /* do not attempt to verify the checksum if it is zero */
- if (!checksum) {
- ND_PRINT((ndo, "(unverified)"));
+ /* do not attempt to verify the checksum if it is zero,
+ * if the total length is nonsense,
+ * if the offset is nonsense,
+ * or the base pointer is not sane
+ */
+ if (!checksum
+ || length > ndo->ndo_snaplen
+ || checksum_offset > ndo->ndo_snaplen
+ || checksum_offset > length) {
+ ND_PRINT((ndo, " (unverified)"));
} else {
+ const char *truncated = "trunc";
+#if 0
+ printf("\nosi_print_cksum: %p %u %u %u\n", pptr, checksum_offset, length, ndo->ndo_snaplen);
+ ND_TCHECK2(pptr, checksum_offset+length);
+#endif
calculated_checksum = create_osi_cksum(pptr, checksum_offset, length);
if (checksum == calculated_checksum) {
ND_PRINT((ndo, " (correct)"));
} else {
- ND_PRINT((ndo, " (incorrect should be 0x%04x)", calculated_checksum));
+ truncated = "incorrect";
+#if 0
+ trunc:
+#endif
+ ND_PRINT((ndo, " (%s should be 0x%04x)", truncated, calculated_checksum));
}
}
}
__RCSID("NetBSD: print-juniper.c,v 1.3 2007/07/25 06:31:32 dogcow Exp ");
#endif
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
juniper_atm1_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
- uint16_t extracted_ethertype;
+ int llc_hdrlen;
struct juniper_l2info_t l2info;
if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
- if (llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL,
- &extracted_ethertype) != 0)
+ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
+ if (llc_hdrlen > 0)
return l2info.header_len;
}
juniper_atm2_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, register const u_char *p)
{
- uint16_t extracted_ethertype;
+ int llc_hdrlen;
struct juniper_l2info_t l2info;
if (EXTRACT_24BITS(p) == 0xfefe03 || /* NLPID encaps ? */
EXTRACT_24BITS(p) == 0xaaaa03) { /* SNAP encaps ? */
- if (llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL,
- &extracted_ethertype) != 0)
+ llc_hdrlen = llc_print(ndo, p, l2info.length, l2info.caplen, NULL, NULL);
+ if (llc_hdrlen > 0)
return l2info.header_len;
}
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* with an awful lot of hacking by Jeffrey Mogul, DECWRL
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
};
/*
- * Returns non-zero IFF it succeeds in printing the header
+ * If we printed information about the payload, returns the length of the LLC
+ * header, plus the length of any SNAP header following it.
+ *
+ * Otherwise (for example, if the packet has unknown SAPs or has a SNAP
+ * header with an unknown OUI/PID combination), returns the *negative*
+ * of that value.
*/
int
llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
- const u_char *esrc, const u_char *edst, u_short *extracted_ethertype)
+ const u_char *esrc, const u_char *edst)
{
uint8_t dsap_field, dsap, ssap_field, ssap;
uint16_t control;
+ u_int hdrlen;
int is_u;
- register int ret;
-
- *extracted_ethertype = 0;
- if (caplen < 3 || length < 3) {
+ if (caplen < 3) {
ND_PRINT((ndo, "[|llc]"));
ND_DEFAULTPRINT((u_char *)p, caplen);
- return (1);
+ return (caplen);
+ }
+ if (length < 3) {
+ ND_PRINT((ndo, "[|llc]"));
+ ND_DEFAULTPRINT((u_char *)p, caplen);
+ return (length);
}
dsap_field = *p;
* U frame.
*/
is_u = 1;
+ hdrlen = 3; /* DSAP, SSAP, 1-byte control field */
} else {
/*
* The control field in I and S frames is
* 2 bytes...
*/
- if (caplen < 4 || length < 4) {
+ if (caplen < 4) {
ND_PRINT((ndo, "[|llc]"));
ND_DEFAULTPRINT((u_char *)p, caplen);
- return (1);
+ return (caplen);
+ }
+ if (length < 4) {
+ ND_PRINT((ndo, "[|llc]"));
+ ND_DEFAULTPRINT((u_char *)p, caplen);
+ return (length);
}
/*
*/
control = EXTRACT_LE_16BITS(p + 2);
is_u = 0;
+ hdrlen = 4; /* DSAP, SSAP, 2-byte control field */
}
if (ssap_field == LLCSAP_GLOBAL && dsap_field == LLCSAP_GLOBAL) {
ND_PRINT((ndo, "IPX 802.3: "));
ipx_print(ndo, p, length);
- return (1);
+ return (0); /* no LLC header */
}
dsap = dsap_field & ~LLC_IG;
}
}
+ /*
+ * Skip LLC header.
+ */
+ p += hdrlen;
+ length -= hdrlen;
+ caplen -= hdrlen;
+
+ if (ssap == LLCSAP_SNAP && dsap == LLCSAP_SNAP
+ && control == LLC_UI) {
+ /*
+ * XXX - what *is* the right bridge pad value here?
+ * Does anybody ever bridge one form of LAN traffic
+ * over a networking type that uses 802.2 LLC?
+ */
+ if (!snap_print(ndo, p, length, caplen, esrc, edst, 2)) {
+ /*
+ * Unknown packet type; tell our caller, by
+ * returning a negative value, so they
+ * can print the raw packet.
+ */
+ return (-(hdrlen + 5)); /* include LLC and SNAP header */
+ } else
+ return (hdrlen + 5); /* include LLC and SNAP header */
+ }
+
if (ssap == LLCSAP_8021D && dsap == LLCSAP_8021D &&
control == LLC_UI) {
- stp_print(ndo, p+3, length-3);
- return (1);
+ stp_print(ndo, p, length);
+ return (hdrlen);
}
if (ssap == LLCSAP_IP && dsap == LLCSAP_IP &&
control == LLC_UI) {
- if (caplen < 4 || length < 4) {
- ND_PRINT((ndo, "[|llc]"));
- ND_DEFAULTPRINT((u_char *)p, caplen);
- return (1);
- }
- ip_print(ndo, p+4, length-4);
- return (1);
+ /*
+ * This is an RFC 948-style IP packet, with
+ * an 802.3 header and an 802.2 LLC header
+ * with the source and destination SAPs being
+ * the IP SAP.
+ */
+ ip_print(ndo, p, length);
+ return (hdrlen);
}
if (ssap == LLCSAP_IPX && dsap == LLCSAP_IPX &&
* This is an Ethernet_802.2 IPX frame, with an 802.3
* header and an 802.2 LLC header with the source and
* destination SAPs being the IPX SAP.
- *
- * Skip DSAP, LSAP, and control field.
*/
if (ndo->ndo_eflag)
ND_PRINT((ndo, "IPX 802.2: "));
- ipx_print(ndo, p+3, length-3);
- return (1);
+ ipx_print(ndo, p, length);
+ return (hdrlen);
}
#ifdef TCPDUMP_DO_SMB
* LLC_S_FMT, set in the first byte of the control field)
* and UI frames (whose control field is just 3, LLC_U_FMT).
*/
-
- /*
- * Skip the LLC header.
- */
- if (is_u) {
- p += 3;
- length -= 3;
- } else {
- p += 4;
- length -= 4;
- }
netbeui_print(ndo, control, p, length);
- return (1);
+ return (hdrlen);
}
#endif
if (ssap == LLCSAP_ISONS && dsap == LLCSAP_ISONS
&& control == LLC_UI) {
- isoclns_print(ndo, p + 3, length - 3, caplen - 3);
- return (1);
- }
-
- if (ssap == LLCSAP_SNAP && dsap == LLCSAP_SNAP
- && control == LLC_UI) {
- /*
- * XXX - what *is* the right bridge pad value here?
- * Does anybody ever bridge one form of LAN traffic
- * over a networking type that uses 802.2 LLC?
- */
- ret = snap_print(ndo, p+3, length-3, caplen-3, 2);
- if (ret)
- return (ret);
+ isoclns_print(ndo, p, length, caplen);
+ return (hdrlen);
}
if (!ndo->ndo_eflag) {
ND_PRINT((ndo, "Unnumbered, %s, Flags [%s], length %u",
tok2str(llc_cmd_values, "%02x", LLC_U_CMD(control)),
tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_U_POLL)),
- length));
-
- p += 3;
+ length + hdrlen));
if ((control & ~LLC_U_POLL) == LLC_XID) {
if (*p == LLC_XID_FI) {
ND_PRINT((ndo, ": %02x %02x", p[1], p[2]));
+ return (hdrlen);
}
}
} else {
tok2str(llc_supervisory_values,"?",LLC_S_CMD(control)),
LLC_IS_NR(control),
tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_IS_POLL)),
- length));
+ length + hdrlen));
+ return (hdrlen); /* no payload to print */
} else {
ND_PRINT((ndo, "Information, send seq %u, rcv seq %u, Flags [%s], length %u",
LLC_I_NS(control),
LLC_IS_NR(control),
tok2str(llc_flag_values,"?",(ssap_field & LLC_GSAP) | (control & LLC_IS_POLL)),
- length));
+ length + hdrlen));
+ }
+ }
+ return (-hdrlen);
+}
+
+static const struct tok *
+oui_to_struct_tok(uint32_t orgcode)
+{
+ const struct tok *tok = null_values;
+ const struct oui_tok *otp;
+
+ for (otp = &oui_to_tok[0]; otp->tok != NULL; otp++) {
+ if (otp->oui == orgcode) {
+ tok = otp->tok;
+ break;
}
}
- return(1);
+ return (tok);
}
int
-snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, u_int bridge_pad)
+snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
+ const u_char *esrc, const u_char *edst, u_int bridge_pad)
{
uint32_t orgcode;
register u_short et;
et = EXTRACT_16BITS(p + 3);
if (ndo->ndo_eflag) {
- const struct tok *tok = null_values;
- const struct oui_tok *otp;
-
- for (otp = &oui_to_tok[0]; otp->tok != NULL; otp++) {
- if (otp->oui == orgcode) {
- tok = otp->tok;
- break;
- }
- }
- ND_PRINT((ndo, "oui %s (0x%06x), %s %s (0x%04x): ",
+ /*
+ * Somebody's already printed the MAC addresses, if there
+ * are any, so just print the SNAP header, not the MAC
+ * addresses.
+ */
+ ND_PRINT((ndo, "oui %s (0x%06x), %s %s (0x%04x), length %u: ",
tok2str(oui_values, "Unknown", orgcode),
orgcode,
(orgcode == 0x000000 ? "ethertype" : "pid"),
- tok2str(tok, "Unknown", et),
- et));
+ tok2str(oui_to_struct_tok(orgcode), "Unknown", et),
+ et, length - 5));
}
p += 5;
length -= 5;
return (1);
}
}
+ if (!ndo->ndo_eflag) {
+ /*
+ * Nobody printed the MAC addresses, so print them, if
+ * we have any.
+ */
+ if (esrc != NULL && edst != NULL) {
+ ND_PRINT((ndo, "%s > %s ",
+ etheraddr_string(ndo, esrc),
+ etheraddr_string(ndo, edst)));
+ }
+ /*
+ * Print the SNAP header, but if the OUI is 000000, don't
+ * bother printing it, and report the PID as being an
+ * ethertype.
+ */
+ if (orgcode == 0x000000) {
+ ND_PRINT((ndo, "SNAP, ethertype %s (0x%04x), length %u: ",
+ tok2str(ethertype_values, "Unknown", et),
+ et, length));
+ } else {
+ ND_PRINT((ndo, "SNAP, oui %s (0x%06x), pid %s (0x%04x), length %u: ",
+ tok2str(oui_values, "Unknown", orgcode),
+ orgcode,
+ tok2str(oui_to_struct_tok(orgcode), "Unknown", et),
+ et, length));
+ }
+ }
return (0);
trunc:
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define IP6M_BINDING_UPDATE 5 /* Binding Update */
#define IP6M_BINDING_ACK 6 /* Binding Acknowledgement */
#define IP6M_BINDING_ERROR 7 /* Binding Error */
+#define IP6M_MAX 7
-/* XXX: unused */
-#define IP6MOPT_BU_MINLEN 10
-#define IP6MOPT_BA_MINLEN 13
-#define IP6MOPT_BR_MINLEN 2
+static const struct tok ip6m_str[] = {
+ { IP6M_BINDING_REQUEST, "BRR" },
+ { IP6M_HOME_TEST_INIT, "HoTI" },
+ { IP6M_CAREOF_TEST_INIT, "CoTI" },
+ { IP6M_HOME_TEST, "HoT" },
+ { IP6M_CAREOF_TEST, "CoT" },
+ { IP6M_BINDING_UPDATE, "BU" },
+ { IP6M_BINDING_ACK, "BA" },
+ { IP6M_BINDING_ERROR, "BE" },
+ { 0, NULL }
+};
+
+static const unsigned ip6m_hdrlen[IP6M_MAX + 1] = {
+ IP6M_MINLEN, /* IP6M_BINDING_REQUEST */
+ IP6M_MINLEN + 8, /* IP6M_HOME_TEST_INIT */
+ IP6M_MINLEN + 8, /* IP6M_CAREOF_TEST_INIT */
+ IP6M_MINLEN + 16, /* IP6M_HOME_TEST */
+ IP6M_MINLEN + 16, /* IP6M_CAREOF_TEST */
+ IP6M_MINLEN + 4, /* IP6M_BINDING_UPDATE */
+ IP6M_MINLEN + 4, /* IP6M_BINDING_ACK */
+ IP6M_MINLEN + 16, /* IP6M_BINDING_ERROR */
+};
/* Mobility Header Options */
#define IP6MOPT_MINLEN 2
unsigned i, optlen;
for (i = 0; i < len; i += optlen) {
+ ND_TCHECK(bp[i]);
if (bp[i] == IP6MOPT_PAD1)
optlen = 1;
else {
- if (i + 1 < len)
+ if (i + 1 < len) {
+ ND_TCHECK(bp[i + 1]);
optlen = bp[i + 1] + 2;
+ }
else
goto trunc;
}
if (i + optlen > len)
goto trunc;
+ ND_TCHECK(bp[i + optlen]);
switch (bp[i]) {
case IP6MOPT_PAD1:
ND_TCHECK(mh->ip6m_type);
type = mh->ip6m_type;
+ if (type <= IP6M_MAX && mhlen < ip6m_hdrlen[type]) {
+ ND_PRINT((ndo, "(header length %u is too small for type %u)", mhlen, type));
+ goto trunc;
+ }
+ ND_PRINT((ndo, "mobility: %s", tok2str(ip6m_str, "type-#%u", type)));
switch (type) {
case IP6M_BINDING_REQUEST:
- ND_PRINT((ndo, "mobility: BRR"));
hlen = IP6M_MINLEN;
break;
case IP6M_HOME_TEST_INIT:
case IP6M_CAREOF_TEST_INIT:
- ND_PRINT((ndo, "mobility: %soTI",
- type == IP6M_HOME_TEST_INIT ? "H" : "C"));
hlen = IP6M_MINLEN;
if (ndo->ndo_vflag) {
ND_TCHECK2(*mh, hlen + 8);
break;
case IP6M_HOME_TEST:
case IP6M_CAREOF_TEST:
- ND_PRINT((ndo, "mobility: %soT",
- type == IP6M_HOME_TEST ? "H" : "C"));
ND_TCHECK(mh->ip6m_data16[0]);
ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_16BITS(&mh->ip6m_data16[0])));
hlen = IP6M_MINLEN;
hlen += 8;
break;
case IP6M_BINDING_UPDATE:
- ND_PRINT((ndo, "mobility: BU"));
ND_TCHECK(mh->ip6m_data16[0]);
ND_PRINT((ndo, " seq#=%u", EXTRACT_16BITS(&mh->ip6m_data16[0])));
hlen = IP6M_MINLEN;
hlen += 2;
break;
case IP6M_BINDING_ACK:
- ND_PRINT((ndo, "mobility: BA"));
ND_TCHECK(mh->ip6m_data8[0]);
ND_PRINT((ndo, " status=%u", mh->ip6m_data8[0]));
if (mh->ip6m_data8[1] & 0x80)
hlen += 2;
break;
case IP6M_BINDING_ERROR:
- ND_PRINT((ndo, "mobility: BE"));
ND_TCHECK(mh->ip6m_data8[0]);
ND_PRINT((ndo, " status=%u", mh->ip6m_data8[0]));
/* Reserved */
hlen += 16;
break;
default:
- ND_PRINT((ndo, "mobility: type-#%u len=%u", type, mh->ip6m_len));
+ ND_PRINT((ndo, " len=%u", mh->ip6m_len));
return(mhlen);
break;
}
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* loosely based on print-bootp.c
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* IPv6 additions by Florian Forster <octo at verplant.org>
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* Original code by Francesco Fondelli (francesco dot fondelli, gmail dot com)
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
case PKT_REC_PACKET:
if ((printer = lookup_printer(dlt)) != NULL) {
- printer(ndo, h, p);
+ hdrlen += printer(ndo, h, p);
} else {
if (!ndo->ndo_eflag)
pktap_header_print(ndo, (u_char *)hdr,
/*
* Oracle
*/
-#define NETDISSECT_REWORKED
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
ND_PRINT((ndo, ", length %u: ", length));
}
-static void
+static u_int
ppi_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
u_int length = h->len;
uint16_t len;
uint32_t dlt;
+ uint32_t hdrlen;
if (caplen < sizeof(ppi_header_t)) {
ND_PRINT((ndo, "[|ppi]"));
- return;
+ return (caplen);
}
hdr = (ppi_header_t *)p;
len = EXTRACT_LE_16BITS(&hdr->ppi_len);
- if (len < sizeof(ppi_header_t)) {
+ if (caplen < len) {
+ /*
+ * If we don't have the entire PPI header, don't
+ * bother.
+ */
ND_PRINT((ndo, "[|ppi]"));
- return;
+ return (caplen);
}
- if (caplen < len) {
+ if (len < sizeof(ppi_header_t)) {
ND_PRINT((ndo, "[|ppi]"));
- return;
+ return (len);
}
dlt = EXTRACT_LE_32BITS(&hdr->ppi_dlt);
p += len;
if ((printer = lookup_printer(dlt)) != NULL) {
- printer(ndo, h, p);
+ hdrlen = printer(ndo, h, p);
} else {
if (!ndo->ndo_eflag)
ppi_header_print(ndo, (u_char *)hdr, length + len);
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ hdrlen = 0;
}
+ return (len + hdrlen);
}
/*
ppi_if_print(netdissect_options *ndo,
const struct pcap_pkthdr *h, const u_char *p)
{
- ppi_print(ndo, h, p);
-
- return (sizeof(ppi_header_t));
+ return (ppi_print(ndo, h, p));
}
/*
* o BAP support
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* TODO: Among other things to print ok MacIntosh and Vendor values
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
pdu_header = (rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
+ ND_TCHECK2(*tptr, pdu_len);
hexdump = FALSE;
ND_PRINT((ndo, "%sRPKI-RTRv%u, %s PDU (%u), length: %u",
{
rpki_rtr_pdu_error_report *pdu;
u_int encapsulated_pdu_length, text_length, tlen, error_code;
- u_char buf[80];
pdu = (rpki_rtr_pdu_error_report *)tptr;
encapsulated_pdu_length = EXTRACT_32BITS(pdu->encapsulated_pdu_length);
+ ND_TCHECK2(*tptr, encapsulated_pdu_length);
tlen = pdu_len;
error_code = EXTRACT_16BITS(pdu->pdu_header.u.error_code);
tptr += 4;
tlen -= 4;
}
+ ND_TCHECK2(*tptr, text_length);
if (text_length && (text_length <= tlen )) {
- memcpy(buf, tptr, min(sizeof(buf)-1, text_length));
- buf[text_length] = '\0';
- ND_PRINT((ndo, "%sError text: %s", indent_string(indent+2), buf));
+ ND_PRINT((ndo, "%sError text: ", indent_string(indent+2)));
+ fn_printn(ndo, tptr, text_length, ndo->ndo_snapend);
}
}
break;
if (ndo->ndo_vflag > 1 || (ndo->ndo_vflag && hexdump)) {
print_unknown_data(ndo,tptr,"\n\t ", pdu_len);
}
+ return;
+
+ trunc:
+ ND_PRINT((ndo, "|trunc"));
+ return;
}
void
pdu_header = (rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
+ ND_TCHECK2(*tptr, pdu_len);
/* infinite loop check */
if (!pdu_type || !pdu_len) {
break;
}
- ND_TCHECK2(*tptr, pdu_len);
if (tlen < pdu_len) {
goto trunc;
}
* and Realtek Echo Protocol (RRCP-REP) packets.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* Guy Harris.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
u_int length = h->len;
register const struct sll_header *sllp;
u_short ether_type;
- u_short extracted_ethertype;
+ int llc_hdrlen;
+ u_int hdrlen;
if (caplen < SLL_HDR_LEN) {
/*
length -= SLL_HDR_LEN;
caplen -= SLL_HDR_LEN;
p += SLL_HDR_LEN;
+ hdrlen = SLL_HDR_LEN;
ether_type = EXTRACT_16BITS(&sllp->sll_protocol);
* 802.2.
* Try to print the LLC-layer header & higher layers.
*/
- if (llc_print(ndo, p, length, caplen, NULL, NULL,
- &extracted_ethertype) == 0)
+ llc_hdrlen = llc_print(ndo, p, length, caplen, NULL, NULL);
+ if (llc_hdrlen < 0)
goto unknown; /* unknown LLC type */
+ hdrlen += llc_hdrlen;
break;
default:
- extracted_ethertype = 0;
/*FALLTHROUGH*/
unknown:
- /* ether_type not known, print raw packet */
- if (!ndo->ndo_eflag)
- sll_print(ndo, sllp, length + SLL_HDR_LEN);
- if (extracted_ethertype) {
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(htons(extracted_ethertype))));
- }
+ /* packet type not known, print raw packet */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
break;
* Print VLAN information, and then go back and process
* the enclosed type field.
*/
- if (caplen < 4 || length < 4) {
+ if (caplen < 4) {
+ ND_PRINT((ndo, "[|vlan]"));
+ return (hdrlen + caplen);
+ }
+ if (length < 4) {
ND_PRINT((ndo, "[|vlan]"));
- return (SLL_HDR_LEN);
+ return (hdrlen + length);
}
if (ndo->ndo_eflag) {
uint16_t tag = EXTRACT_16BITS(p);
p += 4;
length -= 4;
caplen -= 4;
+ hdrlen += 4;
goto recurse;
} else {
if (ethertype_print(ndo, ether_type, p, length, caplen) == 0) {
}
}
- return (SLL_HDR_LEN);
+ return (hdrlen);
}
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* or later
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
# @(#)snmp.awk.x 1.1 (LANL) 1/15/90
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
__RCSID("$NetBSD: print-tcp.c,v 1.8 2007/07/24 11:53:48 drochner Exp $");
#endif
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#endif
static void print_tcp_rst_data(netdissect_options *, register const u_char *sp, u_int length);
+static void print_tcp_fastopen_option(netdissect_options *ndo, register const u_char *cp,
+ u_int datalen, int exp);
#define MAX_RST_DATA_LEN 30
{ TCPOPT_AUTH, "enhanced auth" },
{ TCPOPT_UTO, "uto" },
{ TCPOPT_MPTCP, "mptcp" },
+ { TCPOPT_FASTOPEN, "tfo" },
{ TCPOPT_EXPERIMENT2, "exp" },
{ 0, NULL }
};
goto bad;
break;
+ case TCPOPT_FASTOPEN:
+ datalen = len - 2;
+ LENCHECK(datalen);
+ print_tcp_fastopen_option(ndo, cp, datalen, FALSE);
+ break;
+
case TCPOPT_EXPERIMENT2:
datalen = len - 2;
LENCHECK(datalen);
switch(magic) {
- case 0xf989:
- /* TCP Fast Open: RFC 7413 */
- if (datalen == 2) {
- /* Fast Open Cookie Request */
- ND_PRINT((ndo, "tfo cookiereq"));
- } else {
- /* Fast Open Cookie */
- if (datalen % 2 != 0 || datalen < 6 || datalen > 18) {
- ND_PRINT((ndo, "tfo malformed"));
- } else {
- ND_PRINT((ndo, "tfo cookie "));
- for (i = 2; i < datalen; ++i)
- ND_PRINT((ndo, "%02x", cp[i]));
- }
- }
+ case 0xf989: /* TCP Fast Open RFC 7413 */
+ print_tcp_fastopen_option(ndo, cp + 2, datalen - 2, TRUE);
break;
default:
ND_PRINT((ndo, "]"));
}
+static void
+print_tcp_fastopen_option(netdissect_options *ndo, register const u_char *cp,
+ u_int datalen, int exp)
+{
+ u_int i;
+
+ if (exp)
+ ND_PRINT((ndo, "tfo"));
+
+ if (datalen == 0) {
+ /* Fast Open Cookie Request */
+ ND_PRINT((ndo, " cookiereq"));
+ } else {
+ /* Fast Open Cookie */
+ if (datalen % 2 != 0 || datalen < 4 || datalen > 16) {
+ ND_PRINT((ndo, " malformed"));
+ } else {
+ ND_PRINT((ndo, " cookie "));
+ for (i = 0; i < datalen; ++i)
+ ND_PRINT((ndo, "%02x", cp[i]));
+ }
+ }
+}
+
#ifdef HAVE_LIBCRYPTO
USES_APPLE_DEPRECATED_API
static int
* are preserved in all copies.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* Format and print trivial file transfer protocol packets.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
srcname = etheraddr_string(ndo, fsrc);
dstname = etheraddr_string(ndo, fdst);
- if (ndo->ndo_vflag)
- ND_PRINT((ndo, "%02x %02x %s %s %d: ",
+ if (!ndo->ndo_qflag)
+ ND_PRINT((ndo, "%02x %02x ",
trp->token_ac,
- trp->token_fc,
- srcname, dstname,
- length));
- else
- ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length));
+ trp->token_fc));
+ ND_PRINT((ndo, "%s > %s, length %u: ",
+ srcname, dstname,
+ length));
}
static const char *broadcast_indicator[] = {
token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen)
{
const struct token_header *trp;
- u_short extracted_ethertype;
+ int llc_hdrlen;
struct ether_header ehdr;
u_int route_len = 0, hdr_len = TOKEN_HDRLEN;
int seg;
/* Frame Control field determines interpretation of packet */
if (FRAME_TYPE(trp) == TOKEN_FC_LLC) {
/* Try to print the LLC-layer header & higher layers */
- if (llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr),
- &extracted_ethertype) == 0) {
- /* ether_type not known, print raw packet */
- if (!ndo->ndo_eflag)
- token_hdr_print(ndo, trp,
- length + TOKEN_HDRLEN + route_len,
- ESRC(&ehdr), EDST(&ehdr));
- if (extracted_ethertype) {
- ND_PRINT((ndo, "(LLC %s) ",
- etherproto_string(htons(extracted_ethertype))));
- }
+ llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(&ehdr),
+ EDST(&ehdr));
+ if (llc_hdrlen < 0) {
+ /* packet type not known, print raw packet */
if (!ndo->ndo_suppress_default_print)
ND_DEFAULTPRINT(p, caplen);
+ llc_hdrlen = -llc_hdrlen;
}
+ hdr_len += llc_hdrlen;
} else {
/* Some kinds of TR packet we cannot handle intelligently */
/* XXX - dissect MAC packets if frame type is 0 */
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* Original code by Francesco Fondelli (francesco dot fondelli, gmail dot com)
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
len -= sizeof(*io) * nid;
io = (struct id_off *)(id + 1);
cp = (char *)(io + nid);
- if (!ND_TTEST2(cp, len)) {
+ if (ND_TTEST2(cp, len)) {
ND_PRINT((ndo, "\""));
fn_print(ndo, (u_char *)cp, (u_char *)cp + len);
ND_PRINT((ndo, "\""));
}
n = EXTRACT_32BITS(&prep->pp_n);
ps = (const struct pgstate *)(prep + 1);
- while (--n >= 0 && !ND_TTEST(*ps)) {
+ while (--n >= 0 && ND_TTEST(*ps)) {
const struct id_off *io, *ie;
char c = '<';
ipaddr_string(ndo, &ps->page.p_sid),
EXTRACT_32BITS(&ps->page.p_uid)));
io = (struct id_off *)(ps + 1);
- for (ie = io + ps->nid; io < ie && !ND_TTEST(*io); ++io) {
+ for (ie = io + ps->nid; io < ie && ND_TTEST(*io); ++io) {
ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id),
EXTRACT_32BITS(&io->off)));
c = ',';
* PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* POSSIBILITY OF SUCH DAMAGE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
--- /dev/null
+/*
+ * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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, (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, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * 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.
+ *
+ * Support for splitting captures into multiple files with a maximum
+ * file size:
+ *
+ * Copyright (c) 2001
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <tcpdump-stdinc.h>
+
+#include "netdissect.h"
+#include "interface.h"
+#include "addrtoname.h"
+#include "print.h"
+
+struct printer {
+ if_printer f;
+ int type;
+};
+
+static const struct printer printers[] = {
+ { ether_if_print, DLT_EN10MB },
+#ifdef DLT_IPNET
+ { ipnet_if_print, DLT_IPNET },
+#endif
+#ifdef DLT_IEEE802_15_4
+ { ieee802_15_4_if_print, DLT_IEEE802_15_4 },
+#endif
+#ifdef DLT_IEEE802_15_4_NOFCS
+ { ieee802_15_4_if_print, DLT_IEEE802_15_4_NOFCS },
+#endif
+#ifdef DLT_PPI
+ { ppi_if_print, DLT_PPI },
+#endif
+#ifdef DLT_NETANALYZER
+ { netanalyzer_if_print, DLT_NETANALYZER },
+#endif
+#ifdef DLT_NETANALYZER_TRANSPARENT
+ { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT },
+#endif
+#if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H)
+ { nflog_if_print, DLT_NFLOG},
+#endif
+#ifdef DLT_CIP
+ { cip_if_print, DLT_CIP },
+#endif
+#ifdef DLT_ATM_CLIP
+ { cip_if_print, DLT_ATM_CLIP },
+#endif
+#ifdef DLT_IP_OVER_FC
+ { ipfc_if_print, DLT_IP_OVER_FC },
+#endif
+ { null_if_print, DLT_NULL },
+#ifdef DLT_LOOP
+ { null_if_print, DLT_LOOP },
+#endif
+#ifdef DLT_APPLE_IP_OVER_IEEE1394
+ { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 },
+#endif
+#if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
+ { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
+#endif
+#ifdef DLT_LANE8023
+ { lane_if_print, DLT_LANE8023 },
+#endif
+ { arcnet_if_print, DLT_ARCNET },
+#ifdef DLT_ARCNET_LINUX
+ { arcnet_linux_if_print, DLT_ARCNET_LINUX },
+#endif
+ { raw_if_print, DLT_RAW },
+#ifdef DLT_IPV4
+ { raw_if_print, DLT_IPV4 },
+#endif
+#ifdef DLT_IPV6
+ { raw_if_print, DLT_IPV6 },
+#endif
+#ifdef HAVE_PCAP_USB_H
+#ifdef DLT_USB_LINUX
+ { usb_linux_48_byte_print, DLT_USB_LINUX},
+#endif /* DLT_USB_LINUX */
+#ifdef DLT_USB_LINUX_MMAPPED
+ { usb_linux_64_byte_print, DLT_USB_LINUX_MMAPPED},
+#endif /* DLT_USB_LINUX_MMAPPED */
+#endif /* HAVE_PCAP_USB_H */
+#ifdef DLT_SYMANTEC_FIREWALL
+ { symantec_if_print, DLT_SYMANTEC_FIREWALL },
+#endif
+#ifdef DLT_C_HDLC
+ { chdlc_if_print, DLT_C_HDLC },
+#endif
+#ifdef DLT_HDLC
+ { chdlc_if_print, DLT_HDLC },
+#endif
+#ifdef DLT_PPP_ETHER
+ { pppoe_if_print, DLT_PPP_ETHER },
+#endif
+#if defined(DLT_PFLOG) && defined(HAVE_NET_PFVAR_H)
+ { pflog_if_print, DLT_PFLOG },
+#endif
+ { token_if_print, DLT_IEEE802 },
+ { fddi_if_print, DLT_FDDI },
+#ifdef DLT_LINUX_SLL
+ { sll_if_print, DLT_LINUX_SLL },
+#endif
+#ifdef DLT_FR
+ { fr_if_print, DLT_FR },
+#endif
+#ifdef DLT_FRELAY
+ { fr_if_print, DLT_FRELAY },
+#endif
+#ifdef DLT_MFR
+ { mfr_if_print, DLT_MFR },
+#endif
+ { atm_if_print, DLT_ATM_RFC1483 },
+#ifdef DLT_SUNATM
+ { sunatm_if_print, DLT_SUNATM },
+#endif
+#ifdef DLT_ENC
+ { enc_if_print, DLT_ENC },
+#endif
+ { sl_if_print, DLT_SLIP },
+#ifdef DLT_SLIP_BSDOS
+ { sl_bsdos_if_print, DLT_SLIP_BSDOS },
+#endif
+#ifdef DLT_LTALK
+ { ltalk_if_print, DLT_LTALK },
+#endif
+#ifdef DLT_JUNIPER_ATM1
+ { juniper_atm1_print, DLT_JUNIPER_ATM1 },
+#endif
+#ifdef DLT_JUNIPER_ATM2
+ { juniper_atm2_print, DLT_JUNIPER_ATM2 },
+#endif
+#ifdef DLT_JUNIPER_MFR
+ { juniper_mfr_print, DLT_JUNIPER_MFR },
+#endif
+#ifdef DLT_JUNIPER_MLFR
+ { juniper_mlfr_print, DLT_JUNIPER_MLFR },
+#endif
+#ifdef DLT_JUNIPER_MLPPP
+ { juniper_mlppp_print, DLT_JUNIPER_MLPPP },
+#endif
+#ifdef DLT_JUNIPER_PPPOE
+ { juniper_pppoe_print, DLT_JUNIPER_PPPOE },
+#endif
+#ifdef DLT_JUNIPER_PPPOE_ATM
+ { juniper_pppoe_atm_print, DLT_JUNIPER_PPPOE_ATM },
+#endif
+#ifdef DLT_JUNIPER_GGSN
+ { juniper_ggsn_print, DLT_JUNIPER_GGSN },
+#endif
+#ifdef DLT_JUNIPER_ES
+ { juniper_es_print, DLT_JUNIPER_ES },
+#endif
+#ifdef DLT_JUNIPER_MONITOR
+ { juniper_monitor_print, DLT_JUNIPER_MONITOR },
+#endif
+#ifdef DLT_JUNIPER_SERVICES
+ { juniper_services_print, DLT_JUNIPER_SERVICES },
+#endif
+#ifdef DLT_JUNIPER_ETHER
+ { juniper_ether_print, DLT_JUNIPER_ETHER },
+#endif
+#ifdef DLT_JUNIPER_PPP
+ { juniper_ppp_print, DLT_JUNIPER_PPP },
+#endif
+#ifdef DLT_JUNIPER_FRELAY
+ { juniper_frelay_print, DLT_JUNIPER_FRELAY },
+#endif
+#ifdef DLT_JUNIPER_CHDLC
+ { juniper_chdlc_print, DLT_JUNIPER_CHDLC },
+#endif
+#ifdef DLT_PKTAP
+ { pktap_if_print, DLT_PKTAP },
+#endif
+#ifdef DLT_IEEE802_11_RADIO
+ { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO },
+#endif
+#ifdef DLT_IEEE802_11
+ { ieee802_11_if_print, DLT_IEEE802_11},
+#endif
+#ifdef DLT_IEEE802_11_RADIO_AVS
+ { ieee802_11_radio_avs_if_print, DLT_IEEE802_11_RADIO_AVS },
+#endif
+#ifdef DLT_PRISM_HEADER
+ { prism_if_print, DLT_PRISM_HEADER },
+#endif
+ { ppp_if_print, DLT_PPP },
+#ifdef DLT_PPP_WITHDIRECTION
+ { ppp_if_print, DLT_PPP_WITHDIRECTION },
+#endif
+#ifdef DLT_PPP_BSDOS
+ { ppp_bsdos_if_print, DLT_PPP_BSDOS },
+#endif
+#ifdef DLT_PPP_SERIAL
+ { ppp_hdlc_if_print, DLT_PPP_SERIAL },
+#endif
+ { NULL, 0 },
+};
+
+
+static void ndo_default_print(netdissect_options *ndo, const u_char *bp,
+ u_int length);
+
+static void ndo_error(netdissect_options *ndo _U_, const char *fmt, ...)
+ __attribute__((noreturn))
+#ifdef __ATTRIBUTE___FORMAT_OK
+ __attribute__((format (printf, 2, 3)))
+#endif /* __ATTRIBUTE___FORMAT_OK */
+ ;
+static void ndo_warning(netdissect_options *ndo _U_, const char *fmt, ...)
+#ifdef __ATTRIBUTE___FORMAT_OK
+ __attribute__((format (printf, 2, 3)))
+#endif /* __ATTRIBUTE___FORMAT_OK */
+ ;
+
+static int tcpdump_printf(netdissect_options *ndo _U_, const char *fmt, ...)
+#ifdef __ATTRIBUTE___FORMAT_OK
+ __attribute ((format (printf, 2, 3)))
+#endif /* __ATTRIBUTE___FORMAT_OK */
+ ;
+
+void
+init_print(u_int32_t localnet, u_int32_t mask, uint32_t timezone_offset)
+{
+
+ thiszone = timezone_offset;
+ init_addrtoname(gndo, localnet, mask);
+ init_checksum();
+}
+
+if_printer
+lookup_printer(int type)
+{
+ const struct printer *p;
+
+ for (p = printers; p->f; ++p)
+ if (type == p->type)
+ return p->f;
+
+#if defined(DLT_USER2) && defined(DLT_PKTAP)
+ /*
+ * Apple incorrectly chose to use DLT_USER2 for their PKTAP
+ * header.
+ *
+ * We map DLT_PKTAP, whether it's DLT_USER2 as it is on Darwin-
+ * based OSes or the same value as LINKTYPE_PKTAP as it is on
+ * other OSes, to LINKTYPE_PKTAP, so files written with
+ * this version of libpcap for a DLT_PKTAP capture have a link-
+ * layer header type of LINKTYPE_PKTAP.
+ *
+ * However, files written on OS X Mavericks for a DLT_PKTAP
+ * capture have a link-layer header type of LINKTYPE_USER2.
+ * If we don't have a printer for DLT_USER2, and type is
+ * DLT_USER2, we look up the printer for DLT_PKTAP and use
+ * that.
+ */
+ if (type == DLT_USER2) {
+ for (p = printers; p->f; ++p)
+ if (DLT_PKTAP == p->type)
+ return p->f;
+ }
+#endif
+
+ return NULL;
+ /* NOTREACHED */
+}
+
+int
+has_printer(int type)
+{
+
+ return (lookup_printer(type) != NULL);
+}
+
+struct print_info
+get_print_info(int type)
+{
+ struct print_info printinfo;
+
+ printinfo.ndo = gndo;
+ printinfo.printer = lookup_printer(type);
+ if (printinfo.printer == NULL) {
+ gndo->ndo_dltname = pcap_datalink_val_to_name(type);
+ if (gndo->ndo_dltname != NULL)
+ error("packet printing is not supported for link type %s: use -w",
+ gndo->ndo_dltname);
+ else
+ error("packet printing is not supported for link type %d: use -w", type);
+ }
+ return (printinfo);
+}
+
+void
+pretty_print_packet(struct print_info *print_info, const struct pcap_pkthdr *h,
+ const u_char *sp, u_int packets_captured)
+{
+ u_int hdrlen;
+ netdissect_options *ndo;
+
+ ndo = print_info->ndo;
+
+ if(ndo->ndo_packet_number)
+ ND_PRINT((ndo, "%5u ", packets_captured));
+
+ ts_print(ndo, &h->ts);
+
+ /*
+ * Some printers want to check that they're not walking off the
+ * end of the packet.
+ * Rather than pass it all the way down, we set this member
+ * of the netdissect_options structure.
+ */
+ ndo->ndo_snapend = sp + h->caplen;
+
+ hdrlen = (*print_info->printer)(print_info->ndo, h, sp);
+
+ /*
+ * Restore the original snapend, as a printer might have
+ * changed it.
+ */
+ ndo->ndo_snapend = sp + h->caplen;
+ if (ndo->ndo_Xflag) {
+ /*
+ * Print the raw packet data in hex and ASCII.
+ */
+ if (ndo->ndo_Xflag > 1) {
+ /*
+ * Include the link-layer header.
+ */
+ hex_and_ascii_print(ndo, "\n\t", sp, h->caplen);
+ } else {
+ /*
+ * Don't include the link-layer header - and if
+ * we have nothing past the link-layer header,
+ * print nothing.
+ */
+ if (h->caplen > hdrlen)
+ hex_and_ascii_print(ndo, "\n\t", sp + hdrlen,
+ h->caplen - hdrlen);
+ }
+ } else if (ndo->ndo_xflag) {
+ /*
+ * Print the raw packet data in hex.
+ */
+ if (ndo->ndo_xflag > 1) {
+ /*
+ * Include the link-layer header.
+ */
+ hex_print(ndo, "\n\t", sp, h->caplen);
+ } else {
+ /*
+ * Don't include the link-layer header - and if
+ * we have nothing past the link-layer header,
+ * print nothing.
+ */
+ if (h->caplen > hdrlen)
+ hex_print(ndo, "\n\t", sp + hdrlen,
+ h->caplen - hdrlen);
+ }
+ } else if (ndo->ndo_Aflag) {
+ /*
+ * Print the raw packet data in ASCII.
+ */
+ if (ndo->ndo_Aflag > 1) {
+ /*
+ * Include the link-layer header.
+ */
+ ascii_print(ndo, sp, h->caplen);
+ } else {
+ /*
+ * Don't include the link-layer header - and if
+ * we have nothing past the link-layer header,
+ * print nothing.
+ */
+ if (h->caplen > hdrlen)
+ ascii_print(ndo, sp + hdrlen, h->caplen - hdrlen);
+ }
+ }
+
+ putchar('\n');
+}
+
+/*
+ * By default, print the specified data out in hex and ASCII.
+ */
+static void
+ndo_default_print(netdissect_options *ndo, const u_char *bp, u_int length)
+{
+ hex_and_ascii_print(ndo, "\n\t", bp, length); /* pass on lf and indentation string */
+}
+
+/* VARARGS */
+static void
+ndo_error(netdissect_options *ndo _U_, const char *fmt, ...)
+{
+ va_list ap;
+
+ (void)fprintf(stderr, "%s: ", program_name);
+ va_start(ap, fmt);
+ (void)vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ if (*fmt) {
+ fmt += strlen(fmt);
+ if (fmt[-1] != '\n')
+ (void)fputc('\n', stderr);
+ }
+ exit(1);
+ /* NOTREACHED */
+}
+
+/* VARARGS */
+static void
+ndo_warning(netdissect_options *ndo _U_, const char *fmt, ...)
+{
+ va_list ap;
+
+ (void)fprintf(stderr, "%s: WARNING: ", program_name);
+ va_start(ap, fmt);
+ (void)vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ if (*fmt) {
+ fmt += strlen(fmt);
+ if (fmt[-1] != '\n')
+ (void)fputc('\n', stderr);
+ }
+}
+
+static int
+tcpdump_printf(netdissect_options *ndo _U_, const char *fmt, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start(args, fmt);
+ ret = vfprintf(stdout, fmt, args);
+ va_end(args);
+
+ return (ret);
+}
+
+void
+ndo_set_function_pointers(netdissect_options *ndo)
+{
+
+ ndo->ndo_default_print=ndo_default_print;
+ ndo->ndo_printf=tcpdump_printf;
+ ndo->ndo_error=ndo_error;
+ ndo->ndo_warning=ndo_warning;
+}
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */
--- /dev/null
+/*
+ * Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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, (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, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * 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.
+ *
+ * Support for splitting captures into multiple files with a maximum
+ * file size:
+ *
+ * Copyright (c) 2001
+ */
+
+#ifndef print_h
+#define print_h
+
+struct print_info {
+ netdissect_options *ndo;
+ if_printer printer;
+};
+
+void init_print(u_int32_t localnet, u_int32_t mask,
+ uint32_t timezone_offset);
+
+int has_printer(int type);
+
+struct print_info get_print_info(int type);
+
+void pretty_print_packet(struct print_info *print_info,
+ const struct pcap_pkthdr *h, const u_char *sp,
+ u_int packets_captured);
+
+void ndo_set_function_pointers(netdissect_options *ndo);
+
+#endif /* print_h */
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
* or later
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define TCPOPT_UTO 28 /* tcp user timeout (rfc5482) */
#define TCPOLEN_UTO 4
#define TCPOPT_MPTCP 30 /* MPTCP options */
+#define TCPOPT_FASTOPEN 34 /* TCP Fast Open (rfc7413) */
#define TCPOPT_EXPERIMENT2 254 /* experimental headers (rfc4727) */
#define TCPOPT_TSTAMP_HDR \
#include "gmt2local.h"
#include "pcap-missing.h"
+#include "print.h"
+
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
char *program_name;
-int32_t thiszone; /* seconds offset from gmt to local time */
-
/* Forwards */
static RETSIGTYPE cleanup(int);
static RETSIGTYPE child_cleanup(int);
static void show_dlts_and_exit(const char *device, pcap_t *pd) __attribute__((noreturn));
static void print_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
-static void ndo_default_print(netdissect_options *, const u_char *, u_int);
static void dump_packet_and_trunc(u_char *, const struct pcap_pkthdr *, const u_char *);
static void dump_packet(u_char *, const struct pcap_pkthdr *, const u_char *);
static void droproot(const char *, const char *);
-static void ndo_error(netdissect_options *ndo, const char *fmt, ...)
- __attribute__((noreturn))
-#ifdef __ATTRIBUTE___FORMAT_OK
- __attribute__((format (printf, 2, 3)))
-#endif /* __ATTRIBUTE___FORMAT_OK */
- ;
-static void ndo_warning(netdissect_options *ndo, const char *fmt, ...)
-#ifdef __ATTRIBUTE___FORMAT_OK
- __attribute__((format (printf, 2, 3)))
-#endif /* __ATTRIBUTE___FORMAT_OK */
- ;
#ifdef SIGNAL_REQ_INFO
RETSIGTYPE requestinfo(int);
static void info(int);
static u_int packets_captured;
-struct printer {
- if_printer f;
- int type;
-};
-
-
-static const struct printer printers[] = {
- { ether_if_print, DLT_EN10MB },
-#ifdef DLT_IPNET
- { ipnet_if_print, DLT_IPNET },
-#endif
-#ifdef DLT_IEEE802_15_4
- { ieee802_15_4_if_print, DLT_IEEE802_15_4 },
-#endif
-#ifdef DLT_IEEE802_15_4_NOFCS
- { ieee802_15_4_if_print, DLT_IEEE802_15_4_NOFCS },
-#endif
-#ifdef DLT_PPI
- { ppi_if_print, DLT_PPI },
-#endif
-#ifdef DLT_NETANALYZER
- { netanalyzer_if_print, DLT_NETANALYZER },
-#endif
-#ifdef DLT_NETANALYZER_TRANSPARENT
- { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT },
-#endif
-#if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H)
- { nflog_if_print, DLT_NFLOG},
-#endif
-#ifdef DLT_CIP
- { cip_if_print, DLT_CIP },
-#endif
-#ifdef DLT_ATM_CLIP
- { cip_if_print, DLT_ATM_CLIP },
-#endif
-#ifdef DLT_IP_OVER_FC
- { ipfc_if_print, DLT_IP_OVER_FC },
-#endif
- { null_if_print, DLT_NULL },
-#ifdef DLT_LOOP
- { null_if_print, DLT_LOOP },
-#endif
-#ifdef DLT_APPLE_IP_OVER_IEEE1394
- { ap1394_if_print, DLT_APPLE_IP_OVER_IEEE1394 },
-#endif
-#if defined(DLT_BLUETOOTH_HCI_H4_WITH_PHDR) && defined(HAVE_PCAP_BLUETOOTH_H)
- { bt_if_print, DLT_BLUETOOTH_HCI_H4_WITH_PHDR},
-#endif
-#ifdef DLT_LANE8023
- { lane_if_print, DLT_LANE8023 },
-#endif
- { arcnet_if_print, DLT_ARCNET },
-#ifdef DLT_ARCNET_LINUX
- { arcnet_linux_if_print, DLT_ARCNET_LINUX },
-#endif
- { raw_if_print, DLT_RAW },
-#ifdef DLT_IPV4
- { raw_if_print, DLT_IPV4 },
-#endif
-#ifdef DLT_IPV6
- { raw_if_print, DLT_IPV6 },
-#endif
-#ifdef HAVE_PCAP_USB_H
-#ifdef DLT_USB_LINUX
- { usb_linux_48_byte_print, DLT_USB_LINUX},
-#endif /* DLT_USB_LINUX */
-#ifdef DLT_USB_LINUX_MMAPPED
- { usb_linux_64_byte_print, DLT_USB_LINUX_MMAPPED},
-#endif /* DLT_USB_LINUX_MMAPPED */
-#endif /* HAVE_PCAP_USB_H */
-#ifdef DLT_SYMANTEC_FIREWALL
- { symantec_if_print, DLT_SYMANTEC_FIREWALL },
-#endif
-#ifdef DLT_C_HDLC
- { chdlc_if_print, DLT_C_HDLC },
-#endif
-#ifdef DLT_HDLC
- { chdlc_if_print, DLT_HDLC },
-#endif
-#ifdef DLT_PPP_ETHER
- { pppoe_if_print, DLT_PPP_ETHER },
-#endif
-#if defined(DLT_PFLOG) && defined(HAVE_NET_PFVAR_H)
- { pflog_if_print, DLT_PFLOG },
-#endif
- { token_if_print, DLT_IEEE802 },
- { fddi_if_print, DLT_FDDI },
-#ifdef DLT_LINUX_SLL
- { sll_if_print, DLT_LINUX_SLL },
-#endif
-#ifdef DLT_FR
- { fr_if_print, DLT_FR },
-#endif
-#ifdef DLT_FRELAY
- { fr_if_print, DLT_FRELAY },
-#endif
-#ifdef DLT_MFR
- { mfr_if_print, DLT_MFR },
-#endif
- { atm_if_print, DLT_ATM_RFC1483 },
-#ifdef DLT_SUNATM
- { sunatm_if_print, DLT_SUNATM },
-#endif
-#ifdef DLT_ENC
- { enc_if_print, DLT_ENC },
-#endif
- { sl_if_print, DLT_SLIP },
-#ifdef DLT_SLIP_BSDOS
- { sl_bsdos_if_print, DLT_SLIP_BSDOS },
-#endif
-#ifdef DLT_LTALK
- { ltalk_if_print, DLT_LTALK },
-#endif
-#ifdef DLT_JUNIPER_ATM1
- { juniper_atm1_print, DLT_JUNIPER_ATM1 },
-#endif
-#ifdef DLT_JUNIPER_ATM2
- { juniper_atm2_print, DLT_JUNIPER_ATM2 },
-#endif
-#ifdef DLT_JUNIPER_MFR
- { juniper_mfr_print, DLT_JUNIPER_MFR },
-#endif
-#ifdef DLT_JUNIPER_MLFR
- { juniper_mlfr_print, DLT_JUNIPER_MLFR },
-#endif
-#ifdef DLT_JUNIPER_MLPPP
- { juniper_mlppp_print, DLT_JUNIPER_MLPPP },
-#endif
-#ifdef DLT_JUNIPER_PPPOE
- { juniper_pppoe_print, DLT_JUNIPER_PPPOE },
-#endif
-#ifdef DLT_JUNIPER_PPPOE_ATM
- { juniper_pppoe_atm_print, DLT_JUNIPER_PPPOE_ATM },
-#endif
-#ifdef DLT_JUNIPER_GGSN
- { juniper_ggsn_print, DLT_JUNIPER_GGSN },
-#endif
-#ifdef DLT_JUNIPER_ES
- { juniper_es_print, DLT_JUNIPER_ES },
-#endif
-#ifdef DLT_JUNIPER_MONITOR
- { juniper_monitor_print, DLT_JUNIPER_MONITOR },
-#endif
-#ifdef DLT_JUNIPER_SERVICES
- { juniper_services_print, DLT_JUNIPER_SERVICES },
-#endif
-#ifdef DLT_JUNIPER_ETHER
- { juniper_ether_print, DLT_JUNIPER_ETHER },
-#endif
-#ifdef DLT_JUNIPER_PPP
- { juniper_ppp_print, DLT_JUNIPER_PPP },
-#endif
-#ifdef DLT_JUNIPER_FRELAY
- { juniper_frelay_print, DLT_JUNIPER_FRELAY },
-#endif
-#ifdef DLT_JUNIPER_CHDLC
- { juniper_chdlc_print, DLT_JUNIPER_CHDLC },
-#endif
-#ifdef DLT_PKTAP
- { pktap_if_print, DLT_PKTAP },
-#endif
-#ifdef DLT_IEEE802_11_RADIO
- { ieee802_11_radio_if_print, DLT_IEEE802_11_RADIO },
-#endif
-#ifdef DLT_IEEE802_11
- { ieee802_11_if_print, DLT_IEEE802_11},
-#endif
-#ifdef DLT_IEEE802_11_RADIO_AVS
- { ieee802_11_radio_avs_if_print, DLT_IEEE802_11_RADIO_AVS },
-#endif
-#ifdef DLT_PRISM_HEADER
- { prism_if_print, DLT_PRISM_HEADER },
-#endif
- { ppp_if_print, DLT_PPP },
-#ifdef DLT_PPP_WITHDIRECTION
- { ppp_if_print, DLT_PPP_WITHDIRECTION },
-#endif
-#ifdef DLT_PPP_BSDOS
- { ppp_bsdos_if_print, DLT_PPP_BSDOS },
-#endif
-#ifdef DLT_PPP_SERIAL
- { ppp_hdlc_if_print, DLT_PPP_SERIAL },
-#endif
- { NULL, 0 },
-};
-
static const struct tok status_flags[] = {
#ifdef PCAP_IF_UP
{ PCAP_IF_UP, "Up" },
{ 0, NULL }
};
-if_printer
-lookup_printer(int type)
-{
- const struct printer *p;
-
- for (p = printers; p->f; ++p)
- if (type == p->type)
- return p->f;
-
-#if defined(DLT_USER2) && defined(DLT_PKTAP)
- /*
- * Apple incorrectly chose to use DLT_USER2 for their PKTAP
- * header.
- *
- * We map DLT_PKTAP, whether it's DLT_USER2 as it is on Darwin-
- * based OSes or the same value as LINKTYPE_PKTAP as it is on
- * other OSes, to LINKTYPE_PKTAP, so files written with
- * this version of libpcap for a DLT_PKTAP capture have a link-
- * layer header type of LINKTYPE_PKTAP.
- *
- * However, files written on OS X Mavericks for a DLT_PKTAP
- * capture have a link-layer header type of LINKTYPE_USER2.
- * If we don't have a printer for DLT_USER2, and type is
- * DLT_USER2, we look up the printer for DLT_PKTAP and use
- * that.
- */
- if (type == DLT_USER2) {
- for (p = printers; p->f; ++p)
- if (DLT_PKTAP == p->type)
- return p->f;
- }
-#endif
-
- return NULL;
- /* NOTREACHED */
-}
-
static pcap_t *pd;
static int supports_monitor_mode;
extern int opterr;
extern char *optarg;
-struct print_info {
- netdissect_options *ndo;
- if_printer printer;
-};
-
struct dump_info {
char *WFileName;
char *CurrentFileName;
static void
show_dlts_and_exit(const char *device, pcap_t *pd)
{
- int n_dlts;
+ int n_dlts, i;
int *dlts = 0;
const char *dlt_name;
if (supports_monitor_mode)
(void) fprintf(stderr, "Data link types for %s %s (use option -y to set):\n",
device,
- Iflag ? "when in monitor mode" : "when not in monitor mode");
+ gndo->ndo_Iflag ? "when in monitor mode" : "when not in monitor mode");
else
(void) fprintf(stderr, "Data link types for %s (use option -y to set):\n",
device);
- while (--n_dlts >= 0) {
- dlt_name = pcap_datalink_val_to_name(dlts[n_dlts]);
+ for (i = 0; i < n_dlts; i++) {
+ dlt_name = pcap_datalink_val_to_name(dlts[i]);
if (dlt_name != NULL) {
(void) fprintf(stderr, " %s (%s)", dlt_name,
- pcap_datalink_val_to_description(dlts[n_dlts]));
+ pcap_datalink_val_to_description(dlts[i]));
/*
* OK, does tcpdump handle that type?
*/
- if (lookup_printer(dlts[n_dlts]) == NULL)
+ if (!has_printer(dlts[i]))
(void) fprintf(stderr, " (printing not supported)");
fprintf(stderr, "\n");
} else {
(void) fprintf(stderr, " DLT %d (printing not supported)\n",
- dlts[n_dlts]);
+ dlts[i]);
}
}
#ifdef HAVE_PCAP_FREE_DATALINKS
error("Makefilename: malloc");
/* Process with strftime if Gflag is set. */
- if (Gflag != 0) {
+ if (gndo->ndo_Gflag != 0) {
struct tm *local_tm;
/* Convert Gflag_time to a usable format */
- if ((local_tm = localtime(&Gflag_time)) == NULL) {
+ if ((local_tm = localtime(&gndo->ndo_Gflag_time)) == NULL) {
error("MakeTimedFilename: localtime");
}
free(filename);
}
-static int tcpdump_printf(netdissect_options *ndo _U_,
- const char *fmt, ...)
-{
-
- va_list args;
- int ret;
-
- va_start(args, fmt);
- ret=vfprintf(stdout, fmt, args);
- va_end(args);
-
- return ret;
-}
-
-static struct print_info
-get_print_info(int type)
-{
- struct print_info printinfo;
-
- printinfo.ndo = gndo;
- printinfo.printer = lookup_printer(type);
- if (printinfo.printer == NULL) {
- gndo->ndo_dltname = pcap_datalink_val_to_name(type);
- if (gndo->ndo_dltname != NULL)
- error("packet printing is not supported for link type %s: use -w",
- gndo->ndo_dltname);
- else
- error("packet printing is not supported for link type %d: use -w", type);
- }
- return (printinfo);
-}
-
static char *
get_next_file(FILE *VFile, char *ptr)
{
{
register int cnt, op, i;
bpf_u_int32 localnet =0 , netmask = 0;
+ int timezone_offset = 0;
register char *cp, *infile, *cmdbuf, *device, *RFileName, *VFileName, *WFileName;
pcap_handler callback;
int type;
if(wsockinit() != 0) return 1;
#endif /* WIN32 */
- jflag=-1; /* not set */
+ gndo->ndo_jflag=-1; /* not set */
gndo->ndo_Oflag=1;
gndo->ndo_Rflag=1;
gndo->ndo_dlt=-1;
- gndo->ndo_default_print=ndo_default_print;
- gndo->ndo_printf=tcpdump_printf;
- gndo->ndo_error=ndo_error;
- gndo->ndo_warning=ndo_warning;
+ ndo_set_function_pointers(gndo);
gndo->ndo_snaplen = DEFAULT_SNAPLEN;
gndo->ndo_immediate = 0;
break;
case 'A':
- ++Aflag;
+ ++gndo->ndo_Aflag;
break;
case 'b':
- ++bflag;
+ ++gndo->ndo_bflag;
break;
#if defined(HAVE_PCAP_CREATE) || defined(WIN32)
case 'B':
- Bflag = atoi(optarg)*1024;
- if (Bflag <= 0)
+ gndo->ndo_Bflag = atoi(optarg)*1024;
+ if (gndo->ndo_Bflag <= 0)
error("invalid packet buffer size %s", optarg);
break;
#endif /* defined(HAVE_PCAP_CREATE) || defined(WIN32) */
break;
case 'C':
- Cflag = atoi(optarg) * 1000000;
- if (Cflag < 0)
+ gndo->ndo_Cflag = atoi(optarg) * 1000000;
+ if (gndo->ndo_Cflag < 0)
error("invalid file size %s", optarg);
break;
break;
case 'e':
- ++eflag;
+ ++gndo->ndo_eflag;
break;
case 'E':
break;
case 'f':
- ++fflag;
+ ++gndo->ndo_fflag;
break;
case 'F':
break;
case 'G':
- Gflag = atoi(optarg);
- if (Gflag < 0)
+ gndo->ndo_Gflag = atoi(optarg);
+ if (gndo->ndo_Gflag < 0)
error("invalid number of seconds %s", optarg);
/* We will create one file initially. */
- Gflag_count = 0;
+ gndo->ndo_Gflag_count = 0;
/* Grab the current time for rotation use. */
- if ((Gflag_time = time(NULL)) == (time_t)-1) {
+ if ((gndo->ndo_Gflag_time = time(NULL)) == (time_t)-1) {
error("main: can't get current time: %s",
pcap_strerror(errno));
}
break;
case 'H':
- ++Hflag;
+ ++gndo->ndo_Hflag;
break;
case 'i':
#ifdef HAVE_PCAP_CREATE
case 'I':
- ++Iflag;
+ ++gndo->ndo_Iflag;
break;
#endif /* HAVE_PCAP_CREATE */
#ifdef HAVE_PCAP_SET_TSTAMP_TYPE
case 'j':
- jflag = pcap_tstamp_type_name_to_val(optarg);
- if (jflag < 0)
+ gndo->ndo_jflag = pcap_tstamp_type_name_to_val(optarg);
+ if (gndo->ndo_jflag < 0)
error("invalid time stamp type %s", optarg);
break;
break;
case 'K':
- ++Kflag;
+ ++gndo->ndo_Kflag;
break;
case 'm':
if (smiLoadModule(optarg) == 0) {
error("could not load MIB module %s", optarg);
}
- sflag = 1;
+ gndo->ndo_sflag = 1;
#else
(void)fprintf(stderr, "%s: ignoring option `-m %s' ",
program_name, optarg);
#ifndef HAVE_LIBCRYPTO
warning("crypto code not compiled in");
#endif
- sigsecret = optarg;
+ gndo->ndo_sigsecret = optarg;
break;
case 'n':
- ++nflag;
+ ++gndo->ndo_nflag;
break;
case 'N':
- ++Nflag;
+ ++gndo->ndo_Nflag;
break;
case 'O':
- Oflag = 0;
+ gndo->ndo_Oflag = 0;
break;
case 'p':
- ++pflag;
+ ++gndo->ndo_pflag;
break;
case 'q':
- ++qflag;
- ++suppress_default_print;
+ ++gndo->ndo_qflag;
+ ++gndo->ndo_suppress_default_print;
break;
#ifdef HAVE_PCAP_SETDIRECTION
break;
case 'R':
- Rflag = 0;
+ gndo->ndo_Rflag = 0;
break;
case 's':
- snaplen = strtol(optarg, &end, 0);
+ gndo->ndo_snaplen = strtol(optarg, &end, 0);
if (optarg == end || *end != '\0'
- || snaplen < 0 || snaplen > MAXIMUM_SNAPLEN)
+ || gndo->ndo_snaplen < 0 || gndo->ndo_snaplen > MAXIMUM_SNAPLEN)
error("invalid snaplen %s", optarg);
- else if (snaplen == 0)
- snaplen = MAXIMUM_SNAPLEN;
+ else if (gndo->ndo_snaplen == 0)
+ gndo->ndo_snaplen = MAXIMUM_SNAPLEN;
break;
case 'S':
- ++Sflag;
+ ++gndo->ndo_Sflag;
break;
case 't':
- ++tflag;
+ ++gndo->ndo_tflag;
break;
case 'T':
if (strcasecmp(optarg, "vat") == 0)
- packettype = PT_VAT;
+ gndo->ndo_packettype = PT_VAT;
else if (strcasecmp(optarg, "wb") == 0)
- packettype = PT_WB;
+ gndo->ndo_packettype = PT_WB;
else if (strcasecmp(optarg, "rpc") == 0)
- packettype = PT_RPC;
+ gndo->ndo_packettype = PT_RPC;
else if (strcasecmp(optarg, "rtp") == 0)
- packettype = PT_RTP;
+ gndo->ndo_packettype = PT_RTP;
else if (strcasecmp(optarg, "rtcp") == 0)
- packettype = PT_RTCP;
+ gndo->ndo_packettype = PT_RTCP;
else if (strcasecmp(optarg, "snmp") == 0)
- packettype = PT_SNMP;
+ gndo->ndo_packettype = PT_SNMP;
else if (strcasecmp(optarg, "cnfp") == 0)
- packettype = PT_CNFP;
+ gndo->ndo_packettype = PT_CNFP;
else if (strcasecmp(optarg, "tftp") == 0)
- packettype = PT_TFTP;
+ gndo->ndo_packettype = PT_TFTP;
else if (strcasecmp(optarg, "aodv") == 0)
- packettype = PT_AODV;
+ gndo->ndo_packettype = PT_AODV;
else if (strcasecmp(optarg, "carp") == 0)
- packettype = PT_CARP;
+ gndo->ndo_packettype = PT_CARP;
else if (strcasecmp(optarg, "radius") == 0)
- packettype = PT_RADIUS;
+ gndo->ndo_packettype = PT_RADIUS;
else if (strcasecmp(optarg, "zmtp1") == 0)
- packettype = PT_ZMTP1;
+ gndo->ndo_packettype = PT_ZMTP1;
else if (strcasecmp(optarg, "vxlan") == 0)
- packettype = PT_VXLAN;
+ gndo->ndo_packettype = PT_VXLAN;
else if (strcasecmp(optarg, "pgm") == 0)
- packettype = PT_PGM;
+ gndo->ndo_packettype = PT_PGM;
else if (strcasecmp(optarg, "pgm_zmtp1") == 0)
- packettype = PT_PGM_ZMTP1;
+ gndo->ndo_packettype = PT_PGM_ZMTP1;
else if (strcasecmp(optarg, "lmp") == 0)
- packettype = PT_LMP;
+ gndo->ndo_packettype = PT_LMP;
else
error("unknown packet type `%s'", optarg);
break;
case 'u':
- ++uflag;
+ ++gndo->ndo_uflag;
break;
#ifdef HAVE_PCAP_DUMP_FLUSH
case 'U':
- ++Uflag;
+ ++gndo->ndo_Uflag;
break;
#endif
case 'v':
- ++vflag;
+ ++gndo->ndo_vflag;
break;
case 'V':
break;
case 'W':
- Wflag = atoi(optarg);
- if (Wflag < 0)
+ gndo->ndo_Wflag = atoi(optarg);
+ if (gndo->ndo_Wflag < 0)
error("invalid number of output files %s", optarg);
- WflagChars = getWflagChars(Wflag);
+ gndo->ndo_WflagChars = getWflagChars(gndo->ndo_Wflag);
break;
case 'x':
- ++xflag;
- ++suppress_default_print;
+ ++gndo->ndo_xflag;
+ ++gndo->ndo_suppress_default_print;
break;
case 'X':
- ++Xflag;
- ++suppress_default_print;
+ ++gndo->ndo_Xflag;
+ ++gndo->ndo_suppress_default_print;
break;
case 'y':
show_devices_and_exit();
#endif
- switch (tflag) {
+ switch (gndo->ndo_tflag) {
case 0: /* Default */
case 4: /* Default + Date*/
- thiszone = gmt2local(0);
+ timezone_offset = gmt2local(0);
break;
case 1: /* No time stamp */
break;
}
- if (fflag != 0 && (VFileName != NULL || RFileName != NULL))
+ if (gndo->ndo_fflag != 0 && (VFileName != NULL || RFileName != NULL))
error("-f can not be used with -V or -r");
if (VFileName != NULL && RFileName != NULL)
supports_monitor_mode = 1;
else
supports_monitor_mode = 0;
- status = pcap_set_snaplen(pd, snaplen);
+ status = pcap_set_snaplen(pd, gndo->ndo_snaplen);
if (status != 0)
error("%s: Can't set snapshot length: %s",
device, pcap_statustostr(status));
- status = pcap_set_promisc(pd, !pflag);
+ status = pcap_set_promisc(pd, !gndo->ndo_pflag);
if (status != 0)
error("%s: Can't set promiscuous mode: %s",
device, pcap_statustostr(status));
- if (Iflag) {
+ if (gndo->ndo_Iflag) {
status = pcap_set_rfmon(pd, 1);
if (status != 0)
error("%s: Can't set monitor mode: %s",
if (status != 0)
error("%s: pcap_set_timeout failed: %s",
device, pcap_statustostr(status));
- if (Bflag != 0) {
- status = pcap_set_buffer_size(pd, Bflag);
+ if (gndo->ndo_Bflag != 0) {
+ status = pcap_set_buffer_size(pd, gndo->ndo_Bflag);
if (status != 0)
error("%s: Can't set buffer size: %s",
device, pcap_statustostr(status));
}
#ifdef HAVE_PCAP_SET_TSTAMP_TYPE
- if (jflag != -1) {
- status = pcap_set_tstamp_type(pd, jflag);
+ if (gndo->ndo_jflag != -1) {
+ status = pcap_set_tstamp_type(pd, gndo->ndo_jflag);
if (status < 0)
error("%s: Can't set time stamp type: %s",
device, pcap_statustostr(status));
(void)fflush(stderr);
}
i = pcap_snapshot(pd);
- if (snaplen < i) {
- warning("snaplen raised from %d to %d", snaplen, i);
- snaplen = i;
+ if (gndo->ndo_snaplen < i) {
+ warning("snaplen raised from %d to %d", gndo->ndo_snaplen, i);
+ gndo->ndo_snaplen = i;
}
- if(fflag != 0) {
+ if(gndo->ndo_fflag != 0) {
if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) {
warning("foreign (-f) flag used but: %s", ebuf);
}
else
cmdbuf = copy_argv(&argv[optind]);
- if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
+ if (pcap_compile(pd, &fcode, cmdbuf, gndo->ndo_Oflag, netmask) < 0)
error("%s", pcap_geterr(pd));
if (dflag) {
bpf_dump(&fcode, dflag);
free(cmdbuf);
exit(0);
}
- init_addrtoname(gndo, localnet, netmask);
- init_checksum();
+ init_print(localnet, netmask, timezone_offset);
#ifndef WIN32
(void)setsignal(SIGPIPE, cleanup);
error("malloc of dumpinfo.CurrentFileName");
/* We do not need numbering for dumpfiles if Cflag isn't set. */
- if (Cflag != 0)
- MakeFilename(dumpinfo.CurrentFileName, WFileName, 0, WflagChars);
+ if (gndo->ndo_Cflag != 0)
+ MakeFilename(dumpinfo.CurrentFileName, WFileName, 0, gndo->ndo_WflagChars);
else
MakeFilename(dumpinfo.CurrentFileName, WFileName, 0, 0);
*/
capng_update(
CAPNG_DROP,
- (Cflag || Gflag ? 0 : CAPNG_PERMITTED)
+ (gndo->ndo_Cflag || gndo->ndo_Gflag ? 0 : CAPNG_PERMITTED)
| CAPNG_EFFECTIVE,
CAP_DAC_OVERRIDE
);
#ifdef HAVE_CAPSICUM
set_dumper_capsicum_rights(p);
#endif
- if (Cflag != 0 || Gflag != 0) {
+ if (gndo->ndo_Cflag != 0 || gndo->ndo_Gflag != 0) {
#ifdef HAVE_CAPSICUM
dumpinfo.WFileName = strdup(basename(WFileName));
dumpinfo.dirfd = open(dirname(WFileName),
pcap_userdata = (u_char *)p;
}
#ifdef HAVE_PCAP_DUMP_FLUSH
- if (Uflag)
+ if (gndo->ndo_Uflag)
pcap_dump_flush(p);
#endif
} else {
(void)setsignal(SIGNAL_REQ_INFO, requestinfo);
#endif
- if (vflag > 0 && WFileName) {
+ if (gndo->ndo_vflag > 0 && WFileName) {
/*
* When capturing to a file, "-v" means tcpdump should,
* every 10 secodns, "v"erbosely report the number of
* to a file from the -V file). Print a message to
* the standard error on UN*X.
*/
- if (!vflag && !WFileName) {
+ if (!gndo->ndo_vflag && !WFileName) {
(void)fprintf(stderr,
"%s: verbose output suppressed, use -v or -vv for full protocol decode\n",
program_name);
dlt_name = pcap_datalink_val_to_name(dlt);
if (dlt_name == NULL) {
(void)fprintf(stderr, "listening on %s, link-type %u, capture size %u bytes\n",
- device, dlt, snaplen);
+ device, dlt, gndo->ndo_snaplen);
} else {
(void)fprintf(stderr, "listening on %s, link-type %s (%s), capture size %u bytes\n",
device, dlt_name,
- pcap_datalink_val_to_description(dlt), snaplen);
+ pcap_datalink_val_to_description(dlt), gndo->ndo_snaplen);
}
(void)fflush(stderr);
}
#endif /* WIN32 */
#ifdef HAVE_CAPSICUM
- cansandbox = (nflag && VFileName == NULL && zflag == NULL);
+ cansandbox = (gndo->ndo_nflag && VFileName == NULL && zflag == NULL);
if (cansandbox && cap_enter() < 0 && errno != ENOSYS)
error("unable to enter the capability mode");
if (cap_sandboxed())
RFileName, dlt_name,
pcap_datalink_val_to_description(new_dlt));
}
- if (pcap_compile(pd, &fcode, cmdbuf, Oflag, netmask) < 0)
+ if (pcap_compile(pd, &fcode, cmdbuf, gndo->ndo_Oflag, netmask) < 0)
error("%s", pcap_geterr(pd));
if (pcap_setfilter(pd, &fcode) < 0)
error("%s", pcap_geterr(pd));
dump_packet_and_trunc(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
{
struct dump_info *dump_info;
-#ifdef HAVE_CAPSICUM
- cap_rights_t rights;
-#endif
++packets_captured;
* first thereby cancelling the Cflag boundary (since the file should
* be 0).
*/
- if (Gflag != 0) {
+ if (gndo->ndo_Gflag != 0) {
/* Check if it is time to rotate */
time_t t;
/* If the time is greater than the specified window, rotate */
- if (t - Gflag_time >= Gflag) {
+ if (t - gndo->ndo_Gflag_time >= gndo->ndo_Gflag) {
#ifdef HAVE_CAPSICUM
FILE *fp;
int fd;
#endif
/* Update the Gflag_time */
- Gflag_time = t;
+ gndo->ndo_Gflag_time = t;
/* Update Gflag_count */
- Gflag_count++;
+ gndo->ndo_Gflag_count++;
/*
* Close the current file and open a new one.
*/
* Check to see if we've exceeded the Wflag (when
* not using Cflag).
*/
- if (Cflag == 0 && Wflag > 0 && Gflag_count >= Wflag) {
+ if (gndo->ndo_Cflag == 0 && gndo->ndo_Wflag > 0 && gndo->ndo_Gflag_count >= gndo->ndo_Wflag) {
(void)fprintf(stderr, "Maximum file limit reached: %d\n",
- Wflag);
+ gndo->ndo_Wflag);
exit(0);
/* NOTREACHED */
}
* so multiple files would end with 1,2,3 in the filename.
* The counting is handled with the -C flow after this.
*/
- Cflag_count = 0;
+ gndo->ndo_Cflag_count = 0;
/*
* This is always the first file in the Cflag
* rotation: e.g. 0
* We also don't need numbering if Cflag is not set.
*/
- if (Cflag != 0)
+ if (gndo->ndo_Cflag != 0)
MakeFilename(dump_info->CurrentFileName, dump_info->WFileName, 0,
- WflagChars);
+ gndo->ndo_WflagChars);
else
MakeFilename(dump_info->CurrentFileName, dump_info->WFileName, 0, 0);
* larger than Cflag - the last packet written to the
* file could put it over Cflag.
*/
- if (Cflag != 0) {
+ if (gndo->ndo_Cflag != 0) {
long size = pcap_dump_ftell(dump_info->p);
if (size == -1)
error("ftell fails on output file");
- if (size > Cflag) {
+ if (size > gndo->ndo_Cflag) {
#ifdef HAVE_CAPSICUM
FILE *fp;
int fd;
if (zflag != NULL)
compress_savefile(dump_info->CurrentFileName);
- Cflag_count++;
- if (Wflag > 0) {
- if (Cflag_count >= Wflag)
- Cflag_count = 0;
+ gndo->ndo_Cflag_count++;
+ if (gndo->ndo_Wflag > 0) {
+ if (gndo->ndo_Cflag_count >= gndo->ndo_Wflag)
+ gndo->ndo_Cflag_count = 0;
}
if (dump_info->CurrentFileName != NULL)
free(dump_info->CurrentFileName);
dump_info->CurrentFileName = (char *)malloc(PATH_MAX + 1);
if (dump_info->CurrentFileName == NULL)
error("dump_packet_and_trunc: malloc");
- MakeFilename(dump_info->CurrentFileName, dump_info->WFileName, Cflag_count, WflagChars);
+ MakeFilename(dump_info->CurrentFileName, dump_info->WFileName, gndo->ndo_Cflag_count, gndo->ndo_WflagChars);
#ifdef HAVE_LIBCAP_NG
capng_update(CAPNG_ADD, CAPNG_EFFECTIVE, CAP_DAC_OVERRIDE);
capng_apply(CAPNG_SELECT_BOTH);
pcap_dump((u_char *)dump_info->p, h, sp);
#ifdef HAVE_PCAP_DUMP_FLUSH
- if (Uflag)
+ if (gndo->ndo_Uflag)
pcap_dump_flush(dump_info->p);
#endif
pcap_dump(user, h, sp);
#ifdef HAVE_PCAP_DUMP_FLUSH
- if (Uflag)
+ if (gndo->ndo_Uflag)
pcap_dump_flush((pcap_dumper_t *)user);
#endif
print_packet(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
{
struct print_info *print_info;
- u_int hdrlen;
- netdissect_options *ndo;
++packets_captured;
++infodelay;
print_info = (struct print_info *)user;
- ndo = print_info->ndo;
- if(ndo->ndo_packet_number)
- ND_PRINT((ndo, "%5u ", packets_captured));
-
- ts_print(ndo, &h->ts);
-
- /*
- * Some printers want to check that they're not walking off the
- * end of the packet.
- * Rather than pass it all the way down, we set this member
- * of the netdissect_options structure.
- */
- ndo->ndo_snapend = sp + h->caplen;
-
- hdrlen = (*print_info->printer)(print_info->ndo, h, sp);
-
- /*
- * Restore the original snapend, as a printer might have
- * changed it.
- */
- ndo->ndo_snapend = sp + h->caplen;
- if (ndo->ndo_Xflag) {
- /*
- * Print the raw packet data in hex and ASCII.
- */
- if (ndo->ndo_Xflag > 1) {
- /*
- * Include the link-layer header.
- */
- hex_and_ascii_print(ndo, "\n\t", sp, h->caplen);
- } else {
- /*
- * Don't include the link-layer header - and if
- * we have nothing past the link-layer header,
- * print nothing.
- */
- if (h->caplen > hdrlen)
- hex_and_ascii_print(ndo, "\n\t", sp + hdrlen,
- h->caplen - hdrlen);
- }
- } else if (ndo->ndo_xflag) {
- /*
- * Print the raw packet data in hex.
- */
- if (ndo->ndo_xflag > 1) {
- /*
- * Include the link-layer header.
- */
- hex_print(ndo, "\n\t", sp, h->caplen);
- } else {
- /*
- * Don't include the link-layer header - and if
- * we have nothing past the link-layer header,
- * print nothing.
- */
- if (h->caplen > hdrlen)
- hex_print(ndo, "\n\t", sp + hdrlen,
- h->caplen - hdrlen);
- }
- } else if (ndo->ndo_Aflag) {
- /*
- * Print the raw packet data in ASCII.
- */
- if (ndo->ndo_Aflag > 1) {
- /*
- * Include the link-layer header.
- */
- ascii_print(ndo, sp, h->caplen);
- } else {
- /*
- * Don't include the link-layer header - and if
- * we have nothing past the link-layer header,
- * print nothing.
- */
- if (h->caplen > hdrlen)
- ascii_print(ndo, sp + hdrlen, h->caplen - hdrlen);
- }
- }
-
- putchar('\n');
+ pretty_print_packet(print_info, h, sp, packets_captured);
--infodelay;
if (infoprint)
char Wpcap_version[]="3.1";
#endif
-/*
- * By default, print the specified data out in hex and ASCII.
- */
-static void
-ndo_default_print(netdissect_options *ndo, const u_char *bp, u_int length)
-{
- hex_and_ascii_print(ndo, "\n\t", bp, length); /* pass on lf and indentation string */
-}
-
-void
-default_print(const u_char *bp, u_int length)
-{
- ndo_default_print(gndo, bp, length);
-}
-
#ifdef SIGNAL_REQ_INFO
RETSIGTYPE requestinfo(int signo _U_)
{
(void)fprintf(stderr,
"\t\t[ -Z user ] [ expression ]\n");
}
-
-
-
-/* VARARGS */
-static void
-ndo_error(netdissect_options *ndo _U_, const char *fmt, ...)
-{
- va_list ap;
-
- (void)fprintf(stderr, "%s: ", program_name);
- va_start(ap, fmt);
- (void)vfprintf(stderr, fmt, ap);
- va_end(ap);
- if (*fmt) {
- fmt += strlen(fmt);
- if (fmt[-1] != '\n')
- (void)fputc('\n', stderr);
- }
- exit(1);
- /* NOTREACHED */
-}
-
-/* VARARGS */
-static void
-ndo_warning(netdissect_options *ndo _U_, const char *fmt, ...)
-{
- va_list ap;
-
- (void)fprintf(stderr, "%s: WARNING: ", program_name);
- va_start(ap, fmt);
- (void)vfprintf(stderr, fmt, ap);
- va_end(ap);
- if (*fmt) {
- fmt += strlen(fmt);
- if (fmt[-1] != '\n')
- (void)fputc('\n', stderr);
- }
-}
/*
* Local Variables:
* c-style: whitesmith
# DHCP tests
dhcp-rfc3004 dhcp-rfc3004.pcap dhcp-rfc3004-v.out -t -v
dhcp-rfc5859 dhcp-rfc5859.pcap dhcp-rfc5859-v.out -t -v
+
+# bad packets from Kevin Day
+# cve-2015-2155 -- futz testing on FORCES printer
+kday1 kday1.pcap kday1.out -t -v
+# cve-2015-2153 -- futz testing on TCP printer
+kday2 kday2.pcap kday2.out -t -v
+# cve-2015-2153 -- futz testing on TCP printer
+kday3 kday3.pcap kday3.out -t -v
+# cve-2015-2153 -- futz testing on TCP printer
+kday4 kday4.pcap kday4.out -t -v
+# cve-2015-2153 -- futz testing on TCP printer
+kday5 kday5.pcap kday5.out -t -v
+# cve-2015-2154 -- ethernet printer
+kday6 kday6.pcap kday6.out -t -v
+# cve-2015-2153 -- futz testing on TCP printer
+kday7 kday7.pcap kday7.out -t -v
+# cve-2015-2153 -- futz testing on TCP printer
+kday8 kday8.pcap kday8.out -t -v
+
+# bad packets from reversex86.
+cve2015-0261_01 cve2015-0261-ipv6.pcap cve2015-0261-ipv6.out -t -v
+cve2015-0261_02 cve2015-0261-crash.pcap cve2015-0261-crash.out -t -v
$output=$ARGV[2];
$options=$ARGV[3];
+my $r;
+
if ($^O eq 'MSWin32') {
- $r = system "..\\windump -n -r $input $options 2>NUL | sed 's/\\r//' | tee NEW/$output | diff $output - >DIFF/$output.diff";
+ $r = system "..\\windump -n -r $input $options 2>NUL | sed 's/\\r//' | tee NEW/$output | diff $output - >DIFF/$output.diff";
+ # need to do same as below for Cygwin.
}
else {
# we used to do this as a nice pipeline, but the problem is that $r fails to
# to be set properly if the tcpdump core dumps.
$r = system "../tcpdump 2>/dev/null -n -r $input $options >NEW/$output";
+ if($r == 0x100) {
+ # this means tcpdump exited with code 1.
+ open(OUTPUT, ">>"."NEW/$output") || die "fail to open $output\n";
+ printf OUTPUT "EXIT CODE %08x\n", $r;
+ close(OUTPUT);
+ $r = 0;
+ }
if($r == 0) {
$r = system "cat NEW/$output | diff $output - >DIFF/$output.diff";
}
--- /dev/null
+IP6 (class 0x03, flowlabel 0x03030, hlim 48, next-header Options (0) payload length: 12336) 3030:3030:3030:3030:3030:3030:3030:3030 > 130:3030:3030:3030:3030:3030:3030:3030: HBH [trunc] (header length 8 is too small for type 1)[|MOBILITY]
--- /dev/null
+IP6 truncated-ip6 - 26325 bytes missing!(class 0x76, flowlabel 0x76767, hlim 103, next-header Mobility (135) payload length: 26470) 6767:6767:6767:6767:6767:6767:6767:6767 > 6767:6767:6767:6767:6767:6767:6767:6705: mobility: BU seq#=26471 HL lifetime=105884(type-0x67: len=103)[trunc]
+IP6 truncated-ip6 - 26325 bytes missing!(class 0x76, flowlabel 0x76767, hlim 103, next-header Mobility (135) payload length: 26470) 6767:6767:6767:6767:6767:6767:6767:6767 > 6767:6767:4f67:6767:6767:6767:6767:6767: (header length 8 is too small for type 6)[|MOBILITY]
+EXIT CODE 00000100
Status TLV (0x0002) TLV, length 5, 0x4
DTP type TLV (0x0003) TLV, length 5, 0x40
Neighbor TLV (0x0004) TLV, length 10, 00:19:06:ea:b8:85
-00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP Unnumbered, ui, Flags [Command], length 76
+00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP, oui Cisco (0x00000c), pid Unknown (0x0003), length 68:
+ 0x0000: aaaa 0300 000c 0003 0000 0000 0100 0ccc ................
+ 0x0010: cccc 0019 06ea b885 0025 aaaa 0300 000c .........%......
+ 0x0020: 2004 0100 0100 084c 6162 0000 0200 0504 .......Lab......
+ 0x0030: 0003 0005 4000 0400 0a00 1906 eab8 8500 ....@...........
+ 0x0040: 0000 0000 0000 0000 f7a7 fe42 ...........B
DTPv1, length 38
Domain TLV (0x0001) TLV, length 8, Lab
Status TLV (0x0002) TLV, length 5, 0x4
DTP type TLV (0x0003) TLV, length 5, 0x40
Neighbor TLV (0x0004) TLV, length 10, 00:19:06:ea:b8:85
-00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP Unnumbered, ui, Flags [Command], length 76
+00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP, oui Cisco (0x00000c), pid Unknown (0x0003), length 68:
+ 0x0000: aaaa 0300 000c 0003 0000 0000 0100 0ccc ................
+ 0x0010: cccc 0019 06ea b885 0025 aaaa 0300 000c .........%......
+ 0x0020: 2004 0100 0100 084c 6162 0000 0200 0504 .......Lab......
+ 0x0030: 0003 0005 4000 0400 0a00 1906 eab8 8500 ....@...........
+ 0x0040: 0000 0000 0000 0000 f7a7 fe42 ...........B
DTPv1, length 38
Domain TLV (0x0001) TLV, length 8, Lab
Status TLV (0x0002) TLV, length 5, 0x4
DTP type TLV (0x0003) TLV, length 5, 0x40
Neighbor TLV (0x0004) TLV, length 10, 00:19:06:ea:b8:85
-00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP Unnumbered, ui, Flags [Command], length 76
+00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP, oui Cisco (0x00000c), pid Unknown (0x0003), length 68:
+ 0x0000: aaaa 0300 000c 0003 0000 0000 0100 0ccc ................
+ 0x0010: cccc 0019 06ea b885 0025 aaaa 0300 000c .........%......
+ 0x0020: 2004 0100 0100 084c 6162 0000 0200 0504 .......Lab......
+ 0x0030: 0003 0005 4000 0400 0a00 1906 eab8 8500 ....@...........
+ 0x0040: 0000 0000 0000 0000 f7a7 fe42 ...........B
DTPv1, length 38
Domain TLV (0x0001) TLV, length 8, Lab
Status TLV (0x0002) TLV, length 5, 0x4
DTP type TLV (0x0003) TLV, length 5, 0x40
Neighbor TLV (0x0004) TLV, length 10, 00:19:06:ea:b8:85
-00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP Unnumbered, ui, Flags [Command], length 76
+00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP, oui Cisco (0x00000c), pid Unknown (0x0003), length 68:
+ 0x0000: aaaa 0300 000c 0003 0000 0000 0100 0ccc ................
+ 0x0010: cccc 0019 06ea b885 0025 aaaa 0300 000c .........%......
+ 0x0020: 2004 0100 0100 084c 6162 0000 0200 0504 .......Lab......
+ 0x0030: 0003 0005 4000 0400 0a00 1906 eab8 8514 ....@...........
+ 0x0040: 0002 000f 0000 0000 7232 1da6 ........r2..
DTPv1, length 38
Domain TLV (0x0001) TLV, length 8, Lab
Status TLV (0x0002) TLV, length 5, 0x4
DTP type TLV (0x0003) TLV, length 5, 0x40
Neighbor TLV (0x0004) TLV, length 10, 00:19:06:ea:b8:85
-00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP Unnumbered, ui, Flags [Command], length 76
+00:19:06:ea:b8:85 > 01:00:0c:00:00:00 SNAP, oui Cisco (0x00000c), pid Unknown (0x0003), length 68:
+ 0x0000: aaaa 0300 000c 0003 0000 0000 0100 0ccc ................
+ 0x0010: cccc 0019 06ea b885 0025 aaaa 0300 000c .........%......
+ 0x0020: 2004 0100 0100 084c 6162 0000 0200 0504 .......Lab......
+ 0x0030: 0003 0005 4000 0400 0a00 1906 eab8 8514 ....@...........
+ 0x0040: 0002 000f 0000 0000 7232 1da6 ........r2..
-10016360us tsft 1.0 Mb/s 2412 MHz 11b -22dB signal -86dB noise antenna 1 [bit 31] 0us Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
-10018922us tsft 1.0 Mb/s 2412 MHz 11b -19dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-10017245us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
-10085301us tsft 1.0 Mb/s 2412 MHz 11b -19dB signal -86dB noise antenna 1 [bit 31] 0us Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
-10087718us tsft 1.0 Mb/s 2412 MHz 11b -18dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-10086042us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
-10284358us tsft 1.0 Mb/s 2412 MHz 11b -61dB signal -86dB noise antenna 1 [bit 31] 0us Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
-10288217us tsft 1.0 Mb/s 2412 MHz 11b -46dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-10286542us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
-10351366us tsft 1.0 Mb/s 2412 MHz 11b -70dB signal -86dB noise antenna 1 [bit 31] 0us Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
-10353769us tsft 1.0 Mb/s 2412 MHz 11b -57dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-10352092us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
-10418368us tsft 1.0 Mb/s 2412 MHz 11b -67dB signal -86dB noise antenna 1 [bit 31] 0us Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
-10420929us tsft 1.0 Mb/s 2412 MHz 11b -73dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-10419253us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
-10485371us tsft 1.0 Mb/s 2412 MHz 11b -72dB signal -86dB noise antenna 1 [bit 31] 0us Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
-10489278us tsft 1.0 Mb/s 2412 MHz 11b -74dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-10487602us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
-13338508us tsft 1.0 Mb/s 2412 MHz 11b -14dB signal -86dB noise antenna 1 [bit 31] 314us Authentication (Open System)-1: Successful
-13340215us tsft 1.0 Mb/s 2412 MHz 11b -17dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-13339435us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Authentication (Open System)-2:
-13341999us tsft 1.0 Mb/s 2412 MHz 11b -18dB signal -86dB noise antenna 1 [bit 31] 314us Assoc Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
-13346458us tsft 1.0 Mb/s 2412 MHz 11b -18dB signal -86dB noise antenna 0 [bit 31] 0us Acknowledgment RA:90:a4:de:c0:46:0a
-13344925us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] 314us Assoc Response AID(1) :: Successful
-13355433us tsft 2412 MHz 11g -22dB signal -86dB noise antenna 1 19.5 Mb/s MCS 2 20 MHz lon GI [bit 31] 48us
-13454791us tsft 2412 MHz 11g -21dB signal -86dB noise antenna 1 52.0 Mb/s MCS 11 20 MHz lon GI [bit 31] Pwr Mgmt 44us
+10016360us tsft 1.0 Mb/s 2412 MHz 11b -22dB signal -86dB noise antenna 1 [bit 31] Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
+10018922us tsft 1.0 Mb/s 2412 MHz 11b -19dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+10017245us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
+10085301us tsft 1.0 Mb/s 2412 MHz 11b -19dB signal -86dB noise antenna 1 [bit 31] Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
+10087718us tsft 1.0 Mb/s 2412 MHz 11b -18dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+10086042us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
+10284358us tsft 1.0 Mb/s 2412 MHz 11b -61dB signal -86dB noise antenna 1 [bit 31] Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
+10288217us tsft 1.0 Mb/s 2412 MHz 11b -46dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+10286542us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
+10351366us tsft 1.0 Mb/s 2412 MHz 11b -70dB signal -86dB noise antenna 1 [bit 31] Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
+10353769us tsft 1.0 Mb/s 2412 MHz 11b -57dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+10352092us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
+10418368us tsft 1.0 Mb/s 2412 MHz 11b -67dB signal -86dB noise antenna 1 [bit 31] Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
+10420929us tsft 1.0 Mb/s 2412 MHz 11b -73dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+10419253us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
+10485371us tsft 1.0 Mb/s 2412 MHz 11b -72dB signal -86dB noise antenna 1 [bit 31] Probe Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
+10489278us tsft 1.0 Mb/s 2412 MHz 11b -74dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+10487602us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Probe Response (omus) [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] CH: 1
+13338508us tsft 1.0 Mb/s 2412 MHz 11b -14dB signal -86dB noise antenna 1 [bit 31] Authentication (Open System)-1: Successful
+13340215us tsft 1.0 Mb/s 2412 MHz 11b -17dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+13339435us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Authentication (Open System)-2:
+13341999us tsft 1.0 Mb/s 2412 MHz 11b -18dB signal -86dB noise antenna 1 [bit 31] Assoc Request (omus) [1.0 2.0 5.5 11.0 6.0 9.0 12.0 18.0 Mbit]
+13346458us tsft 1.0 Mb/s 2412 MHz 11b -18dB signal -86dB noise antenna 0 [bit 31] Acknowledgment RA:90:a4:de:c0:46:0a
+13344925us tsft 1.0 Mb/s -86dB noise 27dBm tx power [bit 15] Assoc Response AID(1) :: Successful
+13355433us tsft 2412 MHz 11g -22dB signal -86dB noise antenna 1 19.5 Mb/s MCS 2 20 MHz lon GI [bit 31]
+13454791us tsft 2412 MHz 11g -21dB signal -86dB noise antenna 1 52.0 Mb/s MCS 11 20 MHz lon GI [bit 31]
-7268us tsft 2462 MHz 11g -51dB signal antenna 1 150.0 Mb/s MCS 7 40 MHz short GI RX-STBC1 CF +QoS Data IV: 11 Pad 20 KeyID 0
-119738173us tsft 2462 MHz 11g -46dB signal antenna 1 135.0 Mb/s MCS 7 40 MHz lon GI RX-STBC2 CF +QoS Data IV: 1 Pad 20 KeyID 0
-470382336us tsft 2462 MHz 11g -45dB signal antenna 1 150.0 Mb/s MCS 7 40 MHz short GI RX-STBC3 CF +QoS Data IV: 5 Pad 20 KeyID 0
+7268us tsft 2462 MHz 11g -51dB signal antenna 1 150.0 Mb/s MCS 7 40 MHz short GI RX-STBC1 Data IV: 11 Pad 20 KeyID 0
+119738173us tsft 2462 MHz 11g -46dB signal antenna 1 135.0 Mb/s MCS 7 40 MHz lon GI RX-STBC2 Data IV: 1 Pad 20 KeyID 0
+470382336us tsft 2462 MHz 11g -45dB signal antenna 1 150.0 Mb/s MCS 7 40 MHz short GI RX-STBC3 Data IV: 5 Pad 20 KeyID 0
--- /dev/null
+IP6, wrong link-layer encapsulation (tos 0x10, ttl 192, id 63177, offset 0, flags [DF], proto SCTP (132), length 168, options (security [bad length 110]), bad cksum a291 (->9204)!)
+ c084:a291:b8aa:42aa:3e38:9ac7:826e:b930.33943 > 8497:1a30:7cd4:d4d4:d4d4:d428:13:68.6704: sctp[ForCES HP] (1) [DATA] (B)(E) [TSN: 1934917887] [SID: 256] [SSEQ 15360] [PPID 0x3c00]
+ ForCES Config
+ ForCES Version 14 len 88B flags 0x0a040604
+ SrcID 0xff000200(AllMulticast) DstID 0xb59cbe(FE) Correlator 0x30480805f4010800
+ Messy oper TLV header, type (0x600)
+ excess of -240 Bytes
+ [0x0000: e803 0016 ff00 0200 00b5 9cbe 3048 0805
+ [0x0010: f401 0800 0a04 0604 0010 003c 0000 3ce8
+ [0x0020: 0300 3c00 000e 0016 0604 0010 003c 0000
+ [0x0030: 0000 ff00 ffff a69c be30 4808 0600 0108
+ [0x0040: 0006 0400 0184 b59c be30 84b5 0010 0000
+ [0x0050: cc05 367e 0003 0000
+ ][|sctp]
+EXIT CODE 00000100
--- /dev/null
+CFMv0 unknown (204), MD Level 0, length 168
+ First TLV offset 52
+ 0x0000: a300 0000 0080 0000 0000 0000 0000 0000
+ 0x0010: 0000 00aa 6873 54d7 060b 003c 0000 003c
+ 0x0020: d4c3 b2a1 0200 1a00 000b 003c 0000 003c
+ 0x0030: d4c3 b2a1 0200 1a00 0000 0000 3620 0a00
+ 0x0040: b600 0000 b600 0000 40b5 9cbe 3048 0cc4
+ 0x0050: ad37 1005 ffff 05cc 0934 9300 0000 0080
+ 0x0060: 0000 0000 0000 3200 0000 0000 00aa 6873
+ Port status TLV (0x02), length 26, Status: Unknown (0)
+ Unknown TLV (0x37), length 4101
+ 0x0000: 3710 05ff ff05 cc09 3493 0000 0000 8000
+ 0x0010: 0000 0000 0032 0000 0000 0000 aa68 7354
+ 0x0020: d706 0b00 3c00 0000 3c00 0000 0080 0000
+ 0x0030: fffd 4d5f d9bd c709 30ac 8176 b36d cc11
+ 0x0040: 3abf 1291 f106 4ede 61f4 6297 afc4 39a4
+ 0x0050: 0db9 7a
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 1819218606, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
+IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x66a1), ack 2339312418, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x8900), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 21
+ Error code: Unknown (66), Encapsulated PDU length: 37|trunc
+ [|RPKI-RTR]
+EXIT CODE 00000100
--- /dev/null
+IP (tos 0x10, ttl 64, id 63177, offset 0, flags [DF], proto TCP (6), length 168)
+ 204.9.54.80.22 > 204.9.51.132.50079: Flags [P.], cksum 0x0282 (incorrect -> 0x3217), seq 1819218606:1819218722, ack 1238485076, win 1039, options [nop,nop,TS val 1340592078 ecr 941371882], length 116
+IP6, wrong link-layer encapsulation (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52, options (unknown 195 [bad length 159]), bad cksum 3da6 (->45ca)!)
+ 27759 > 4782: tcp 24 [bad hdr length 0 - too short, < 20]
+IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x85a1), ack 1819218722, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x0cf1), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2381534627 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 0, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
+IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x85a1), ack 1, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 1, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xa6b3), seq 0:347, ack 1, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv9, Unknown PDU (51), length: 32
+ 0x0000: 0933 84cc 0000 0020 9f00 1649 d1c8 546c
+ 0x0010: ff13 1980 100f fc85 8b00 0055 0000 0101
+ [|RPKI-RTR]
+EXIT CODE 00000100
--- /dev/null
+IP (tos 0x10, ttl 64, id 63177, offset 0, flags [none], proto unknown (240), length 168, bad cksum 418f (->80a5)!)
+ 204.9.54.80 > 204.9.51.132: ip-proto-240 148
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3da6 (->35a6)!)
+ 212.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0x4811), ack 1819218606, win 17918, options [nop,nop,TS val 941371903 ecr 1340592074], length 0
+84:b5:9c:be:30:48 Unknown SSAP 0x10 > 0c:c4:7a:08:e9:12 Unknown DSAP 0x44 Information, send seq 0, rcv seq 26, Flags [Command], length 52
+ 0x0000: 4510 0034 f5c8 4000 3e06 4504 cc09 3384 E..4..@.>.E...3.
+ 0x0010: cc09 3650 c39f 0016 49d1 c854 6c6f 1322 ..6P....I..Tlo."
+ 0x0020: 8010 0ffc 858b 0000 0101 080a 381c 3209 ............8.2.
+ 0x0030: 4fe7 cfd4 O...
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.54.80.55936 > 204.9.55.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x725a), ack 3589495407, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xcd5f), seq 3589495407:3589495754, ack 370436242, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 58f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 1819218606, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
+IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x85a1), ack 1819218722, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xfa70), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv197, Unknown PDU (100), length: 60
+ 0x0000: c564 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
+IP truncated-ip - 768 bytes missing! (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 820, bad cksum 3da6 (->3aa6)!)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], seq 0:768, ack 1, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 768
+IP (tos 0x6,ECT(0), ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->4524)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x85a1), ack 1, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 1, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x3f28), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 100
+ Error text: ^@^@^@M-^?M-^?^_^[pM-xWM-nhMM-}M_M-YM-=M-G^I0M-,M-^AvM-3mM-L^Q:M-?^RM-^QM-q^FNM-^aM-tbM-^WM-/M-D9M-$^MM-9zM-%hs3M-hA^J^@B^@^@^@B^@^@^@%M-Dz^HM-i^RM-^DM-5M-^\M->0H^H^@E^P^@4M-}&@^@>^F
+ RPKI-RTRv115, Error Report PDU (10), length: 66|trunc
+ [|RPKI-RTR]
+EXIT CODE 00000100
--- /dev/null
+CFMv0 unknown (204), MD Level 0, length 168
+ First TLV offset 52
+ 0x0000: a300 0000 0080 0000 0000 0000 0000 0000
+ 0x0010: 0000 00aa 6873 54d7 060b 003c 0000 003c
+ 0x0020: d4c3 b2a1 0200 1a00 000b 003c 0000 003c
+ 0x0030: d4c3 b2a1 0200 1a00 0000 0000 3620 0a00
+ 0x0040: b600 0000 b600 0000 40b5 9cbe 3048 0cc4
+ 0x0050: ad37 1005 ffff 05cc 0934 9300 0000 0080
+ 0x0060: 0000 0000 0000 3200 0000 0000 00aa 6873
+ Port status TLV (0x02), length 26, Status: Unknown (0)
+ Unknown TLV (0x37), length 4101
+ 0x0000: 3710 05ff ff05 cc09 3493 0000 0000 8000
+ 0x0010: 0000 0000 0032 0000 0000 0000 aa68 7354
+ 0x0020: d706 0b00 3c00 0000 3c00 0000 0080 0000
+ 0x0030: fffd 4d5f d9bd c709 30ac 8176 b36d cc11
+ 0x0040: 3abf 1291 f106 4ede 61f4 6297 afc4 39a4
+ 0x0050: 0db9 7a
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 1819218606, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
+IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x98c3), ack 1819279359, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x183a), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2351322531 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 80
+ Error text: M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-CM-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9M-9^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^V^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J^J
+ [|RPKI-RTR]
+EXIT CODE 00000100
--- /dev/null
+FRF.16 Frag, seq 693, Flags [Begin], UI e8! IS-IS, length 301989913
+ L1 LSP, hlen: 27, v: 1, pdu-v: 1, sys-id-len: 6 (0), max-area: 131 (131)
+ lsp-id: 8383.8383.834f.00-60, seq: 0x06418fcc, lifetime: 33667s
+ chksum: 0x0900 (unverified), PDU length: 33667, Flags: [ Overload bit set, expense ATT bit set, L1 IS ]
+ Multi-Topology Capability TLV #144, length: 137
+ O: 0, RES: 4, MTID(s): 3945
+ unknown subTLV #8, length: 233
+ unknown subTLV #18, length: 0
+ unknown subTLV #37, length: 144
+ unknown subTLV #137, length: 79
+ unknown subTLV #105, length: 8
+ unknown subTLV #0, length: 69
+ unknown subTLV #0, length: 0
+ unknown subTLV #52, length: 144
+ unknown subTLV #64, length: 64
+ SPB Instance subTLV #1, length: 64
+ CIST Root-ID: 06a516cc 09370acc, Path Cost: ffffff7f, Prio: 48090
+ RES: 1031, V: 1, SPSource-ID: 324444, No of Trees: 5
+ U:0, M:0, A:0, RES:22, ECT: 144a2d80, BVID: 256, SPVID: 1040
+ U:0, M:1, A:1, RES:14, ECT: 55000001, BVID: 16, SPVID: 2058
+ U:1, M:0, A:0, RES:12, ECT: f3ac2b26, BVID: 2499, SPVID: 185
+ U:1, M:0, A:1, RES:5, ECT: 68735440, BVID: 1216, SPVID: 3072
+ U:1, M:1, A:1, RES:23, ECT: 020000f7, BVID: 32, SPVID: 0
+ unknown subTLV #132, length: 181
+ unknown subTLV #156, length: 190
+ unknown subTLV #255, length: 255
+ unknown subTLV #255, length: 255
+ unknown subTLV #0, length: 64
+ unknown subTLV #6, length: 62
+ unknown subTLV #136, length: 204
+ unknown subTLV #9, length: 16
+ unknown subTLV #4, length: 16
+ unknown subTLV #5, length: 148
+ unknown subTLV #0, length: 0
+ SPB Instance subTLV #1, length: 1
+ CIST Root-ID: 080a26a6 318b8cf3, Path Cost: a5d38ec4, Prio: 31240
+ RES: 1864, V: 1, SPSource-ID: 133120, No of Trees: 45
+ U:0, M:0, A:0, RES:0, ECT: cc09370a, BVID: 3496, SPVID: 1
+ U:1, M:0, A:1, RES:27, ECT: 16274ce2, BVID: 3423, SPVID: 860
+ U:1, M:1, A:0, RES:10, ECT: 80100410, BVID: 89, SPVID: 1093
+ U:0, M:0, A:0, RES:16, ECT: 04106e55, BVID: 0, SPVID: 1
+ U:0, M:0, A:0, RES:1, ECT: 080a8cf3, BVID: 2754, SPVID: 2854
+ U:1, M:0, A:0, RES:28, ECT: 0e2d0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:27, ECT: 01001201, BVID: 2104, SPVID: 899
+ U:1, M:0, A:0, RES:3, ECT: 83838383, BVID: 2104, SPVID: 899
+ U:0, M:1, A:0, RES:15, ECT: 00600641, BVID: 2300, SPVID: 3081
+ U:0, M:0, A:0, RES:0, ECT: 2590894f, BVID: 1680, SPVID: 2281
+ U:0, M:0, A:0, RES:18, ECT: 0025e489, BVID: 1264, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3711
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0c0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e640e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e80ff, BVID: 3760, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e000003, BVID: 3720, SPVID: 14
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 560e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3675
+ U:1, M:0, A:0, RES:0, ECT: acaa4016, BVID: 380, SPVID: 494
+ U:1, M:1, A:0, RES:14, ECT: 1560b70f, BVID: 2993, SPVID: 1575
+ U:0, M:1, A:0, RES:12, ECT: e2d5f35c, BVID: 3240, SPVID: 16
+ U:0, M:0, A:0, RES:4, ECT: 10059445, BVID: 256, SPVID: 1040
+ U:0, M:1, A:1, RES:14, ECT: 55000001, BVID: 16, SPVID: 2058
+ U:1, M:0, A:0, RES:12, ECT: f3ac2b26, BVID: 2499, SPVID: 2745
+ U:1, M:0, A:1, RES:5, ECT: 68735440, BVID: 1216, SPVID: 3072
+ U:1, M:1, A:1, RES:23, ECT: 020000f7, BVID: 32, SPVID: 0
+ U:1, M:0, A:0, RES:4, ECT: b59cbe8c, BVID: 4095, SPVID: 4095
+ U:0, M:0, A:0, RES:0, ECT: 40ff3e88, BVID: 3264, SPVID: 2320
+ U:0, M:0, A:0, RES:4, ECT: 10059400, BVID: 0, SPVID: 257
+ U:0, M:0, A:0, RES:8, ECT: 0a269c31, BVID: 2232, SPVID: 3315
+ U:1, M:0, A:1, RES:12, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:0, ECT: 040e0e0e, BVID: 224, SPVID: 3598
+ U:1, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0b0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 224, SPVID: 3598
+ U:0, M:0, A:0, RES:14, ECT: 0e0e0e0e, BVID: 3, SPVID: 3616
+ unknown TLV #213, length: 243
+ 0x0000: 5cca 8010 0410 0594 4510 0410 6e55 0000
+ 0x0010: 0101 080a 8cf3 ac2b 269c 0e2d 0e0e 0e0e
+ 0x0020: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0030: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0040: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0050: 0e0e 0e0e 0e0e 0e0e 0e1b 0100 1201 8383
+ 0x0060: 8383 8383 8383 8383 834f 0060 0641 8fcc
+ 0x0070: 0900 2590 894f 6908 e912 0025 e489 4f0e
+ 0x0080: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0090: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00a0: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00b0: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00c0: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00d0: 7f0e 0e0e 0e0e 0e0e 0e0e 0e0e 0c0e 0e0e
+ 0x00e0: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00f0: 0e0e 0e
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ unknown TLV #100, length: 14
+ 0x0000: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ unknown TLV #96, length: 183
+ 0x0000: 0fbb 1627 4ce2 d5f3 5cca 8010 0410 0594
+ 0x0010: 4510 0410 6e55 0000 0101 080a 8cf3 ac2b
+ 0x0020: 269c 3ab9 a568 7354 404c 0c00 f702 0000
+ 0x0030: f702 0000 84b5 9cbe 8cff ffff 0040 ff3e
+ 0x0040: 88cc 0910 0410 0594 0000 0101 080a 269c
+ 0x0050: 318b 8cf3 ac0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0060: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0070: 0e0e 0e0e 0004 0e0e 0e0e 0e0e 8e0e 0e0e
+ 0x0080: 0e0e 0e0e 0e0b 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0090: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00a0: 0e00 3e20 0a00 b60d 0000 2000 0000 84b5
+ 0x00b0: aee0 3083 8383 1b
+ Area address(es) TLV #1, length: 0
+ unknown TLV #18, length: 1
+ 0x0000: 83
+ Inter-Domain Information Type TLV #131, length: 131
+ Inter-Domain Information Type: Unknown (0x83)
+ 0x0000: 8383 8383 8383 834f 0060 0641 8fcc 0900
+ 0x0010: 2590 894f 6908 e912 0025 9089 4f69 0800
+ 0x0020: 4500 0034 9040 4001 4006 a516 cc09 370a
+ 0x0030: ccff ffff 7fbb da80 d5f3 5c05 1614 4a2d
+ 0x0040: 8010 0410 6e55 0000 0101 080a 8cf3 ac2b
+ 0x0050: 269c 30b9 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0060: 0e08 0e0e 0e0e 0e01 0e0e 0e0e 0e0e 110e
+ 0x0070: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0080: 0e0e
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ unknown TLV #172, length: 198
+ 0x0000: 2478 f620 70ac 2561 8ae3 3458 2d7a 4ea0
+ 0x0010: d056 a568 7354 180e 0e0e 0e0e 0e0e 0e0e
+ 0x0020: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0030: 0e0d f20e 0e0e 0e0e 0e0e 0e0e 0e04 0e0e
+ 0x0040: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0050: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0060: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0070: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e49 0e0e
+ 0x0080: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0d
+ 0x0090: f20e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00a0: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00b0: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00c0: 0e0e 0e0e 0e0e
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3612
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 5
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3676
+ unknown TLV #92, length: 92
+ 0x0000: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0010: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0020: 5c44 4444 4444 4444 4444 4444 4444 4444
+ 0x0030: 44b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0040: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0050: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ unknown TLV #183, length: 183
+ 0x0000: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0010: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0020: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0030: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0040: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0050: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0060: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0070: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0080: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0090: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x00a0: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x00b0: b7b7 b7b7 b7b7 b7
+ unknown TLV #183, length: 183
+ 0x0000: b7b7 b7b7 b7b7 b7b7 b7c0 b7b7 b7b7 b7b7
+ 0x0010: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0020: b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7 b7b7
+ 0x0030: b7b7 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0040: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0050: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0060: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0070: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0080: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0090: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x00a0: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x00b0: 5c5c 5c5c 5c5c 5c
+ unknown TLV #92, length: 92
+ 0x0000: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0010: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0020: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0030: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0040: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0050: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ unknown TLV #92, length: 92
+ 0x0000: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0010: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0020: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0030: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0040: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0050: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ unknown TLV #92, length: 92
+ 0x0000: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0010: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0020: 5c5c 715c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0030: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0040: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0050: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ unknown TLV #92, length: 92
+ 0x0000: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0010: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0020: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0030: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0040: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0050: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ unknown TLV #92, length: 92
+ 0x0000: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0010: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0020: 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c 5c5c
+ 0x0030: 5c5c 5c5c 5c5c 5c5c 5c10 0594 4510 0410
+ 0x0040: 6e55 0000 0101 080a 8cf3 ac2b 269c 3ab9
+ 0x0050: a568 7354 404c 0c00 f702 0000
+ unknown TLV #247, length: 2
+ 0x0000: 0000
+ IPv4 Interface address(es) TLV #132, length: 181
+ IPv4 interface address: 156.190.140.255
+ IPv4 interface address: 255.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.14.14
+ IPv4 interface address: 14.14.28.14
+ IPv4 interface address: 28.14.21.14
+ IPv4 interface address: 14.14.14.130
+ IPv4 interface address: 89.186.4.171
+ IPv4 interface address: 23.3.1.0
+ IPv4 interface address: 32.144.252.48
+ IPv4 interface address: 165.128.255.255
+ IPv4 interface address: 255.246.232.117
+ IPv4 interface address: 154.157.104.136
+ IPv4 interface address: 118.103.188.123
+ IPv4 interface address: 181.119.205.109
+ IPv4 interface address: 60.22.90.116
+ IPv4 interface address: 80.127.192.14
+ IPv4 interface address: 156.165.230.105
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 61197
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 13
+ LSP Buffersize: 244
+ unknown TLV #255, length: 0
+ unknown TLV #64, length: 6
+ 0x0000: 3e88 cc09 3650
+ unknown TLV #204, length: 9
+ 0x0000: 370a da80 01bb 0404 04
+ unknown TLV #11, length: 4
+ 0x0000: 2104 0404
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ unknown TLV #234, length: 4
+ 0x0000: 0404 0404
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ unknown TLV #0, length: 0
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 5
+ unknown TLV #13, length: 178
+ 0x0000: c4e4 f9cb 0ce2 cd2e 175a 0bf3 b492 01fa
+ 0x0010: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0020: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0030: 3a3a 3a3a 3a3a 3a3a 3a3a 3a3a 3a3a 3a3a
+ 0x0040: 3a3a 3a0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e28
+ 0x0050: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0060: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0070: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0080: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0090: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00a0: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x00b0: 0e0e
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ Partition DIS TLV #4, length: 4
+ unknown TLV #0, length: 13
+ 0x0000: b2c4 e4f9 cb0c e2cd 2e17 5a0b f3
+ unknown TLV #180, length: 146
+ 0x0000: 01fa 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0010: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0020: 0e0e 0e28 0e0e 0e0e 0e0e fb0d 0e0e 0e0e
+ 0x0030: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0040: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0050: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0060: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0070: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0080: 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e 0e0e
+ 0x0090: 0e0e
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ IPv4 Internal Reachability TLV #128, length: 0
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ LSP Buffersize TLV #14, length: 14
+ LSP Buffersize: 3598
+ unknown TLV #58, length: 58
+ 0x0000: 3a3a 3a3a 3a3a 3a3a 3a3a 3a3a 3a3a 3a3a
+ 0x0010: 3a3a 3a
+ packet exceeded snapshot (39) bytes
+EXIT CODE 00000100
--- /dev/null
+IP (tos 0x10, ttl 64, id 63177, offset 0, flags [none], proto unknown (240), length 168, bad cksum 418f (->80a5)!)
+ 204.9.54.80 > 204.9.51.132: ip-proto-240 148
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3da6 (->35a6)!)
+ 212.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0x4811), ack 1819218606, win 17918, options [nop,nop,TS val 941371903 ecr 1340592074], length 0
+84:b5:9c:be:30:48 Unknown SSAP 0x10 > 0c:c4:7a:08:e9:12 Unknown DSAP 0x44 Information, send seq 0, rcv seq 26, Flags [Command], length 52
+ 0x0000: 4510 0034 f5c8 4000 3e06 4504 cc09 3384 E..4..@.>.E...3.
+ 0x0010: cc09 3650 c39f 0016 49d1 c854 6c6f 1322 ..6P....I..Tlo."
+ 0x0020: 8010 0ffc 858b 0000 0101 080a 381c 3209 ............8.2.
+ 0x0030: 4fe7 cfd4 O...
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.54.80.55936 > 204.9.55.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x725a), ack 3589495407, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xcd5f), seq 3589495407:3589495754, ack 370436242, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 58f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 1819218606, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
+IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x85a1), ack 1819218722, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xfa86), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv197, Unknown PDU (100), length: 60
+ 0x0000: c564 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 37
+ -----encapsulated PDU-----|trunc|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 12
+ -----encapsulated PDU-----|trunc|trunc
+ [|RPKI-RTR]
+IP truncated-ip - 768 bytes missing! (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 820, bad cksum 3da6 (->3aa6)!)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], seq 0:768, ack 1, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 768
+IP (tos 0x6,ECT(0), ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->4524)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x85a1), ack 1, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x8d67), ack 1, win 1040, options [nop,nop,TS val 647770294 ecr 2364773722], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0x4ba9), seq 0:347, ack 4294959105, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 100|trunc
+ RPKI-RTRv115, Error Report PDU (10), length: 66|trunc
+ [|RPKI-RTR]
+EXIT CODE 00000100
--- /dev/null
+CFMv0 unknown (204), MD Level 0, length 168
+ First TLV offset 52
+ 0x0000: a300 0000 0080 0000 0000 0000 0000 0000
+ 0x0010: 0000 00aa 6873 54d7 060b 003c 0000 003c
+ 0x0020: d4c3 b2a1 0200 1a00 000b 003c 0000 003c
+ 0x0030: d4c3 b2a1 0200 1a00 0000 0000 3620 0a00
+ 0x0040: b600 0000 b600 0000 40b5 9cbe 3048 0cc4
+ 0x0050: ad37 1005 ffff 05cc 0934 9300 0000 0080
+ 0x0060: fffa 0000 0000 3200 0000 0000 00aa 6873
+ Port status TLV (0x02), length 26, Status: Unknown (0)
+ Unknown TLV (0x37), length 4101
+ 0x0000: 3710 05ff ff05 cc09 3493 0000 0000 80ff
+ 0x0010: fa00 0000 0032 0000 0000 0000 aa68 7354
+ 0x0020: d706 0b00 3c00 0000 3c00 0000 0080 0000
+ 0x0030: fffd 4d5f d9bd c709 30ac 8176 b36d cc11
+ 0x0040: 3abf 1291 f106 4ede 61f4 6297 afc4 39a4
+ 0x0050: 0db9 7a
+IP (tos 0x10, ttl 62, id 64806, offset 0, flags [DF], proto TCP (6), length 52)
+ 204.9.51.132.50079 > 204.9.54.80.22: Flags [.], cksum 0x8611 (incorrect -> 0xa678), ack 1819218606, win 4094, options [nop,nop,TS val 941371775 ecr 4294967242], length 0
+IP (tos 0x10, ttl 62, id 62920, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 4504 (->451a)!)
+ 204.9.51.132.50079 > 204.243.53.80.22: Flags [.], cksum 0x858b (incorrect -> 0x85a1), ack 1819218722, win 4092, options [nop,nop,TS val 941371913 ecr 1340592084], length 0
+IP (tos 0x0, ttl 64, id 63178, offset 0, flags [DF], proto TCP (6), length 52, bad cksum 3e8c (->438c)!)
+ 204.9.64.80.55936 > 204.9.40.10.443: Flags [.], cksum 0x0594 (incorrect -> 0x7767), ack 3587398274, win 1040, options [nop,nop,TS val 647770294 ecr 2364779354], length 0
+IP (tos 0x0, ttl 64, id 36752, offset 0, flags [DF], proto TCP (6), length 399, bad cksum a46b (->a474)!)
+ 204.0.55.10.323 > 204.9.54.80.55936: Flags [P.], cksum 0xc9b6 (incorrect -> 0xed9b), seq 3589495407:3589495754, ack 370428050, win 1040, options [nop,nop,TS val 2364757411 ecr 3084508609], length 347
+ RPKI-RTRv177, Unknown PDU (100), length: 60
+ 0x0000: b164 003c 0000 003c 0000 00ff ff1f 1b70
+ 0x0010: f857 ee68 4dfd 4d5f d9bd c709 30ac 8176
+ 0x0020: b36d cc11 3abf 1291 f106 4ede 61f4 6297
+ 0x0030: afc4 39a4 0db9 7aa5 6873 33e8
+ RPKI-RTRv65, Error Report PDU (10), length: 66
+ Error code: Unknown (66), Encapsulated PDU length: 80|trunc
+ [|RPKI-RTR]
+EXIT CODE 00000100
-00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 388: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000): CDPv2, ttl: 180s, checksum: 0x0bea (unverified), length 366
+00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 388: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 366: CDPv2, ttl: 180s, checksum: 0x0bea (unverified), length 366
Device-ID (0x01), value length: 2 bytes: 'S1'
Version String (0x05), value length: 190 bytes:
Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)
Management Addresses (0x16), value length: 13 bytes: IPv4 (1) 0.0.0.0
unknown field type (0x1a), value length: 12 bytes:
0x0000: 0000 0001 0000 0000 ffff ffff
-00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 392: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000): CDPv2, ttl: 180s, checksum: 0x971d (unverified), length 370
+00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 392: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 370: CDPv2, ttl: 180s, checksum: 0x971d (unverified), length 370
Device-ID (0x01), value length: 2 bytes: 'S2'
Version String (0x05), value length: 190 bytes:
Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)
PMD autoneg capability [Sym PAUSE for fdx, Asym and Sym PAUSE for fdx, 1000BASE-{X LX SX CX} fdx, 1000BASE-T hdx] (0x0036)
MAU type 100BASETX fdx (0x0010)
End TLV (0), length 0
-00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 388: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000): CDPv2, ttl: 180s, checksum: 0x0be9 (unverified), length 366
+00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 388: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 366: CDPv2, ttl: 180s, checksum: 0x0be9 (unverified), length 366
Device-ID (0x01), value length: 2 bytes: 'S1'
Version String (0x05), value length: 190 bytes:
Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)
Management Addresses (0x16), value length: 13 bytes: IPv4 (1) 0.0.0.0
unknown field type (0x1a), value length: 12 bytes:
0x0000: 0000 0001 0000 0000 ffff ffff
-00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 392: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000): CDPv2, ttl: 180s, checksum: 0x971c (unverified), length 370
+00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 392: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 370: CDPv2, ttl: 180s, checksum: 0x971c (unverified), length 370
Device-ID (0x01), value length: 2 bytes: 'S2'
Version String (0x05), value length: 190 bytes:
Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)
action type OUTPUT, len 8, port 1
data (60 octets), frame decoding below
67:68:00:00:00:00 > 61:62:63:64:65:66 Null Information, send seq 0, rcv seq 0, Flags [Command], length 46
+ 0x0000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 0x0010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
+ 0x0020: 0000 0000 0000 0000 0000 0000 0000 0112 ................
+ 0x0030: 0008 0000 0045 .....E
version 1.0, type BARRIER_REQUEST, length 8, xid 0x00000045
IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60)
10.0.0.81.56068 > 10.0.0.20.6633: Flags [P.], cksum 0xb6f1 (correct), seq 14734:14742, ack 4821, win 1035, options [nop,nop,TS val 3 ecr 47837403], length 8: OpenFlow
--- /dev/null
+/*
+ * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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, (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, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * 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.
+ */
+
+/*
+ * txtproto_print() derived from original code by Hannes Gredler
+ *
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <sys/stat.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "interface.h"
+
+int32_t thiszone; /* seconds offset from gmt to local time */
+
+/*
+ * Print out a null-terminated filename (or other ascii string).
+ * If ep is NULL, assume no truncation check is needed.
+ * Return true if truncated.
+ */
+int
+fn_print(netdissect_options *ndo,
+ register const u_char *s, register const u_char *ep)
+{
+ register int ret;
+ register u_char c;
+
+ ret = 1; /* assume truncated */
+ while (ep == NULL || s < ep) {
+ c = *s++;
+ if (c == '\0') {
+ ret = 0;
+ break;
+ }
+ if (!ND_ISASCII(c)) {
+ c = ND_TOASCII(c);
+ ND_PRINT((ndo, "M-"));
+ }
+ if (!ND_ISPRINT(c)) {
+ c ^= 0x40; /* DEL to ?, others to alpha */
+ ND_PRINT((ndo, "^"));
+ }
+ ND_PRINT((ndo, "%c", c));
+ }
+ return(ret);
+}
+
+/*
+ * Print out a counted filename (or other ascii string).
+ * If ep is NULL, assume no truncation check is needed.
+ * Return true if truncated.
+ */
+int
+fn_printn(netdissect_options *ndo,
+ register const u_char *s, register u_int n, register const u_char *ep)
+{
+ register u_char c;
+
+ while (n > 0 && (ep == NULL || s < ep)) {
+ n--;
+ c = *s++;
+ if (!ND_ISASCII(c)) {
+ c = ND_TOASCII(c);
+ ND_PRINT((ndo, "M-"));
+ }
+ if (!ND_ISPRINT(c)) {
+ c ^= 0x40; /* DEL to ?, others to alpha */
+ ND_PRINT((ndo, "^"));
+ }
+ ND_PRINT((ndo, "%c", c));
+ }
+ return (n == 0) ? 0 : 1;
+}
+
+/*
+ * Print out a null-padded filename (or other ascii string).
+ * If ep is NULL, assume no truncation check is needed.
+ * Return true if truncated.
+ */
+int
+fn_printzp(netdissect_options *ndo,
+ register const u_char *s, register u_int n,
+ register const u_char *ep)
+{
+ register int ret;
+ register u_char c;
+
+ ret = 1; /* assume truncated */
+ while (n > 0 && (ep == NULL || s < ep)) {
+ n--;
+ c = *s++;
+ if (c == '\0') {
+ ret = 0;
+ break;
+ }
+ if (!ND_ISASCII(c)) {
+ c = ND_TOASCII(c);
+ ND_PRINT((ndo, "M-"));
+ }
+ if (!ND_ISPRINT(c)) {
+ c ^= 0x40; /* DEL to ?, others to alpha */
+ ND_PRINT((ndo, "^"));
+ }
+ ND_PRINT((ndo, "%c", c));
+ }
+ return (n == 0) ? 0 : ret;
+}
+
+/*
+ * Format the timestamp
+ */
+static char *
+ts_format(netdissect_options *ndo
+#ifndef HAVE_PCAP_SET_TSTAMP_PRECISION
+_U_
+#endif
+, int sec, int usec)
+{
+ static char buf[sizeof("00:00:00.000000000")];
+ const char *format;
+
+#ifdef HAVE_PCAP_SET_TSTAMP_PRECISION
+ switch (ndo->ndo_tstamp_precision) {
+
+ case PCAP_TSTAMP_PRECISION_MICRO:
+ format = "%02d:%02d:%02d.%06u";
+ break;
+
+ case PCAP_TSTAMP_PRECISION_NANO:
+ format = "%02d:%02d:%02d.%09u";
+ break;
+
+ default:
+ format = "%02d:%02d:%02d.{unknown precision}";
+ break;
+ }
+#else
+ format = "%02d:%02d:%02d.%06u";
+#endif
+
+ snprintf(buf, sizeof(buf), format,
+ sec / 3600, (sec % 3600) / 60, sec % 60, usec);
+
+ return buf;
+}
+
+/*
+ * Print the timestamp
+ */
+void
+ts_print(netdissect_options *ndo,
+ register const struct timeval *tvp)
+{
+ register int s;
+ struct tm *tm;
+ time_t Time;
+ static unsigned b_sec;
+ static unsigned b_usec;
+ int d_usec;
+ int d_sec;
+
+ switch (ndo->ndo_tflag) {
+
+ case 0: /* Default */
+ s = (tvp->tv_sec + thiszone) % 86400;
+ ND_PRINT((ndo, "%s ", ts_format(ndo, s, tvp->tv_usec)));
+ break;
+
+ case 1: /* No time stamp */
+ break;
+
+ case 2: /* Unix timeval style */
+ ND_PRINT((ndo, "%u.%06u ",
+ (unsigned)tvp->tv_sec,
+ (unsigned)tvp->tv_usec));
+ break;
+
+ case 3: /* Microseconds since previous packet */
+ case 5: /* Microseconds since first packet */
+ if (b_sec == 0) {
+ /* init timestamp for first packet */
+ b_usec = tvp->tv_usec;
+ b_sec = tvp->tv_sec;
+ }
+
+ d_usec = tvp->tv_usec - b_usec;
+ d_sec = tvp->tv_sec - b_sec;
+
+ while (d_usec < 0) {
+ d_usec += 1000000;
+ d_sec--;
+ }
+
+ ND_PRINT((ndo, "%s ", ts_format(ndo, d_sec, d_usec)));
+
+ if (ndo->ndo_tflag == 3) { /* set timestamp for last packet */
+ b_sec = tvp->tv_sec;
+ b_usec = tvp->tv_usec;
+ }
+ break;
+
+ case 4: /* Default + Date*/
+ s = (tvp->tv_sec + thiszone) % 86400;
+ Time = (tvp->tv_sec + thiszone) - s;
+ tm = gmtime (&Time);
+ if (!tm)
+ ND_PRINT((ndo, "Date fail "));
+ else
+ ND_PRINT((ndo, "%04d-%02d-%02d %s ",
+ tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
+ ts_format(ndo, s, tvp->tv_usec)));
+ break;
+ }
+}
+
+/*
+ * Print a relative number of seconds (e.g. hold time, prune timer)
+ * in the form 5m1s. This does no truncation, so 32230861 seconds
+ * is represented as 1y1w1d1h1m1s.
+ */
+void
+relts_print(netdissect_options *ndo,
+ int secs)
+{
+ static const char *lengths[] = {"y", "w", "d", "h", "m", "s"};
+ static const int seconds[] = {31536000, 604800, 86400, 3600, 60, 1};
+ const char **l = lengths;
+ const int *s = seconds;
+
+ if (secs == 0) {
+ ND_PRINT((ndo, "0s"));
+ return;
+ }
+ if (secs < 0) {
+ ND_PRINT((ndo, "-"));
+ secs = -secs;
+ }
+ while (secs > 0) {
+ if (secs >= *s) {
+ ND_PRINT((ndo, "%d%s", secs / *s, *l));
+ secs -= (secs / *s) * *s;
+ }
+ s++;
+ l++;
+ }
+}
+
+/*
+ * this is a generic routine for printing unknown data;
+ * we pass on the linefeed plus indentation string to
+ * get a proper output - returns 0 on error
+ */
+
+int
+print_unknown_data(netdissect_options *ndo, const u_char *cp,const char *ident,int len)
+{
+ if (len < 0) {
+ ND_PRINT((ndo,"%sDissector error: print_unknown_data called with negative length",
+ ident));
+ return(0);
+ }
+ if (ndo->ndo_snapend - cp < len)
+ len = ndo->ndo_snapend - cp;
+ if (len < 0) {
+ ND_PRINT((ndo,"%sDissector error: print_unknown_data called with pointer past end of packet",
+ ident));
+ return(0);
+ }
+ hex_print(ndo, ident,cp,len);
+ return(1); /* everything is ok */
+}
+
+/*
+ * Convert a token value to a string; use "fmt" if not found.
+ */
+const char *
+tok2strbuf(register const struct tok *lp, register const char *fmt,
+ register u_int v, char *buf, size_t bufsize)
+{
+ if (lp != NULL) {
+ while (lp->s != NULL) {
+ if (lp->v == v)
+ return (lp->s);
+ ++lp;
+ }
+ }
+ if (fmt == NULL)
+ fmt = "#%d";
+
+ (void)snprintf(buf, bufsize, fmt, v);
+ return (const char *)buf;
+}
+
+/*
+ * Convert a token value to a string; use "fmt" if not found.
+ */
+const char *
+tok2str(register const struct tok *lp, register const char *fmt,
+ register u_int v)
+{
+ static char buf[4][128];
+ static int idx = 0;
+ char *ret;
+
+ ret = buf[idx];
+ idx = (idx+1) & 3;
+ return tok2strbuf(lp, fmt, v, ret, sizeof(buf[0]));
+}
+
+/*
+ * Convert a bit token value to a string; use "fmt" if not found.
+ * this is useful for parsing bitfields, the output strings are seperated
+ * if the s field is positive.
+ */
+static char *
+bittok2str_internal(register const struct tok *lp, register const char *fmt,
+ register u_int v, const char *sep)
+{
+ static char buf[256]; /* our stringbuffer */
+ int buflen=0;
+ register u_int rotbit; /* this is the bit we rotate through all bitpositions */
+ register u_int tokval;
+ const char * sepstr = "";
+
+ while (lp != NULL && lp->s != NULL) {
+ tokval=lp->v; /* load our first value */
+ rotbit=1;
+ while (rotbit != 0) {
+ /*
+ * lets AND the rotating bit with our token value
+ * and see if we have got a match
+ */
+ if (tokval == (v&rotbit)) {
+ /* ok we have found something */
+ buflen+=snprintf(buf+buflen, sizeof(buf)-buflen, "%s%s",
+ sepstr, lp->s);
+ sepstr = sep;
+ break;
+ }
+ rotbit=rotbit<<1; /* no match - lets shift and try again */
+ }
+ lp++;
+ }
+
+ if (buflen == 0)
+ /* bummer - lets print the "unknown" message as advised in the fmt string if we got one */
+ (void)snprintf(buf, sizeof(buf), fmt == NULL ? "#%08x" : fmt, v);
+ return (buf);
+}
+
+/*
+ * Convert a bit token value to a string; use "fmt" if not found.
+ * this is useful for parsing bitfields, the output strings are not seperated.
+ */
+char *
+bittok2str_nosep(register const struct tok *lp, register const char *fmt,
+ register u_int v)
+{
+ return (bittok2str_internal(lp, fmt, v, ""));
+}
+
+/*
+ * Convert a bit token value to a string; use "fmt" if not found.
+ * this is useful for parsing bitfields, the output strings are comma seperated.
+ */
+char *
+bittok2str(register const struct tok *lp, register const char *fmt,
+ register u_int v)
+{
+ return (bittok2str_internal(lp, fmt, v, ", "));
+}
+
+/*
+ * Convert a value to a string using an array; the macro
+ * tok2strary() in <interface.h> is the public interface to
+ * this function and ensures that the second argument is
+ * correct for bounds-checking.
+ */
+const char *
+tok2strary_internal(register const char **lp, int n, register const char *fmt,
+ register int v)
+{
+ static char buf[128];
+
+ if (v >= 0 && v < n && lp[v] != NULL)
+ return lp[v];
+ if (fmt == NULL)
+ fmt = "#%d";
+ (void)snprintf(buf, sizeof(buf), fmt, v);
+ return (buf);
+}
+
+/*
+ * Convert a 32-bit netmask to prefixlen if possible
+ * the function returns the prefix-len; if plen == -1
+ * then conversion was not possible;
+ */
+
+int
+mask2plen(uint32_t mask)
+{
+ uint32_t bitmasks[33] = {
+ 0x00000000,
+ 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000,
+ 0xf8000000, 0xfc000000, 0xfe000000, 0xff000000,
+ 0xff800000, 0xffc00000, 0xffe00000, 0xfff00000,
+ 0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000,
+ 0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000,
+ 0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00,
+ 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
+ 0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff
+ };
+ int prefix_len = 32;
+
+ /* let's see if we can transform the mask into a prefixlen */
+ while (prefix_len >= 0) {
+ if (bitmasks[prefix_len] == mask)
+ break;
+ prefix_len--;
+ }
+ return (prefix_len);
+}
+
+#ifdef INET6
+int
+mask62plen(const u_char *mask)
+{
+ u_char bitmasks[9] = {
+ 0x00,
+ 0x80, 0xc0, 0xe0, 0xf0,
+ 0xf8, 0xfc, 0xfe, 0xff
+ };
+ int byte;
+ int cidr_len = 0;
+
+ for (byte = 0; byte < 16; byte++) {
+ u_int bits;
+
+ for (bits = 0; bits < (sizeof (bitmasks) / sizeof (bitmasks[0])); bits++) {
+ if (mask[byte] == bitmasks[bits]) {
+ cidr_len += bits;
+ break;
+ }
+ }
+
+ if (mask[byte] != 0xff)
+ break;
+ }
+ return (cidr_len);
+}
+#endif /* INET6 */
+
+/*
+ * Routine to print out information for text-based protocols such as FTP,
+ * HTTP, SMTP, RTSP, SIP, ....
+ */
+#define MAX_TOKEN 128
+
+/*
+ * Fetch a token from a packet, starting at the specified index,
+ * and return the length of the token.
+ *
+ * Returns 0 on error; yes, this is indistinguishable from an empty
+ * token, but an "empty token" isn't a valid token - it just means
+ * either a space character at the beginning of the line (this
+ * includes a blank line) or no more tokens remaining on the line.
+ */
+static int
+fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len,
+ u_char *tbuf, size_t tbuflen)
+{
+ size_t toklen = 0;
+
+ for (; idx < len; idx++) {
+ if (!ND_TTEST(*(pptr + idx))) {
+ /* ran past end of captured data */
+ return (0);
+ }
+ if (!isascii(*(pptr + idx))) {
+ /* not an ASCII character */
+ return (0);
+ }
+ if (isspace(*(pptr + idx))) {
+ /* end of token */
+ break;
+ }
+ if (!isprint(*(pptr + idx))) {
+ /* not part of a command token or response code */
+ return (0);
+ }
+ if (toklen + 2 > tbuflen) {
+ /* no room for this character and terminating '\0' */
+ return (0);
+ }
+ tbuf[toklen] = *(pptr + idx);
+ toklen++;
+ }
+ if (toklen == 0) {
+ /* no token */
+ return (0);
+ }
+ tbuf[toklen] = '\0';
+
+ /*
+ * Skip past any white space after the token, until we see
+ * an end-of-line (CR or LF).
+ */
+ for (; idx < len; idx++) {
+ if (!ND_TTEST(*(pptr + idx))) {
+ /* ran past end of captured data */
+ break;
+ }
+ if (*(pptr + idx) == '\r' || *(pptr + idx) == '\n') {
+ /* end of line */
+ break;
+ }
+ if (!isascii(*(pptr + idx)) || !isprint(*(pptr + idx))) {
+ /* not a printable ASCII character */
+ break;
+ }
+ if (!isspace(*(pptr + idx))) {
+ /* beginning of next token */
+ break;
+ }
+ }
+ return (idx);
+}
+
+/*
+ * Scan a buffer looking for a line ending - LF or CR-LF.
+ * Return the index of the character after the line ending or 0 if
+ * we encounter a non-ASCII or non-printable character or don't find
+ * the line ending.
+ */
+static u_int
+print_txt_line(netdissect_options *ndo, const char *protoname,
+ const char *prefix, const u_char *pptr, u_int idx, u_int len)
+{
+ u_int startidx;
+ u_int linelen;
+
+ startidx = idx;
+ while (idx < len) {
+ ND_TCHECK(*(pptr+idx));
+ if (*(pptr+idx) == '\n') {
+ /*
+ * LF without CR; end of line.
+ * Skip the LF and print the line, with the
+ * exception of the LF.
+ */
+ linelen = idx - startidx;
+ idx++;
+ goto print;
+ } else if (*(pptr+idx) == '\r') {
+ /* CR - any LF? */
+ if ((idx+1) >= len) {
+ /* not in this packet */
+ return (0);
+ }
+ ND_TCHECK(*(pptr+idx+1));
+ if (*(pptr+idx+1) == '\n') {
+ /*
+ * CR-LF; end of line.
+ * Skip the CR-LF and print the line, with
+ * the exception of the CR-LF.
+ */
+ linelen = idx - startidx;
+ idx += 2;
+ goto print;
+ }
+
+ /*
+ * CR followed by something else; treat this
+ * as if it were binary data, and don't print
+ * it.
+ */
+ return (0);
+ } else if (!isascii(*(pptr+idx)) ||
+ (!isprint(*(pptr+idx)) && *(pptr+idx) != '\t')) {
+ /*
+ * Not a printable ASCII character and not a tab;
+ * treat this as if it were binary data, and
+ * don't print it.
+ */
+ return (0);
+ }
+ idx++;
+ }
+
+ /*
+ * All printable ASCII, but no line ending after that point
+ * in the buffer; treat this as if it were truncated.
+ */
+trunc:
+ linelen = idx - startidx;
+ ND_PRINT((ndo, "%s%.*s[!%s]", prefix, (int)linelen, pptr + startidx,
+ protoname));
+ return (0);
+
+print:
+ ND_PRINT((ndo, "%s%.*s", prefix, (int)linelen, pptr + startidx));
+ return (idx);
+}
+
+void
+txtproto_print(netdissect_options *ndo, const u_char *pptr, u_int len,
+ const char *protoname, const char **cmds, u_int flags)
+{
+ u_int idx, eol;
+ u_char token[MAX_TOKEN+1];
+ const char *cmd;
+ int is_reqresp = 0;
+ const char *pnp;
+
+ if (cmds != NULL) {
+ /*
+ * This protocol has more than just request and
+ * response lines; see whether this looks like a
+ * request or response.
+ */
+ idx = fetch_token(ndo, pptr, 0, len, token, sizeof(token));
+ if (idx != 0) {
+ /* Is this a valid request name? */
+ while ((cmd = *cmds++) != NULL) {
+ if (strcasecmp((const char *)token, cmd) == 0) {
+ /* Yes. */
+ is_reqresp = 1;
+ break;
+ }
+ }
+
+ /*
+ * No - is this a valid response code (3 digits)?
+ *
+ * Is this token the response code, or is the next
+ * token the response code?
+ */
+ if (flags & RESP_CODE_SECOND_TOKEN) {
+ /*
+ * Next token - get it.
+ */
+ idx = fetch_token(ndo, pptr, idx, len, token,
+ sizeof(token));
+ }
+ if (idx != 0) {
+ if (isdigit(token[0]) && isdigit(token[1]) &&
+ isdigit(token[2]) && token[3] == '\0') {
+ /* Yes. */
+ is_reqresp = 1;
+ }
+ }
+ }
+ } else {
+ /*
+ * This protocol has only request and response lines
+ * (e.g., FTP, where all the data goes over a
+ * different connection); assume the payload is
+ * a request or response.
+ */
+ is_reqresp = 1;
+ }
+
+ /* Capitalize the protocol name */
+ for (pnp = protoname; *pnp != '\0'; pnp++)
+ ND_PRINT((ndo, "%c", toupper(*pnp)));
+
+ if (is_reqresp) {
+ /*
+ * In non-verbose mode, just print the protocol, followed
+ * by the first line as the request or response info.
+ *
+ * In verbose mode, print lines as text until we run out
+ * of characters or see something that's not a
+ * printable-ASCII line.
+ */
+ if (ndo->ndo_vflag) {
+ /*
+ * We're going to print all the text lines in the
+ * request or response; just print the length
+ * on the first line of the output.
+ */
+ ND_PRINT((ndo, ", length: %u", len));
+ for (idx = 0;
+ idx < len && (eol = print_txt_line(ndo, protoname, "\n\t", pptr, idx, len)) != 0;
+ idx = eol)
+ ;
+ } else {
+ /*
+ * Just print the first text line.
+ */
+ print_txt_line(ndo, protoname, ": ", pptr, 0, len);
+ }
+ }
+}
+
+void
+safeputs(netdissect_options *ndo,
+ const u_char *s, const u_int maxlen)
+{
+ u_int idx = 0;
+
+ while (*s && idx < maxlen) {
+ safeputchar(ndo, *s);
+ idx++;
+ s++;
+ }
+}
+
+void
+safeputchar(netdissect_options *ndo,
+ const u_char c)
+{
+ ND_PRINT((ndo, (c < 0x80 && ND_ISPRINT(c)) ? "%c" : "\\0x%02x", c));
+}
+
+#ifdef LBL_ALIGN
+/*
+ * Some compilers try to optimize memcpy(), using the alignment constraint
+ * on the argument pointer type. by using this function, we try to avoid the
+ * optimization.
+ */
+void
+unaligned_memcpy(void *p, const void *q, size_t l)
+{
+ memcpy(p, q, l);
+}
+
+/* As with memcpy(), so with memcmp(). */
+int
+unaligned_memcmp(const void *p, const void *q, size_t l)
+{
+ return (memcmp(p, q, l));
+}
+#endif
+
* FOR A PARTICULAR PURPOSE.
*/
-#define NETDISSECT_REWORKED
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "interface.h"
-/*
- * Print out a null-terminated filename (or other ascii string).
- * If ep is NULL, assume no truncation check is needed.
- * Return true if truncated.
- */
-int
-fn_print(netdissect_options *ndo,
- register const u_char *s, register const u_char *ep)
-{
- register int ret;
- register u_char c;
-
- ret = 1; /* assume truncated */
- while (ep == NULL || s < ep) {
- c = *s++;
- if (c == '\0') {
- ret = 0;
- break;
- }
- if (!ND_ISASCII(c)) {
- c = ND_TOASCII(c);
- ND_PRINT((ndo, "M-"));
- }
- if (!ND_ISPRINT(c)) {
- c ^= 0x40; /* DEL to ?, others to alpha */
- ND_PRINT((ndo, "^"));
- }
- ND_PRINT((ndo, "%c", c));
- }
- return(ret);
-}
-
-/*
- * Print out a counted filename (or other ascii string).
- * If ep is NULL, assume no truncation check is needed.
- * Return true if truncated.
- */
-int
-fn_printn(netdissect_options *ndo,
- register const u_char *s, register u_int n, register const u_char *ep)
-{
- register u_char c;
-
- while (n > 0 && (ep == NULL || s < ep)) {
- n--;
- c = *s++;
- if (!ND_ISASCII(c)) {
- c = ND_TOASCII(c);
- ND_PRINT((ndo, "M-"));
- }
- if (!ND_ISPRINT(c)) {
- c ^= 0x40; /* DEL to ?, others to alpha */
- ND_PRINT((ndo, "^"));
- }
- ND_PRINT((ndo, "%c", c));
- }
- return (n == 0) ? 0 : 1;
-}
-
-/*
- * Print out a null-padded filename (or other ascii string).
- * If ep is NULL, assume no truncation check is needed.
- * Return true if truncated.
- */
-int
-fn_printzp(netdissect_options *ndo,
- register const u_char *s, register u_int n,
- register const u_char *ep)
-{
- register int ret;
- register u_char c;
-
- ret = 1; /* assume truncated */
- while (n > 0 && (ep == NULL || s < ep)) {
- n--;
- c = *s++;
- if (c == '\0') {
- ret = 0;
- break;
- }
- if (!ND_ISASCII(c)) {
- c = ND_TOASCII(c);
- ND_PRINT((ndo, "M-"));
- }
- if (!ND_ISPRINT(c)) {
- c ^= 0x40; /* DEL to ?, others to alpha */
- ND_PRINT((ndo, "^"));
- }
- ND_PRINT((ndo, "%c", c));
- }
- return (n == 0) ? 0 : ret;
-}
-
-/*
- * Format the timestamp
- */
-static char *
-ts_format(netdissect_options *ndo
-#ifndef HAVE_PCAP_SET_TSTAMP_PRECISION
-_U_
-#endif
-, int sec, int usec)
-{
- static char buf[sizeof("00:00:00.000000000")];
- const char *format;
-
-#ifdef HAVE_PCAP_SET_TSTAMP_PRECISION
- switch (ndo->ndo_tstamp_precision) {
-
- case PCAP_TSTAMP_PRECISION_MICRO:
- format = "%02d:%02d:%02d.%06u";
- break;
-
- case PCAP_TSTAMP_PRECISION_NANO:
- format = "%02d:%02d:%02d.%09u";
- break;
-
- default:
- format = "%02d:%02d:%02d.{unknown precision}";
- break;
- }
-#else
- format = "%02d:%02d:%02d.%06u";
-#endif
-
- snprintf(buf, sizeof(buf), format,
- sec / 3600, (sec % 3600) / 60, sec % 60, usec);
-
- return buf;
-}
-
-/*
- * Print the timestamp
- */
-void
-ts_print(netdissect_options *ndo,
- register const struct timeval *tvp)
-{
- register int s;
- struct tm *tm;
- time_t Time;
- static unsigned b_sec;
- static unsigned b_usec;
- int d_usec;
- int d_sec;
-
- switch (ndo->ndo_tflag) {
-
- case 0: /* Default */
- s = (tvp->tv_sec + thiszone) % 86400;
- ND_PRINT((ndo, "%s ", ts_format(ndo, s, tvp->tv_usec)));
- break;
-
- case 1: /* No time stamp */
- break;
-
- case 2: /* Unix timeval style */
- ND_PRINT((ndo, "%u.%06u ",
- (unsigned)tvp->tv_sec,
- (unsigned)tvp->tv_usec));
- break;
-
- case 3: /* Microseconds since previous packet */
- case 5: /* Microseconds since first packet */
- if (b_sec == 0) {
- /* init timestamp for first packet */
- b_usec = tvp->tv_usec;
- b_sec = tvp->tv_sec;
- }
-
- d_usec = tvp->tv_usec - b_usec;
- d_sec = tvp->tv_sec - b_sec;
-
- while (d_usec < 0) {
- d_usec += 1000000;
- d_sec--;
- }
-
- ND_PRINT((ndo, "%s ", ts_format(ndo, d_sec, d_usec)));
-
- if (ndo->ndo_tflag == 3) { /* set timestamp for last packet */
- b_sec = tvp->tv_sec;
- b_usec = tvp->tv_usec;
- }
- break;
-
- case 4: /* Default + Date*/
- s = (tvp->tv_sec + thiszone) % 86400;
- Time = (tvp->tv_sec + thiszone) - s;
- tm = gmtime (&Time);
- if (!tm)
- ND_PRINT((ndo, "Date fail "));
- else
- ND_PRINT((ndo, "%04d-%02d-%02d %s ",
- tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
- ts_format(ndo, s, tvp->tv_usec)));
- break;
- }
-}
-
-/*
- * Print a relative number of seconds (e.g. hold time, prune timer)
- * in the form 5m1s. This does no truncation, so 32230861 seconds
- * is represented as 1y1w1d1h1m1s.
- */
-void
-relts_print(netdissect_options *ndo,
- int secs)
-{
- static const char *lengths[] = {"y", "w", "d", "h", "m", "s"};
- static const int seconds[] = {31536000, 604800, 86400, 3600, 60, 1};
- const char **l = lengths;
- const int *s = seconds;
-
- if (secs == 0) {
- ND_PRINT((ndo, "0s"));
- return;
- }
- if (secs < 0) {
- ND_PRINT((ndo, "-"));
- secs = -secs;
- }
- while (secs > 0) {
- if (secs >= *s) {
- ND_PRINT((ndo, "%d%s", secs / *s, *l));
- secs -= (secs / *s) * *s;
- }
- s++;
- l++;
- }
-}
-
-/*
- * this is a generic routine for printing unknown data;
- * we pass on the linefeed plus indentation string to
- * get a proper output - returns 0 on error
- */
-
-int
-print_unknown_data(netdissect_options *ndo, const u_char *cp,const char *ident,int len)
-{
- if (len < 0) {
- ND_PRINT((ndo,"%sDissector error: print_unknown_data called with negative length",
- ident));
- return(0);
- }
- if (ndo->ndo_snapend - cp < len)
- len = ndo->ndo_snapend - cp;
- if (len < 0) {
- ND_PRINT((ndo,"%sDissector error: print_unknown_data called with pointer past end of packet",
- ident));
- return(0);
- }
- hex_print(ndo, ident,cp,len);
- return(1); /* everything is ok */
-}
-
-/*
- * Convert a token value to a string; use "fmt" if not found.
- */
-const char *
-tok2strbuf(register const struct tok *lp, register const char *fmt,
- register u_int v, char *buf, size_t bufsize)
-{
- if (lp != NULL) {
- while (lp->s != NULL) {
- if (lp->v == v)
- return (lp->s);
- ++lp;
- }
- }
- if (fmt == NULL)
- fmt = "#%d";
-
- (void)snprintf(buf, bufsize, fmt, v);
- return (const char *)buf;
-}
-
-/*
- * Convert a token value to a string; use "fmt" if not found.
- */
-const char *
-tok2str(register const struct tok *lp, register const char *fmt,
- register int v)
-{
- static char buf[4][128];
- static int idx = 0;
- char *ret;
-
- ret = buf[idx];
- idx = (idx+1) & 3;
- return tok2strbuf(lp, fmt, v, ret, sizeof(buf[0]));
-}
-
-/*
- * Convert a bit token value to a string; use "fmt" if not found.
- * this is useful for parsing bitfields, the output strings are seperated
- * if the s field is positive.
- */
-static char *
-bittok2str_internal(register const struct tok *lp, register const char *fmt,
- register int v, register int sep)
-{
- static char buf[256]; /* our stringbuffer */
- int buflen=0;
- register int rotbit; /* this is the bit we rotate through all bitpositions */
- register int tokval;
- const char * sepstr = "";
-
- while (lp != NULL && lp->s != NULL) {
- tokval=lp->v; /* load our first value */
- rotbit=1;
- while (rotbit != 0) {
- /*
- * lets AND the rotating bit with our token value
- * and see if we have got a match
- */
- if (tokval == (v&rotbit)) {
- /* ok we have found something */
- buflen+=snprintf(buf+buflen, sizeof(buf)-buflen, "%s%s",
- sepstr, lp->s);
- sepstr = sep ? ", " : "";
- break;
- }
- rotbit=rotbit<<1; /* no match - lets shift and try again */
- }
- lp++;
- }
-
- if (buflen == 0)
- /* bummer - lets print the "unknown" message as advised in the fmt string if we got one */
- (void)snprintf(buf, sizeof(buf), fmt == NULL ? "#%d" : fmt, v);
- return (buf);
-}
-
-/*
- * Convert a bit token value to a string; use "fmt" if not found.
- * this is useful for parsing bitfields, the output strings are not seperated.
- */
-char *
-bittok2str_nosep(register const struct tok *lp, register const char *fmt,
- register int v)
-{
- return (bittok2str_internal(lp, fmt, v, 0));
-}
-
-/*
- * Convert a bit token value to a string; use "fmt" if not found.
- * this is useful for parsing bitfields, the output strings are comma seperated.
- */
-char *
-bittok2str(register const struct tok *lp, register const char *fmt,
- register int v)
-{
- return (bittok2str_internal(lp, fmt, v, 1));
-}
-
-/*
- * Convert a value to a string using an array; the macro
- * tok2strary() in <interface.h> is the public interface to
- * this function and ensures that the second argument is
- * correct for bounds-checking.
- */
-const char *
-tok2strary_internal(register const char **lp, int n, register const char *fmt,
- register int v)
-{
- static char buf[128];
-
- if (v >= 0 && v < n && lp[v] != NULL)
- return lp[v];
- if (fmt == NULL)
- fmt = "#%d";
- (void)snprintf(buf, sizeof(buf), fmt, v);
- return (buf);
-}
-
-/*
- * Convert a 32-bit netmask to prefixlen if possible
- * the function returns the prefix-len; if plen == -1
- * then conversion was not possible;
- */
-
-int
-mask2plen(uint32_t mask)
-{
- uint32_t bitmasks[33] = {
- 0x00000000,
- 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000,
- 0xf8000000, 0xfc000000, 0xfe000000, 0xff000000,
- 0xff800000, 0xffc00000, 0xffe00000, 0xfff00000,
- 0xfff80000, 0xfffc0000, 0xfffe0000, 0xffff0000,
- 0xffff8000, 0xffffc000, 0xffffe000, 0xfffff000,
- 0xfffff800, 0xfffffc00, 0xfffffe00, 0xffffff00,
- 0xffffff80, 0xffffffc0, 0xffffffe0, 0xfffffff0,
- 0xfffffff8, 0xfffffffc, 0xfffffffe, 0xffffffff
- };
- int prefix_len = 32;
-
- /* let's see if we can transform the mask into a prefixlen */
- while (prefix_len >= 0) {
- if (bitmasks[prefix_len] == mask)
- break;
- prefix_len--;
- }
- return (prefix_len);
-}
-
-#ifdef INET6
-int
-mask62plen(const u_char *mask)
-{
- u_char bitmasks[9] = {
- 0x00,
- 0x80, 0xc0, 0xe0, 0xf0,
- 0xf8, 0xfc, 0xfe, 0xff
- };
- int byte;
- int cidr_len = 0;
-
- for (byte = 0; byte < 16; byte++) {
- u_int bits;
-
- for (bits = 0; bits < (sizeof (bitmasks) / sizeof (bitmasks[0])); bits++) {
- if (mask[byte] == bitmasks[bits]) {
- cidr_len += bits;
- break;
- }
- }
-
- if (mask[byte] != 0xff)
- break;
- }
- return (cidr_len);
-}
-#endif /* INET6 */
-
-/*
- * Routine to print out information for text-based protocols such as FTP,
- * HTTP, SMTP, RTSP, SIP, ....
- */
-#define MAX_TOKEN 128
-
-/*
- * Fetch a token from a packet, starting at the specified index,
- * and return the length of the token.
- *
- * Returns 0 on error; yes, this is indistinguishable from an empty
- * token, but an "empty token" isn't a valid token - it just means
- * either a space character at the beginning of the line (this
- * includes a blank line) or no more tokens remaining on the line.
- */
-static int
-fetch_token(netdissect_options *ndo, const u_char *pptr, u_int idx, u_int len,
- u_char *tbuf, size_t tbuflen)
-{
- size_t toklen = 0;
-
- for (; idx < len; idx++) {
- if (!ND_TTEST(*(pptr + idx))) {
- /* ran past end of captured data */
- return (0);
- }
- if (!isascii(*(pptr + idx))) {
- /* not an ASCII character */
- return (0);
- }
- if (isspace(*(pptr + idx))) {
- /* end of token */
- break;
- }
- if (!isprint(*(pptr + idx))) {
- /* not part of a command token or response code */
- return (0);
- }
- if (toklen + 2 > tbuflen) {
- /* no room for this character and terminating '\0' */
- return (0);
- }
- tbuf[toklen] = *(pptr + idx);
- toklen++;
- }
- if (toklen == 0) {
- /* no token */
- return (0);
- }
- tbuf[toklen] = '\0';
-
- /*
- * Skip past any white space after the token, until we see
- * an end-of-line (CR or LF).
- */
- for (; idx < len; idx++) {
- if (!ND_TTEST(*(pptr + idx))) {
- /* ran past end of captured data */
- break;
- }
- if (*(pptr + idx) == '\r' || *(pptr + idx) == '\n') {
- /* end of line */
- break;
- }
- if (!isascii(*(pptr + idx)) || !isprint(*(pptr + idx))) {
- /* not a printable ASCII character */
- break;
- }
- if (!isspace(*(pptr + idx))) {
- /* beginning of next token */
- break;
- }
- }
- return (idx);
-}
-
-/*
- * Scan a buffer looking for a line ending - LF or CR-LF.
- * Return the index of the character after the line ending or 0 if
- * we encounter a non-ASCII or non-printable character or don't find
- * the line ending.
- */
-static u_int
-print_txt_line(netdissect_options *ndo, const char *protoname,
- const char *prefix, const u_char *pptr, u_int idx, u_int len)
-{
- u_int startidx;
- u_int linelen;
-
- startidx = idx;
- while (idx < len) {
- ND_TCHECK(*(pptr+idx));
- if (*(pptr+idx) == '\n') {
- /*
- * LF without CR; end of line.
- * Skip the LF and print the line, with the
- * exception of the LF.
- */
- linelen = idx - startidx;
- idx++;
- goto print;
- } else if (*(pptr+idx) == '\r') {
- /* CR - any LF? */
- if ((idx+1) >= len) {
- /* not in this packet */
- return (0);
- }
- ND_TCHECK(*(pptr+idx+1));
- if (*(pptr+idx+1) == '\n') {
- /*
- * CR-LF; end of line.
- * Skip the CR-LF and print the line, with
- * the exception of the CR-LF.
- */
- linelen = idx - startidx;
- idx += 2;
- goto print;
- }
-
- /*
- * CR followed by something else; treat this
- * as if it were binary data, and don't print
- * it.
- */
- return (0);
- } else if (!isascii(*(pptr+idx)) ||
- (!isprint(*(pptr+idx)) && *(pptr+idx) != '\t')) {
- /*
- * Not a printable ASCII character and not a tab;
- * treat this as if it were binary data, and
- * don't print it.
- */
- return (0);
- }
- idx++;
- }
-
- /*
- * All printable ASCII, but no line ending after that point
- * in the buffer; treat this as if it were truncated.
- */
-trunc:
- linelen = idx - startidx;
- ND_PRINT((ndo, "%s%.*s[!%s]", prefix, (int)linelen, pptr + startidx,
- protoname));
- return (0);
-
-print:
- ND_PRINT((ndo, "%s%.*s", prefix, (int)linelen, pptr + startidx));
- return (idx);
-}
-
-void
-txtproto_print(netdissect_options *ndo, const u_char *pptr, u_int len,
- const char *protoname, const char **cmds, u_int flags)
-{
- u_int idx, eol;
- u_char token[MAX_TOKEN+1];
- const char *cmd;
- int is_reqresp = 0;
- const char *pnp;
-
- if (cmds != NULL) {
- /*
- * This protocol has more than just request and
- * response lines; see whether this looks like a
- * request or response.
- */
- idx = fetch_token(ndo, pptr, 0, len, token, sizeof(token));
- if (idx != 0) {
- /* Is this a valid request name? */
- while ((cmd = *cmds++) != NULL) {
- if (strcasecmp((const char *)token, cmd) == 0) {
- /* Yes. */
- is_reqresp = 1;
- break;
- }
- }
-
- /*
- * No - is this a valid response code (3 digits)?
- *
- * Is this token the response code, or is the next
- * token the response code?
- */
- if (flags & RESP_CODE_SECOND_TOKEN) {
- /*
- * Next token - get it.
- */
- idx = fetch_token(ndo, pptr, idx, len, token,
- sizeof(token));
- }
- if (idx != 0) {
- if (isdigit(token[0]) && isdigit(token[1]) &&
- isdigit(token[2]) && token[3] == '\0') {
- /* Yes. */
- is_reqresp = 1;
- }
- }
- }
- } else {
- /*
- * This protocol has only request and response lines
- * (e.g., FTP, where all the data goes over a
- * different connection); assume the payload is
- * a request or response.
- */
- is_reqresp = 1;
- }
-
- /* Capitalize the protocol name */
- for (pnp = protoname; *pnp != '\0'; pnp++)
- ND_PRINT((ndo, "%c", toupper(*pnp)));
-
- if (is_reqresp) {
- /*
- * In non-verbose mode, just print the protocol, followed
- * by the first line as the request or response info.
- *
- * In verbose mode, print lines as text until we run out
- * of characters or see something that's not a
- * printable-ASCII line.
- */
- if (ndo->ndo_vflag) {
- /*
- * We're going to print all the text lines in the
- * request or response; just print the length
- * on the first line of the output.
- */
- ND_PRINT((ndo, ", length: %u", len));
- for (idx = 0;
- idx < len && (eol = print_txt_line(ndo, protoname, "\n\t", pptr, idx, len)) != 0;
- idx = eol)
- ;
- } else {
- /*
- * Just print the first text line.
- */
- print_txt_line(ndo, protoname, ": ", pptr, 0, len);
- }
- }
-}
-
/* VARARGS */
void
error(const char *fmt, ...)
cp[cc] = '\0';
return (cp);
}
-
-void
-safeputs(netdissect_options *ndo,
- const u_char *s, const u_int maxlen)
-{
- u_int idx = 0;
-
- while (*s && idx < maxlen) {
- safeputchar(ndo, *s);
- idx++;
- s++;
- }
-}
-
-void
-safeputchar(netdissect_options *ndo,
- const u_char c)
-{
- ND_PRINT((ndo, (c < 0x80 && ND_ISPRINT(c)) ? "%c" : "\\0x%02x", c));
-}
-
-#ifdef LBL_ALIGN
-/*
- * Some compilers try to optimize memcpy(), using the alignment constraint
- * on the argument pointer type. by using this function, we try to avoid the
- * optimization.
- */
-void
-unaligned_memcpy(void *p, const void *q, size_t l)
-{
- memcpy(p, q, l);
-}
-
-/* As with memcpy(), so with memcmp(). */
-int
-unaligned_memcmp(const void *p, const void *q, size_t l)
-{
- return (memcmp(p, q, l));
-}
-#endif