From: Francois-Xavier Le Bail Date: Wed, 14 Mar 2018 15:54:17 +0000 (+0100) Subject: Add the ndo_protocol field in the netdissect_options structure X-Git-Tag: tcpdump-4.99-bp~1228 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/546558eabd81cfc36a81a4df728fdfea0d83b41a Add the ndo_protocol field in the netdissect_options structure Update this field in printer entry functions. It will be used for some printings. --- diff --git a/netdissect.h b/netdissect.h index 0d996854..365b4b95 100644 --- a/netdissect.h +++ b/netdissect.h @@ -182,6 +182,7 @@ struct netdissect_options { * LF, CR and SPACE as graphical chars */ int ndo_Hflag; /* dissect 802.11s draft mesh standard */ + const char *ndo_protocol; /* protocol */ void *ndo_last_mem_p; /* pointer to the last allocated memory chunk */ int ndo_packet_number; /* print a packet number in the beginning of line */ int ndo_suppress_default_print; /* don't use default_print() for unknown packet types */ diff --git a/print-802_11.c b/print-802_11.c index 5849a071..a3d376b6 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -2016,6 +2016,7 @@ ieee802_11_print(netdissect_options *ndo, struct lladdr_info src, dst; int llc_hdrlen; + ndo->ndo_protocol = "802.11"; caplen = orig_caplen; /* Remove FCS, if present */ if (length < fcslen) { @@ -2124,6 +2125,7 @@ u_int ieee802_11_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "802.11_if"; return ieee802_11_print(ndo, p, h->len, h->caplen, 0, 0); } @@ -3080,6 +3082,7 @@ ieee802_11_radio_print(netdissect_options *ndo, int pad; u_int fcslen; + ndo->ndo_protocol = "802.11_radio"; if (caplen < sizeof(*hdr)) { ND_PRINT("%s", tstr); return caplen; @@ -3257,6 +3260,7 @@ ieee802_11_radio_avs_print(netdissect_options *ndo, { uint32_t caphdr_len; + ndo->ndo_protocol = "802.11_radio_avs"; if (caplen < 8) { ND_PRINT("%s", tstr); return caplen; @@ -3309,6 +3313,7 @@ prism_if_print(netdissect_options *ndo, u_int length = h->len; uint32_t msgcode; + ndo->ndo_protocol = "prism_if"; if (caplen < 4) { ND_PRINT("%s", tstr); return caplen; @@ -3336,6 +3341,7 @@ u_int ieee802_11_radio_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "802.11_radio_if"; return ieee802_11_radio_print(ndo, p, h->len, h->caplen); } @@ -3348,5 +3354,6 @@ u_int ieee802_11_radio_avs_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "802.11_radio_avs_if"; return ieee802_11_radio_avs_print(ndo, p, h->len, h->caplen); } diff --git a/print-802_15_4.c b/print-802_15_4.c index 17d0ded7..bf960871 100644 --- a/print-802_15_4.c +++ b/print-802_15_4.c @@ -70,6 +70,7 @@ ieee802_15_4_print(netdissect_options *ndo, uint8_t seq; uint16_t panid = 0; + ndo->ndo_protocol = "802.15.4"; if (caplen < 3) { ND_PRINT("[|802.15.4]"); return caplen; @@ -226,5 +227,6 @@ u_int ieee802_15_4_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "802.15.4_if"; return ieee802_15_4_print(ndo, p, h->caplen); } diff --git a/print-ah.c b/print-ah.c index 2f58716b..ec94cc14 100644 --- a/print-ah.c +++ b/print-ah.c @@ -40,6 +40,7 @@ ah_print(netdissect_options *ndo, const u_char *bp) const struct ah *ah; u_int sumlen; + ndo->ndo_protocol = "ah"; ah = (const struct ah *)bp; ND_TCHECK_SIZE(ah); diff --git a/print-ahcp.c b/print-ahcp.c index e452e383..9ac7de05 100644 --- a/print-ahcp.c +++ b/print-ahcp.c @@ -350,6 +350,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) const u_char *ep = ndo->ndo_snapend; uint8_t version; + ndo->ndo_protocol = "ahcp"; ND_PRINT("AHCP"); if (len < 2) goto invalid; diff --git a/print-aodv.c b/print-aodv.c index e47ff184..52024dc0 100644 --- a/print-aodv.c +++ b/print-aodv.c @@ -478,6 +478,7 @@ aodv_print(netdissect_options *ndo, { uint8_t msg_type; + ndo->ndo_protocol = "aodv"; /* * The message type is the first byte; make sure we have it * and then fetch it. diff --git a/print-aoe.c b/print-aoe.c index b56af2cb..322b6fd5 100644 --- a/print-aoe.c +++ b/print-aoe.c @@ -402,6 +402,7 @@ aoe_print(netdissect_options *ndo, const u_char *ep = ndo->ndo_snapend; uint8_t ver; + ndo->ndo_protocol = "aoe"; ND_PRINT("AoE length %u", len); if (len < 1) diff --git a/print-ap1394.c b/print-ap1394.c index d39f27f7..4326707f 100644 --- a/print-ap1394.c +++ b/print-ap1394.c @@ -94,6 +94,7 @@ ap1394_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch u_short ether_type; struct lladdr_info src, dst; + ndo->ndo_protocol = "ap1394_if"; if (caplen < FIREWIRE_HDRLEN) { ND_PRINT("[|ap1394]"); return FIREWIRE_HDRLEN; diff --git a/print-arcnet.c b/print-arcnet.c index 469361ef..f4020171 100644 --- a/print-arcnet.c +++ b/print-arcnet.c @@ -125,10 +125,9 @@ arcnet_print(netdissect_options *ndo, const u_char *bp, u_int length, int phds, const struct arc_header *ap; const char *arctypename; - + ndo->ndo_protocol = "arcnet"; ap = (const struct arc_header *)bp; - if (ndo->ndo_qflag) { ND_PRINT("%02x %02x %u: ", EXTRACT_U_1(ap->arc_shost), @@ -191,6 +190,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch u_int seqid = 0; u_char arc_type; + ndo->ndo_protocol = "arcnet_if"; if (caplen < ARC_HDRLEN || length < ARC_HDRLEN) { ND_PRINT("[|arcnet]"); return (caplen); @@ -278,6 +278,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons int archdrlen = 0; u_char arc_type; + ndo->ndo_protocol = "arcnet_linux_if"; if (caplen < ARC_LINUX_HDRLEN || length < ARC_LINUX_HDRLEN) { ND_PRINT("[|arcnet]"); return (caplen); diff --git a/print-arp.c b/print-arp.c index c7eeeb96..e026bd46 100644 --- a/print-arp.c +++ b/print-arp.c @@ -359,6 +359,7 @@ arp_print(netdissect_options *ndo, const struct arp_pkthdr *ap; u_short pro, hrd, op, linkaddr; + ndo->ndo_protocol = "arp"; ap = (const struct arp_pkthdr *)bp; ND_TCHECK_SIZE(ap); diff --git a/print-ascii.c b/print-ascii.c index 0c347bf0..78bced6a 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -62,6 +62,7 @@ ascii_print(netdissect_options *ndo, u_int caplength; u_char s; + ndo->ndo_protocol = "ascii"; caplength = (ndo->ndo_snapend >= cp) ? ndo->ndo_snapend - cp : 0; if (length > caplength) length = caplength; diff --git a/print-atalk.c b/print-atalk.c index 0e0ab003..7398b15d 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -79,6 +79,7 @@ ltalk_if_print(netdissect_options *ndo, { u_int hdrlen; + ndo->ndo_protocol = "ltalk_if"; hdrlen = llap_print(ndo, p, h->len); if (hdrlen == 0) { /* Cut short by the snapshot length. */ @@ -100,6 +101,7 @@ llap_print(netdissect_options *ndo, u_short snet; u_int hdrlen; + ndo->ndo_protocol = "llap"; if (length < sizeof(*lp)) { ND_PRINT(" [|llap %u]", length); return (length); @@ -182,6 +184,7 @@ atalk_print(netdissect_options *ndo, const struct atDDP *dp; u_short snet; + ndo->ndo_protocol = "atalk"; if(!ndo->ndo_eflag) ND_PRINT("AT "); @@ -214,6 +217,7 @@ aarp_print(netdissect_options *ndo, #define AT(member) ataddr_string(ndo, (ap->member[1]<<8)|ap->member[2],ap->member[3]) + ndo->ndo_protocol = "aarp"; ND_PRINT("aarp "); ap = (const struct aarp *)bp; if (!ND_TTEST_SIZE(ap)) { diff --git a/print-atm.c b/print-atm.c index eb661c28..22acd73f 100644 --- a/print-atm.c +++ b/print-atm.c @@ -253,6 +253,7 @@ atm_if_print(netdissect_options *ndo, uint32_t llchdr; u_int hdrlen = 0; + ndo->ndo_protocol = "atm_if"; if (caplen < 1 || length < 1) { ND_PRINT("%s", tstr); return (caplen); @@ -386,6 +387,7 @@ atm_print(netdissect_options *ndo, u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length, u_int caplen) { + ndo->ndo_protocol = "atm"; if (ndo->ndo_eflag) ND_PRINT("VPI:%u VCI:%u ", vpi, vci); @@ -459,7 +461,7 @@ oam_print (netdissect_options *ndo, const struct oam_fm_ais_rdi_t *oam_fm_ais_rdi; } oam_ptr; - + ndo->ndo_protocol = "oam"; ND_TCHECK_1(p + ATM_HDR_LEN_NOHEC + hec); cell_header = EXTRACT_BE_U_4(p + hec); cell_type = (EXTRACT_U_1((p + ATM_HDR_LEN_NOHEC + hec)) >> 4) & 0x0f; diff --git a/print-babel.c b/print-babel.c index c7fef600..9f2ecf10 100644 --- a/print-babel.c +++ b/print-babel.c @@ -49,6 +49,7 @@ void babel_print(netdissect_options *ndo, const u_char *cp, u_int length) { + ndo->ndo_protocol = "babel"; ND_PRINT("babel"); ND_TCHECK_4(cp); diff --git a/print-beep.c b/print-beep.c index 69bd8ec3..76017eaf 100644 --- a/print-beep.c +++ b/print-beep.c @@ -49,6 +49,7 @@ void beep_print(netdissect_options *ndo, const u_char *bp, u_int length) { + ndo->ndo_protocol = "beep"; if (l_strnstart(ndo, "MSG", 4, (const char *)bp, length)) /* A REQuest */ ND_PRINT(" BEEP MSG"); else if (l_strnstart(ndo, "RPY ", 4, (const char *)bp, length)) diff --git a/print-bfd.c b/print-bfd.c index 558439f9..0d1732cd 100644 --- a/print-bfd.c +++ b/print-bfd.c @@ -299,6 +299,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr, uint8_t version = 0; uint8_t flags; + ndo->ndo_protocol = "bfd"; bfd_header = (const struct bfd_header_t *)pptr; version_diag = EXTRACT_U_1(bfd_header->version_diag); if (port == BFD_CONTROL_PORT) { diff --git a/print-bgp.c b/print-bgp.c index fff46bf1..2a3e7651 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -3065,6 +3065,7 @@ bgp_print(netdissect_options *ndo, const struct bgp *bgp_header; uint16_t hlen; + ndo->ndo_protocol = "bgp"; ND_PRINT(": BGP"); if (ndo->ndo_vflag < 1) /* lets be less chatty */ diff --git a/print-bootp.c b/print-bootp.c index bddd5f9b..aef7063c 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -288,6 +288,7 @@ bootp_print(netdissect_options *ndo, static const u_char vm_rfc1048[4] = VM_RFC1048; uint8_t bp_op, bp_htype, bp_hlen; + ndo->ndo_protocol = "bootp"; bp = (const struct bootp *)cp; ND_TCHECK_1(bp->bp_op); bp_op = EXTRACT_U_1(bp->bp_op); diff --git a/print-bt.c b/print-bt.c index 40b7f971..61eb7b23 100644 --- a/print-bt.c +++ b/print-bt.c @@ -47,6 +47,7 @@ bt_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char * u_int caplen = h->caplen; const pcap_bluetooth_h4_header* hdr = (const pcap_bluetooth_h4_header*)p; + ndo->ndo_protocol = "bt_if"; if (caplen < BT_HDRLEN || length < BT_HDRLEN) goto trunc; caplen -= BT_HDRLEN; diff --git a/print-calm-fast.c b/print-calm-fast.c index fa1d9034..d516cdff 100644 --- a/print-calm-fast.c +++ b/print-calm-fast.c @@ -43,6 +43,7 @@ calm_fast_print(netdissect_options *ndo, const u_char *bp, u_int length, const s u_int srcNwref; u_int dstNwref; + ndo->ndo_protocol = "calm_fast"; ND_TCHECK_2(bp); if (length < 2) goto trunc; diff --git a/print-carp.c b/print-carp.c index 8e82f6db..0a505238 100644 --- a/print-carp.c +++ b/print-carp.c @@ -51,6 +51,7 @@ carp_print(netdissect_options *ndo, const u_char *bp, u_int len, u_int ttl) u_int version, type; const char *type_s; + ndo->ndo_protocol = "carp"; ND_TCHECK_1(bp); version = (EXTRACT_U_1(bp) & 0xf0) >> 4; type = EXTRACT_U_1(bp) & 0x0f; diff --git a/print-cdp.c b/print-cdp.c index 9e88ab39..1e1d66ab 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -97,6 +97,7 @@ cdp_print(netdissect_options *ndo, u_int type, len, i, j; const u_char *tptr; + ndo->ndo_protocol = "cdp"; if (caplen < CDP_HEADER_LEN) { ND_PRINT("%s", tstr); return; diff --git a/print-cfm.c b/print-cfm.c index 050a99a3..568e3036 100644 --- a/print-cfm.c +++ b/print-cfm.c @@ -292,6 +292,7 @@ cfm_print(netdissect_options *ndo, const struct cfm_ltr_t *cfm_ltr; } msg_ptr; + ndo->ndo_protocol = "cfm"; tptr=pptr; cfm_common_header = (const struct cfm_common_header_t *)pptr; if (length < sizeof(*cfm_common_header)) diff --git a/print-chdlc.c b/print-chdlc.c index 6a420929..8dc20ae4 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -47,6 +47,7 @@ static const struct tok chdlc_cast_values[] = { u_int chdlc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "chdlc_if"; return chdlc_print(ndo, p, h->len); } @@ -56,6 +57,7 @@ chdlc_print(netdissect_options *ndo, const u_char *p, u_int length) u_int proto; const u_char *bp = p; + ndo->ndo_protocol = "chdlc"; if (length < CHDLC_HDRLEN) goto trunc; ND_TCHECK_LEN(p, CHDLC_HDRLEN); diff --git a/print-cip.c b/print-cip.c index a8538867..468477a6 100644 --- a/print-cip.c +++ b/print-cip.c @@ -64,6 +64,7 @@ cip_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char size_t cmplen; int llc_hdrlen; + ndo->ndo_protocol = "cip_if"; cmplen = sizeof(rfcllc); if (cmplen > caplen) cmplen = caplen; diff --git a/print-cnfp.c b/print-cnfp.c index c1c3e0c9..f010e90c 100644 --- a/print-cnfp.c +++ b/print-cnfp.c @@ -467,6 +467,7 @@ cnfp_print(netdissect_options *ndo, const u_char *cp) /* * First 2 bytes are the version number. */ + ndo->ndo_protocol = "cnfp"; ND_TCHECK_2(cp); ver = EXTRACT_BE_U_2(cp); switch (ver) { diff --git a/print-dccp.c b/print-dccp.c index 5937d53a..a717b166 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -284,6 +284,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, u_int fixed_hdrlen; uint8_t dccph_type; + ndo->ndo_protocol = "dccp"; dh = (const struct dccp_hdr *)bp; ip = (const struct ip *)data2; diff --git a/print-decnet.c b/print-decnet.c index 253d133d..6f68feb8 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -507,6 +507,7 @@ decnet_print(netdissect_options *ndo, u_int nsplen, pktlen; const u_char *nspp; + ndo->ndo_protocol = "decnet"; if (length < sizeof(struct shorthdr)) { ND_PRINT("%s", tstr); return; diff --git a/print-dhcp6.c b/print-dhcp6.c index f7bc45a7..a45fe5c0 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -795,6 +795,7 @@ dhcp6_print(netdissect_options *ndo, const u_char *extp; const char *name; + ndo->ndo_protocol = "dhcp6"; ND_PRINT("dhcp6"); ep = ndo->ndo_snapend; diff --git a/print-domain.c b/print-domain.c index 80f021ce..4e211918 100644 --- a/print-domain.c +++ b/print-domain.c @@ -598,6 +598,7 @@ domain_print(netdissect_options *ndo, const u_char *cp; uint16_t b2; + ndo->ndo_protocol = "domain"; np = (const dns_header_t *)bp; ND_TCHECK_SIZE(np); flags = EXTRACT_BE_U_2(np->flags); diff --git a/print-dtp.c b/print-dtp.c index 47e8b1aa..5e76e2a2 100644 --- a/print-dtp.c +++ b/print-dtp.c @@ -49,6 +49,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) int type, len; const u_char *tptr; + ndo->ndo_protocol = "dtp"; if (length < DTP_HEADER_LEN) goto trunc; diff --git a/print-dvmrp.c b/print-dvmrp.c index b6e129a5..6cc7da7c 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -73,6 +73,7 @@ dvmrp_print(netdissect_options *ndo, u_char type; uint8_t major_version, minor_version; + ndo->ndo_protocol = "dvmrp"; ep = ndo->ndo_snapend; if (bp >= ep) return; diff --git a/print-eap.c b/print-eap.c index f0a5de05..a17a740a 100644 --- a/print-eap.c +++ b/print-eap.c @@ -156,6 +156,7 @@ eap_print(netdissect_options *ndo, u_int eap_type, tlen, type, subtype; int count=0, len; + ndo->ndo_protocol = "eap"; tptr = cp; tlen = length; eap = (const struct eap_frame_t *)cp; diff --git a/print-egp.c b/print-egp.c index 3a689d92..aa8c7ce5 100644 --- a/print-egp.c +++ b/print-egp.c @@ -255,6 +255,7 @@ egp_print(netdissect_options *ndo, u_int code; u_int status; + ndo->ndo_protocol = "egp"; egp = (const struct egp_packet *)bp; if (length < sizeof(*egp) || !ND_TTEST_SIZE(egp)) { ND_PRINT("[|egp]"); diff --git a/print-eigrp.c b/print-eigrp.c index 022c9355..a9206a87 100644 --- a/print-eigrp.c +++ b/print-eigrp.c @@ -228,6 +228,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) const struct eigrp_tlv_at_ext_t *eigrp_tlv_at_ext; } tlv_ptr; + ndo->ndo_protocol = "eigrp"; tptr=pptr; eigrp_com_header = (const struct eigrp_common_header *)pptr; ND_TCHECK_SIZE(eigrp_com_header); diff --git a/print-enc.c b/print-enc.c index 94f4b095..fb9b7087 100644 --- a/print-enc.c +++ b/print-enc.c @@ -103,6 +103,7 @@ enc_if_print(netdissect_options *ndo, u_int af, flags; const struct enchdr *hdr; + ndo->ndo_protocol = "enc_if"; if (caplen < ENC_HDRLEN) { ND_PRINT("[|enc]"); goto out; diff --git a/print-esp.c b/print-esp.c index 31630100..53b6d243 100644 --- a/print-esp.c +++ b/print-esp.c @@ -670,6 +670,7 @@ esp_print(netdissect_options *ndo, u_char *output_buffer; #endif + ndo->ndo_protocol = "esp"; esp = (const struct newesp *)bp; #ifdef HAVE_LIBCRYPTO diff --git a/print-ether.c b/print-ether.c index 0a331d18..112c6e81 100644 --- a/print-ether.c +++ b/print-ether.c @@ -157,6 +157,7 @@ ether_print(netdissect_options *ndo, int llc_hdrlen; struct lladdr_info src, dst; + ndo->ndo_protocol = "ether"; if (caplen < ETHER_HDRLEN) { ND_PRINT("[|ether]"); return (caplen); @@ -274,6 +275,7 @@ u_int ether_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "ether_if"; return (ether_print(ndo, p, h->len, h->caplen, NULL, NULL)); } @@ -293,6 +295,7 @@ netanalyzer_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, /* * Fail if we don't have enough data for the Hilscher pseudo-header. */ + ndo->ndo_protocol = "netanalyzer_if"; if (h->len < 4 || h->caplen < 4) { ND_PRINT("[|netanalyzer]"); return (h->caplen); @@ -321,6 +324,7 @@ netanalyzer_transparent_if_print(netdissect_options *ndo, * Fail if we don't have enough data for the Hilscher pseudo-header, * preamble, and SOF. */ + ndo->ndo_protocol = "netanalyzer_transparent_if"; if (h->len < 12 || h->caplen < 12) { ND_PRINT("[|netanalyzer-transparent]"); return (h->caplen); diff --git a/print-fddi.c b/print-fddi.c index f87c00f7..af8477ef 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -282,6 +282,7 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) struct lladdr_info src, dst; int llc_hdrlen; + ndo->ndo_protocol = "fddi"; if (caplen < FDDI_HDRLEN) { ND_PRINT("[|fddi]"); return (caplen); @@ -344,5 +345,6 @@ fddi_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) u_int fddi_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "fddi_if"; return (fddi_print(ndo, p, h->len, h->caplen)); } diff --git a/print-forces.c b/print-forces.c index 6835522a..be978f28 100644 --- a/print-forces.c +++ b/print-forces.c @@ -1707,6 +1707,7 @@ forces_print(netdissect_options *ndo, const struct tom_h *tops; int rc = 0; + ndo->ndo_protocol = "forces"; fhdr = (const struct forcesh *)pptr; ND_TCHECK_SIZE(fhdr); tom = EXTRACT_U_1(fhdr->fm_tom); diff --git a/print-fr.c b/print-fr.c index cfd1747d..88f7de17 100644 --- a/print-fr.c +++ b/print-fr.c @@ -220,6 +220,7 @@ fr_if_print(netdissect_options *ndo, u_int length = h->len; u_int caplen = h->caplen; + ndo->ndo_protocol = "fr_if"; ND_TCHECK_4(p); /* minimum frame header length */ if ((length = fr_print(ndo, p, length)) == 0) @@ -243,6 +244,7 @@ fr_print(netdissect_options *ndo, u_int hdr_len; uint32_t flags; + ndo->ndo_protocol = "fr"; ret = parse_q922_header(ndo, p, &dlci, &addr_len, &flags, length); if (ret == -1) goto trunc; @@ -376,6 +378,7 @@ mfr_if_print(netdissect_options *ndo, u_int length = h->len; u_int caplen = h->caplen; + ndo->ndo_protocol = "mfr_if"; ND_TCHECK_2(p); /* minimum frame header length */ if ((length = mfr_print(ndo, p, length)) == 0) @@ -454,6 +457,7 @@ mfr_print(netdissect_options *ndo, * +----+----+----+----+----+----+----+----+ */ + ndo->ndo_protocol = "mfr"; ND_TCHECK_4(p); /* minimum frame header length */ if ((EXTRACT_U_1(p) & MFR_BEC_MASK) == MFR_CTRL_FRAME && EXTRACT_U_1(p + 1) == 0) { @@ -798,6 +802,7 @@ q933_print(netdissect_options *ndo, u_int non_locking_shift; u_int unshift_codeset; + ndo->ndo_protocol = "q933"; ND_PRINT("%s", ndo->ndo_eflag ? "" : "Q.933"); if (length == 0 || !ND_TTEST_1(p)) { diff --git a/print-frag6.c b/print-frag6.c index 634e7c9a..f545d2d5 100644 --- a/print-frag6.c +++ b/print-frag6.c @@ -38,6 +38,7 @@ frag6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2) const struct ip6_frag *dp; const struct ip6_hdr *ip6; + ndo->ndo_protocol = "frag6"; dp = (const struct ip6_frag *)bp; ip6 = (const struct ip6_hdr *)bp2; diff --git a/print-ftp.c b/print-ftp.c index b4936077..f5646874 100644 --- a/print-ftp.c +++ b/print-ftp.c @@ -28,5 +28,6 @@ void ftp_print(netdissect_options *ndo, const u_char *pptr, u_int len) { + ndo->ndo_protocol = "ftp"; txtproto_print(ndo, pptr, len, "ftp", NULL, 0); } diff --git a/print-geneve.c b/print-geneve.c index a27c2b06..cfc981ed 100644 --- a/print-geneve.c +++ b/print-geneve.c @@ -153,6 +153,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len) uint8_t reserved; u_int opts_len; + ndo->ndo_protocol = "geneve"; ND_PRINT("Geneve"); ND_TCHECK_8(bp); diff --git a/print-geonet.c b/print-geonet.c index c029cdc4..6558eacd 100644 --- a/print-geonet.c +++ b/print-geonet.c @@ -118,6 +118,7 @@ geonet_print(netdissect_options *ndo, const u_char *bp, u_int length, const char *hdr_type_txt = "Unknown"; int hdr_size = -1; + ndo->ndo_protocol = "geonet"; ND_PRINT("GeoNet "); if (src != NULL) ND_PRINT("src:%s", (src->addr_string)(ndo, src->addr)); diff --git a/print-gre.c b/print-gre.c index 66069086..73fcb923 100644 --- a/print-gre.c +++ b/print-gre.c @@ -89,6 +89,7 @@ gre_print(netdissect_options *ndo, const u_char *bp, u_int length) { u_int len = length, vers; + ndo->ndo_protocol = "gre"; ND_TCHECK_2(bp); if (len < 2) goto trunc; diff --git a/print-hncp.c b/print-hncp.c index e448f567..471161f1 100644 --- a/print-hncp.c +++ b/print-hncp.c @@ -49,6 +49,7 @@ void hncp_print(netdissect_options *ndo, const u_char *cp, u_int length) { + ndo->ndo_protocol = "hncp"; ND_PRINT("hncp (%u)", length); hncp_print_rec(ndo, cp, length, 1); } diff --git a/print-hsrp.c b/print-hsrp.c index b29135f3..cc9655ca 100644 --- a/print-hsrp.c +++ b/print-hsrp.c @@ -99,6 +99,7 @@ hsrp_print(netdissect_options *ndo, const u_char *bp, u_int len) const struct hsrp *hp = (const struct hsrp *) bp; uint8_t version; + ndo->ndo_protocol = "hsrp"; ND_TCHECK_1(hp->hsrp_version); version = EXTRACT_U_1(hp->hsrp_version); ND_PRINT("HSRPv%u", version); diff --git a/print-http.c b/print-http.c index f4cc0e7b..c8b6be12 100644 --- a/print-http.c +++ b/print-http.c @@ -73,5 +73,6 @@ static const char *httpcmds[] = { void http_print(netdissect_options *ndo, const u_char *pptr, u_int len) { + ndo->ndo_protocol = "http"; txtproto_print(ndo, pptr, len, "http", httpcmds, RESP_CODE_SECOND_TOKEN); } diff --git a/print-icmp.c b/print-icmp.c index a5b94d63..7ad886d2 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -347,6 +347,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * char buf[MAXHOSTNAMELEN + 100]; struct cksum_vec vec[1]; + ndo->ndo_protocol = "icmp"; dp = (const struct icmp *)bp; ext_dp = (const struct icmp_ext_t *)bp; ip = (const struct ip *)bp2; diff --git a/print-icmp6.c b/print-icmp6.c index 9bbd5c81..151a4db7 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -1033,6 +1033,7 @@ icmp6_print(netdissect_options *ndo, const u_char *ep; u_int prot; + ndo->ndo_protocol = "icmp6"; dp = (const struct icmp6_hdr *)bp; ip = (const struct ip6_hdr *)bp2; oip = (const struct ip6_hdr *)(dp + 1); diff --git a/print-igmp.c b/print-igmp.c index d78e913f..fdfae53d 100644 --- a/print-igmp.c +++ b/print-igmp.c @@ -268,6 +268,7 @@ igmp_print(netdissect_options *ndo, { struct cksum_vec vec[1]; + ndo->ndo_protocol = "igmp"; if (ndo->ndo_qflag) { ND_PRINT("igmp"); return; diff --git a/print-igrp.c b/print-igrp.c index e40c22f7..f0fe6013 100644 --- a/print-igrp.c +++ b/print-igrp.c @@ -108,6 +108,7 @@ igrp_print(netdissect_options *ndo, const u_char *bp, u_int length) const u_char *cp; u_int nint, nsys, next; + ndo->ndo_protocol = "igrp"; hdr = (const struct igrphdr *)bp; cp = (const u_char *)(hdr + 1); ND_PRINT("igrp:"); diff --git a/print-ip.c b/print-ip.c index e116f065..b1a23db9 100644 --- a/print-ip.c +++ b/print-ip.c @@ -549,6 +549,7 @@ ip_print(netdissect_options *ndo, uint16_t sum, ip_sum; const char *p_name; + ndo->ndo_protocol = "ip"; ipds->ip = (const struct ip *)bp; ND_TCHECK_1(ipds->ip->ip_vhl); if (IP_V(ipds->ip) != 4) { /* print version and fail if != 4 */ @@ -710,6 +711,7 @@ trunc: void ipN_print(netdissect_options *ndo, const u_char *bp, u_int length) { + ndo->ndo_protocol = "ipN"; if (length < 1) { ND_PRINT("truncated-ip %u", length); return; diff --git a/print-ip6.c b/print-ip6.c index f22d2c05..50374e08 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -224,6 +224,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) int fragmented = 0; u_int flow; + ndo->ndo_protocol = "ip6"; ip6 = (const struct ip6_hdr *)bp; ND_TCHECK_SIZE(ip6); diff --git a/print-ip6opts.c b/print-ip6opts.c index 5d4ecb24..31523883 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -176,6 +176,7 @@ hbhopt_print(netdissect_options *ndo, const u_char *bp) const struct ip6_hbh *dp = (const struct ip6_hbh *)bp; u_int hbhlen = 0; + ndo->ndo_protocol = "hbhopt"; ND_TCHECK_1(dp->ip6h_len); hbhlen = (EXTRACT_U_1(dp->ip6h_len) + 1) << 3; ND_TCHECK_LEN(dp, hbhlen); @@ -196,6 +197,7 @@ dstopt_print(netdissect_options *ndo, const u_char *bp) const struct ip6_dest *dp = (const struct ip6_dest *)bp; u_int dstoptlen = 0; + ndo->ndo_protocol = "dstopt"; ND_TCHECK_1(dp->ip6d_len); dstoptlen = (EXTRACT_U_1(dp->ip6d_len) + 1) << 3; ND_TCHECK_LEN(dp, dstoptlen); diff --git a/print-ipcomp.c b/print-ipcomp.c index 28fac51d..e0aefcbb 100644 --- a/print-ipcomp.c +++ b/print-ipcomp.c @@ -42,6 +42,7 @@ ipcomp_print(netdissect_options *ndo, const u_char *bp) const struct ipcomp *ipcomp; uint16_t cpi; + ndo->ndo_protocol = "ipcomp"; ipcomp = (const struct ipcomp *)bp; ND_TCHECK_SIZE(ipcomp); cpi = EXTRACT_BE_U_2(ipcomp->comp_cpi); diff --git a/print-ipfc.c b/print-ipfc.c index 358bf0ba..5df6127c 100644 --- a/print-ipfc.c +++ b/print-ipfc.c @@ -95,6 +95,7 @@ ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) struct lladdr_info src, dst; int llc_hdrlen; + ndo->ndo_protocol = "ipfc"; if (caplen < IPFC_HDRLEN) goto trunc; /* @@ -142,5 +143,6 @@ trunc: u_int ipfc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "ipfc_if"; return (ipfc_print(ndo, p, h->len, h->caplen)); } diff --git a/print-ipnet.c b/print-ipnet.c index 9777909b..627c9b94 100644 --- a/print-ipnet.c +++ b/print-ipnet.c @@ -66,6 +66,7 @@ ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen { const ipnet_hdr_t *hdr; + ndo->ndo_protocol = "ipnet"; if (caplen < sizeof(ipnet_hdr_t)) goto trunc; @@ -112,6 +113,7 @@ u_int ipnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "ipnet_if"; ipnet_print(ndo, p, h->len, h->caplen); return (sizeof(ipnet_hdr_t)); diff --git a/print-ipx.c b/print-ipx.c index 80c76619..b17cdf61 100644 --- a/print-ipx.c +++ b/print-ipx.c @@ -73,6 +73,7 @@ ipx_print(netdissect_options *ndo, const u_char *p, u_int length) { const struct ipxHdr *ipx = (const struct ipxHdr *)p; + ndo->ndo_protocol = "ipx"; if (!ndo->ndo_eflag) ND_PRINT("IPX "); diff --git a/print-isakmp.c b/print-isakmp.c index 5ca215da..d407e810 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -3032,6 +3032,7 @@ isakmp_print(netdissect_options *ndo, const u_char *ep; u_int major, minor; + ndo->ndo_protocol = "isakmp"; #ifdef HAVE_LIBCRYPTO /* initialize SAs */ if (ndo->ndo_sa_list_head == NULL) { @@ -3087,6 +3088,7 @@ isakmp_rfc3948_print(netdissect_options *ndo, const u_char *bp, u_int length, const u_char *bp2) { + ndo->ndo_protocol = "isakmp_rfc3948"; ND_TCHECK_1(bp); if(length == 1 && EXTRACT_U_1(bp)==0xff) { ND_PRINT("isakmp-nat-keep-alive"); diff --git a/print-isoclns.c b/print-isoclns.c index 329d52f2..f79f2404 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -679,6 +679,7 @@ struct isis_tlv_lsp { void isoclns_print(netdissect_options *ndo, const u_char *p, u_int length) { + ndo->ndo_protocol = "isoclns"; if (!ND_TTEST_1(p)) { /* enough bytes on the wire ? */ ND_PRINT("|OSI"); return; diff --git a/print-juniper.c b/print-juniper.c index d1f9a663..28ce37f3 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -466,6 +466,7 @@ juniper_ggsn_if_print(netdissect_options *ndo, const struct juniper_ggsn_header *gh; uint8_t proto; + ndo->ndo_protocol = "juniper_ggsn_if"; l2info.pictype = DLT_JUNIPER_GGSN; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -519,6 +520,7 @@ juniper_es_if_print(netdissect_options *ndo, u_int rewrite_len,es_type_bundle; const struct juniper_ipsec_header *ih; + ndo->ndo_protocol = "juniper_es_if"; l2info.pictype = DLT_JUNIPER_ES; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -593,6 +595,7 @@ juniper_monitor_if_print(netdissect_options *ndo, }; const struct juniper_monitor_header *mh; + ndo->ndo_protocol = "juniper_monitor_if"; l2info.pictype = DLT_JUNIPER_MONITOR; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -633,6 +636,7 @@ juniper_services_if_print(netdissect_options *ndo, }; const struct juniper_services_header *sh; + ndo->ndo_protocol = "juniper_services_if"; l2info.pictype = DLT_JUNIPER_SERVICES; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -666,6 +670,7 @@ juniper_pppoe_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_pppoe_if"; l2info.pictype = DLT_JUNIPER_PPPOE; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -684,6 +689,7 @@ juniper_ether_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_ether_if"; l2info.pictype = DLT_JUNIPER_ETHER; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -702,6 +708,7 @@ juniper_ppp_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_ppp_if"; l2info.pictype = DLT_JUNIPER_PPP; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -720,6 +727,7 @@ juniper_frelay_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_frelay_if"; l2info.pictype = DLT_JUNIPER_FRELAY; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -738,6 +746,7 @@ juniper_chdlc_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_chdlc_if"; l2info.pictype = DLT_JUNIPER_CHDLC; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -757,6 +766,7 @@ juniper_pppoe_atm_if_print(netdissect_options *ndo, struct juniper_l2info_t l2info; uint16_t extracted_ethertype; + ndo->ndo_protocol = "juniper_pppoe_atm_if"; l2info.pictype = DLT_JUNIPER_PPPOE_ATM; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -790,6 +800,7 @@ juniper_mlppp_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_mlppp_if"; l2info.pictype = DLT_JUNIPER_MLPPP; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -850,6 +861,7 @@ juniper_mfr_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_mfr_if"; memset(&l2info, 0, sizeof(l2info)); l2info.pictype = DLT_JUNIPER_MFR; if (juniper_parse_header(ndo, p, h, &l2info) == 0) @@ -912,6 +924,7 @@ juniper_mlfr_if_print(netdissect_options *ndo, { struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_mlfr_if"; l2info.pictype = DLT_JUNIPER_MLFR; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -957,6 +970,7 @@ juniper_atm1_if_print(netdissect_options *ndo, struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_atm1_if"; l2info.pictype = DLT_JUNIPER_ATM1; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; @@ -1011,6 +1025,7 @@ juniper_atm2_if_print(netdissect_options *ndo, struct juniper_l2info_t l2info; + ndo->ndo_protocol = "juniper_atm2_if"; l2info.pictype = DLT_JUNIPER_ATM2; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; diff --git a/print-krb.c b/print-krb.c index 5e7cb412..ab598998 100644 --- a/print-krb.c +++ b/print-krb.c @@ -241,6 +241,7 @@ krb_print(netdissect_options *ndo, { const struct krb *kp; + ndo->ndo_protocol = "krb"; kp = (const struct krb *)dat; if (dat >= ndo->ndo_snapend) { diff --git a/print-l2tp.c b/print-l2tp.c index eb05029c..ed351af9 100644 --- a/print-l2tp.c +++ b/print-l2tp.c @@ -775,6 +775,7 @@ l2tp_print(netdissect_options *ndo, const u_char *dat, u_int length) int flag_t, flag_l, flag_s, flag_o; uint16_t l2tp_len; + ndo->ndo_protocol = "l2tp"; flag_t = flag_l = flag_s = flag_o = FALSE; ND_TCHECK_2(ptr); /* Flags & Version */ diff --git a/print-lane.c b/print-lane.c index aaa242c7..c9acd446 100644 --- a/print-lane.c +++ b/print-lane.c @@ -84,6 +84,7 @@ lane_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) { const struct lane_controlhdr *lec; + ndo->ndo_protocol = "lane"; if (caplen < sizeof(struct lane_controlhdr)) { ND_PRINT("[|lane]"); return; @@ -118,6 +119,7 @@ lane_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) u_int lane_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "lane_if"; lane_print(ndo, p, h->len, h->caplen); return (sizeof(struct lecdatahdr_8023)); diff --git a/print-ldp.c b/print-ldp.c index 1e1f1b67..1fbc0567 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -549,6 +549,8 @@ ldp_print(netdissect_options *ndo, const u_char *pptr, u_int len) { int processed; + + ndo->ndo_protocol = "ldp"; while (len > (sizeof(struct ldp_common_header) + sizeof(struct ldp_msg_header))) { processed = ldp_pdu_print(ndo, pptr); if (processed == 0) diff --git a/print-lisp.c b/print-lisp.c index 01e3fa01..2b903623 100644 --- a/print-lisp.c +++ b/print-lisp.c @@ -250,6 +250,7 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length) const lisp_map_register_eid *lisp_eid; const lisp_map_register_loc *lisp_loc; + ndo->ndo_protocol = "lisp"; /* Check if enough bytes for header are available */ ND_TCHECK_LEN(bp, MAP_REGISTER_HDR_LEN); lisp_hdr = (const lisp_map_register_hdr *) bp; diff --git a/print-llc.c b/print-llc.c index 86b90dff..bb18603c 100644 --- a/print-llc.c +++ b/print-llc.c @@ -155,6 +155,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, int hdrlen; int is_u; + ndo->ndo_protocol = "llc"; if (caplen < 3) { ND_PRINT("[|llc]"); ND_DEFAULTPRINT((const u_char *)p, caplen); @@ -427,6 +428,7 @@ snap_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, u_short et; int ret; + ndo->ndo_protocol = "snap"; ND_TCHECK_5(p); if (caplen < 5 || length < 5) goto trunc; diff --git a/print-lldp.c b/print-lldp.c index c91b4c27..dab0a99b 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -1438,6 +1438,7 @@ lldp_print(netdissect_options *ndo, const u_char *tptr; char *network_addr; + ndo->ndo_protocol = "lldp"; tptr = pptr; tlen = len; diff --git a/print-lmp.c b/print-lmp.c index 6e3f9810..6c0f671d 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -440,6 +440,7 @@ lmp_print(netdissect_options *ndo, uint32_t i; } bw; + ndo->ndo_protocol = "lmp"; tptr=pptr; lmp_com_header = (const struct lmp_common_header *)pptr; ND_TCHECK_SIZE(lmp_com_header); diff --git a/print-loopback.c b/print-loopback.c index 46942c94..e0df6f26 100644 --- a/print-loopback.c +++ b/print-loopback.c @@ -110,6 +110,7 @@ loopback_print(netdissect_options *ndo, const u_char *cp, const u_int len) const u_char *ep = ndo->ndo_snapend; uint16_t skipCount; + ndo->ndo_protocol = "loopback"; ND_PRINT("Loopback"); if (len < 2) goto invalid; diff --git a/print-lspping.c b/print-lspping.c index bb32b3e3..f20d9b75 100644 --- a/print-lspping.c +++ b/print-lspping.c @@ -525,6 +525,7 @@ lspping_print(netdissect_options *ndo, const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *lspping_tlv_targetfec_subtlv_bgp_ipv6; } subtlv_ptr; + ndo->ndo_protocol = "lspping"; tptr=pptr; lspping_com_header = (const struct lspping_common_header *)pptr; if (len < sizeof(struct lspping_common_header)) diff --git a/print-lwapp.c b/print-lwapp.c index 15e2022c..a1845924 100644 --- a/print-lwapp.c +++ b/print-lwapp.c @@ -175,6 +175,7 @@ lwapp_control_print(netdissect_options *ndo, u_int tlen; u_int msg_type, msg_tlen; + ndo->ndo_protocol = "lwapp_control"; tptr=pptr; if (has_ap_ident) { @@ -307,6 +308,7 @@ lwapp_data_print(netdissect_options *ndo, u_int tlen; u_int version; + ndo->ndo_protocol = "lwapp_data"; tptr=pptr; /* check if enough bytes for AP identity */ diff --git a/print-lwres.c b/print-lwres.c index b2a32be6..520c2356 100644 --- a/print-lwres.c +++ b/print-lwres.c @@ -315,6 +315,7 @@ lwres_print(netdissect_options *ndo, int advance; int unsupported = 0; + ndo->ndo_protocol = "lwres"; np = (const struct lwres_lwpacket *)bp; ND_TCHECK_2(np->authlength); diff --git a/print-m3ua.c b/print-m3ua.c index 79996646..a9400397 100644 --- a/print-m3ua.c +++ b/print-m3ua.c @@ -304,6 +304,7 @@ m3ua_print(netdissect_options *ndo, const struct tok *dict; uint8_t msg_class; + ndo->ndo_protocol = "m3ua"; /* size includes the header */ if (size < sizeof(struct m3ua_common_header)) goto invalid; diff --git a/print-medsa.c b/print-medsa.c index 8161012b..dce2b4e8 100644 --- a/print-medsa.c +++ b/print-medsa.c @@ -147,6 +147,7 @@ medsa_print(netdissect_options *ndo, const struct medsa_pkthdr *medsa; u_short ether_type; + ndo->ndo_protocol = "medsa"; medsa = (const struct medsa_pkthdr *)bp; ND_TCHECK_SIZE(medsa); diff --git a/print-mobile.c b/print-mobile.c index ee916a94..11314d7c 100644 --- a/print-mobile.c +++ b/print-mobile.c @@ -70,6 +70,7 @@ mobile_print(netdissect_options *ndo, const u_char *bp, u_int length) u_short proto,crc; u_char osp =0; /* old source address present */ + ndo->ndo_protocol = "mobile"; mob = (const struct mobile_ip *)bp; if (length < MOBILE_SIZE || !ND_TTEST_SIZE(mob)) { diff --git a/print-mobility.c b/print-mobility.c index 551c316d..138d2396 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -207,6 +207,7 @@ mobility_print(netdissect_options *ndo, unsigned mhlen, hlen; uint8_t type; + ndo->ndo_protocol = "mobility"; mh = (const struct ip6_mobility *)bp; /* 'ep' points to the end of available data. */ diff --git a/print-mpcp.c b/print-mpcp.c index 88862896..6535ad29 100644 --- a/print-mpcp.c +++ b/print-mpcp.c @@ -134,6 +134,7 @@ mpcp_print(netdissect_options *ndo, const u_char *pptr, u_int length) uint8_t grant_numbers, grant; uint8_t queue_sets, queue_set, report_bitmap, report; + ndo->ndo_protocol = "mpcp"; tptr=pptr; mpcp.common_header = (const struct mpcp_common_header_t *)pptr; diff --git a/print-mpls.c b/print-mpls.c index 1ade6e65..db9be428 100644 --- a/print-mpls.c +++ b/print-mpls.c @@ -64,6 +64,7 @@ mpls_print(netdissect_options *ndo, const u_char *bp, u_int length) uint16_t label_stack_depth = 0; enum mpls_packet_type pt = PT_UNKNOWN; + ndo->ndo_protocol = "mpls"; p = bp; ND_PRINT("MPLS"); do { diff --git a/print-mptcp.c b/print-mptcp.c index 4dd450b9..5a7cec8b 100644 --- a/print-mptcp.c +++ b/print-mptcp.c @@ -437,6 +437,7 @@ mptcp_print(netdissect_options *ndo, const struct mptcp_option *opt; u_int subtype; + ndo->ndo_protocol = "mptcp"; if (len < 3) return 0; diff --git a/print-msdp.c b/print-msdp.c index 5fd86422..bb3b95b8 100644 --- a/print-msdp.c +++ b/print-msdp.c @@ -35,6 +35,7 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length) { unsigned int type, len; + ndo->ndo_protocol = "msdp"; ND_TCHECK_3(sp); /* See if we think we're at the beginning of a compound packet */ type = EXTRACT_U_1(sp); diff --git a/print-msnlb.c b/print-msnlb.c index 3d201fa3..5fdf5575 100644 --- a/print-msnlb.c +++ b/print-msnlb.c @@ -52,6 +52,7 @@ msnlb_print(netdissect_options *ndo, const u_char *bp) { const struct msnlb_heartbeat_pkt *hb; + ndo->ndo_protocol = "msnlb"; hb = (const struct msnlb_heartbeat_pkt *)bp; ND_TCHECK_SIZE(hb); diff --git a/print-nflog.c b/print-nflog.c index 522d212c..6a22ca9d 100644 --- a/print-nflog.c +++ b/print-nflog.c @@ -77,6 +77,7 @@ nflog_if_print(netdissect_options *ndo, u_int caplen = h->caplen; u_int length = h->len; + ndo->ndo_protocol = "nflog_if"; if (caplen < sizeof(nflog_hdr_t) || length < sizeof(nflog_hdr_t)) goto trunc; diff --git a/print-nfs.c b/print-nfs.c index e240a0e7..6866b1d3 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -326,6 +326,7 @@ nfsreply_print(netdissect_options *ndo, const struct sunrpc_msg *rp; char srcid[20], dstid[20]; /*fits 32bit*/ + ndo->ndo_protocol = "nfsreply"; nfserr = 0; /* assume no error */ rp = (const struct sunrpc_msg *)bp; @@ -361,6 +362,7 @@ nfsreply_noaddr_print(netdissect_options *ndo, uint32_t rhigh; enum sunrpc_auth_stat rwhy; + ndo->ndo_protocol = "nfsreply_noaddr"; nfserr = 0; /* assume no error */ rp = (const struct sunrpc_msg *)bp; @@ -530,6 +532,7 @@ nfsreq_noaddr_print(netdissect_options *ndo, uint32_t access_flags; struct nfsv3_sattr sa3; + ndo->ndo_protocol = "nfsreq_noaddr"; ND_PRINT("%u", length); nfserr = 0; /* assume no error */ rp = (const struct sunrpc_msg *)bp; diff --git a/print-nsh.c b/print-nsh.c index 5ece5b5e..fc129200 100644 --- a/print-nsh.c +++ b/print-nsh.c @@ -62,6 +62,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len) uint8_t tlv_len; u_int next_len; + ndo->ndo_protocol = "nsh"; /* print Base Header and Service Path Header */ if (len < NSH_BASE_HDR_LEN + NSH_SERVICE_PATH_HDR_LEN) goto trunc; diff --git a/print-ntp.c b/print-ntp.c index faa31fa4..b8772e9e 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -456,6 +456,7 @@ ntp_print(netdissect_options *ndo, u_int mode, version, leapind; uint8_t status; + ndo->ndo_protocol = "ntp"; ND_TCHECK_1(bp->td.status); status = EXTRACT_U_1(bp->td.status); diff --git a/print-null.c b/print-null.c index f1067ff5..f1f66930 100644 --- a/print-null.c +++ b/print-null.c @@ -82,6 +82,7 @@ null_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char u_int caplen = h->caplen; uint32_t family; + ndo->ndo_protocol = "null_if"; if (caplen < NULL_HDRLEN) goto trunc; diff --git a/print-olsr.c b/print-olsr.c index cd96e95d..09b6c74c 100644 --- a/print-olsr.c +++ b/print-olsr.c @@ -327,6 +327,7 @@ olsr_print(netdissect_options *ndo, uint8_t link_type, neighbor_type; const u_char *tptr, *msg_data; + ndo->ndo_protocol = "olsr"; tptr = pptr; if (length < sizeof(struct olsr_common)) { diff --git a/print-openflow.c b/print-openflow.c index ee972cfe..a0cabbe6 100644 --- a/print-openflow.c +++ b/print-openflow.c @@ -134,6 +134,7 @@ trunc: void openflow_print(netdissect_options *ndo, const u_char *cp, const u_int len _U_) { + ndo->ndo_protocol = "openflow"; ND_PRINT(": OpenFlow"); while (cp < ndo->ndo_snapend) cp = of_header_body_print(ndo, cp, ndo->ndo_snapend); diff --git a/print-ospf.c b/print-ospf.c index 8e2bcfae..8907df14 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -1111,6 +1111,7 @@ ospf_print(netdissect_options *ndo, const u_char *dataend; const char *cp; + ndo->ndo_protocol = "ospf"; op = (const struct ospfhdr *)bp; /* XXX Before we do anything else, strip off the MD5 trailer */ diff --git a/print-ospf6.c b/print-ospf6.c index 9164a008..a3800109 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -962,6 +962,7 @@ ospf6_print(netdissect_options *ndo, const char *cp; uint16_t datalen; + ndo->ndo_protocol = "ospf6"; op = (const struct ospf6hdr *)bp; /* If the type is valid translate it, or just print the type */ diff --git a/print-otv.c b/print-otv.c index 88c8cacc..beda42e7 100644 --- a/print-otv.c +++ b/print-otv.c @@ -45,6 +45,7 @@ otv_print(netdissect_options *ndo, const u_char *bp, u_int len) { uint8_t flags; + ndo->ndo_protocol = "otv"; ND_PRINT("OTV, "); if (len < OTV_HDR_LEN) goto trunc; diff --git a/print-pflog.c b/print-pflog.c index 722ce65b..0be4e8ae 100644 --- a/print-pflog.c +++ b/print-pflog.c @@ -90,6 +90,7 @@ pflog_print(netdissect_options *ndo, const struct pfloghdr *hdr) { uint32_t rulenr, subrulenr; + ndo->ndo_protocol = "pflog"; rulenr = EXTRACT_BE_U_4(&hdr->rulenr); subrulenr = EXTRACT_BE_U_4(&hdr->subrulenr); if (subrulenr == (uint32_t)-1) @@ -114,6 +115,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const struct pfloghdr *hdr; uint8_t af; + ndo->ndo_protocol = "pflog_if"; /* check length */ if (caplen < sizeof(uint8_t)) { ND_PRINT("%s", tstr); diff --git a/print-pgm.c b/print-pgm.c index e7bad48a..fdab66f8 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -158,6 +158,7 @@ pgm_print(netdissect_options *ndo, uint8_t opt_type, opt_len; uint32_t seq, opts_len, len, offset; + ndo->ndo_protocol = "pgm"; pgm = (const struct pgm_header *)bp; ip = (const struct ip *)bp2; if (IP_V(ip) == 6) diff --git a/print-pim.c b/print-pim.c index 49c9f465..962f8772 100644 --- a/print-pim.c +++ b/print-pim.c @@ -254,6 +254,7 @@ pimv1_print(netdissect_options *ndo, { u_char type; + ndo->ndo_protocol = "pimv1"; ND_TCHECK_1(bp + 1); type = EXTRACT_U_1(bp + 1); @@ -350,6 +351,7 @@ cisco_autorp_print(netdissect_options *ndo, u_int numrps; u_int hold; + ndo->ndo_protocol = "cisco_autorp"; if (len < 8) goto trunc; ND_TCHECK_1(bp); @@ -461,6 +463,7 @@ pim_print(netdissect_options *ndo, const struct pim *pim = (const struct pim *)bp; uint8_t pim_typever; + ndo->ndo_protocol = "pim"; #ifdef notyet /* currently we see only version and type */ ND_TCHECK_1(pim->pim_rsv); #endif diff --git a/print-pktap.c b/print-pktap.c index 3f28ccb0..6db3de50 100644 --- a/print-pktap.c +++ b/print-pktap.c @@ -106,6 +106,7 @@ pktap_if_print(netdissect_options *ndo, const pktap_header_t *hdr; struct pcap_pkthdr nhdr; + ndo->ndo_protocol = "pktap_if"; if (caplen < sizeof(pktap_header_t) || length < sizeof(pktap_header_t)) { ND_PRINT("[|pktap]"); return (0); diff --git a/print-ppi.c b/print-ppi.c index 09cac11e..c58a3627 100644 --- a/print-ppi.c +++ b/print-ppi.c @@ -64,6 +64,7 @@ ppi_print(netdissect_options *ndo, uint32_t hdrlen; struct pcap_pkthdr nhdr; + ndo->ndo_protocol = "ppi"; if (caplen < sizeof(ppi_header_t)) { ND_PRINT(" %s", tstr); return (caplen); @@ -122,6 +123,7 @@ u_int ppi_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "ppi_if"; return (ppi_print(ndo, h, p)); } diff --git a/print-ppp.c b/print-ppp.c index 7631ca58..a5bf65df 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -1544,6 +1544,7 @@ ppp_print(netdissect_options *ndo, u_int olen = length; /* _o_riginal length */ u_int hdr_len = 0; + ndo->ndo_protocol = "ppp"; /* * Here, we assume that p points to the Address and Control * field (if they present). @@ -1614,6 +1615,7 @@ ppp_if_print(netdissect_options *ndo, u_int length = h->len; u_int caplen = h->caplen; + ndo->ndo_protocol = "ppp_if"; if (caplen < PPP_HDRLEN) { ND_PRINT("[|ppp]"); return (caplen); @@ -1684,6 +1686,7 @@ ppp_hdlc_if_print(netdissect_options *ndo, u_int proto; u_int hdrlen = 0; + ndo->ndo_protocol = "ppp_hdlc_if"; if (caplen < 2) { ND_PRINT("[|ppp]"); return (caplen); @@ -1758,6 +1761,7 @@ ppp_bsdos_if_print(netdissect_options *ndo _U_, const u_char *q; u_int i; + ndo->ndo_protocol = "ppp_bsdos_if"; if (caplen < PPP_BSDI_HDRLEN) { ND_PRINT("[|ppp]"); return (caplen); diff --git a/print-pppoe.c b/print-pppoe.c index f7ac210b..06e330fc 100644 --- a/print-pppoe.c +++ b/print-pppoe.c @@ -87,6 +87,7 @@ static const struct tok pppoetag2str[] = { u_int pppoe_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "pppoe_if"; return (pppoe_print(ndo, p, h->len)); } @@ -97,6 +98,7 @@ pppoe_print(netdissect_options *ndo, const u_char *bp, u_int length) u_int pppoe_length; const u_char *pppoe_packet, *pppoe_payload; + ndo->ndo_protocol = "pppoe"; if (length < PPPOE_HDRLEN) { ND_PRINT("truncated-pppoe %u", length); return (length); diff --git a/print-pptp.c b/print-pptp.c index 25275981..7eb6bc59 100644 --- a/print-pptp.c +++ b/print-pptp.c @@ -929,6 +929,7 @@ pptp_print(netdissect_options *ndo, uint32_t mc; uint16_t ctrl_msg_type; + ndo->ndo_protocol = "pptp"; ND_PRINT(": pptp"); hdr = (const struct pptp_hdr *)dat; diff --git a/print-radius.c b/print-radius.c index b61aa23d..62f61f0c 100644 --- a/print-radius.c +++ b/print-radius.c @@ -1124,6 +1124,7 @@ radius_print(netdissect_options *ndo, const struct radius_hdr *rad; u_int len, auth_idx; + ndo->ndo_protocol = "radius"; ND_TCHECK_LEN(dat, MIN_RADIUS_LEN); rad = (const struct radius_hdr *)dat; len = EXTRACT_BE_U_2(rad->len); diff --git a/print-raw.c b/print-raw.c index 23ced7b0..8d27a06a 100644 --- a/print-raw.c +++ b/print-raw.c @@ -36,6 +36,7 @@ u_int raw_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "raw_if"; if (ndo->ndo_eflag) ND_PRINT("ip: "); diff --git a/print-resp.c b/print-resp.c index 74fc2fdb..76d3744a 100644 --- a/print-resp.c +++ b/print-resp.c @@ -214,6 +214,7 @@ resp_print(netdissect_options *ndo, const u_char *bp, u_int length) { int ret_len = 0, length_cur = length; + ndo->ndo_protocol = "resp"; if(!bp || length <= 0) return; diff --git a/print-rip.c b/print-rip.c index 2c361355..1ec00d6e 100644 --- a/print-rip.c +++ b/print-rip.c @@ -289,6 +289,7 @@ rip_print(netdissect_options *ndo, u_int i, j; unsigned entry_size; + ndo->ndo_protocol = "rip"; if (ndo->ndo_snapend < dat) { ND_PRINT(" %s", tstr); return; diff --git a/print-ripng.c b/print-ripng.c index 8a66cf40..90eddf45 100644 --- a/print-ripng.c +++ b/print-ripng.c @@ -116,6 +116,7 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length) unsigned int length_left; u_int j; + ndo->ndo_protocol = "ripng"; ND_TCHECK_1(rp->rip6_cmd); cmd = EXTRACT_U_1(rp->rip6_cmd); switch (cmd) { diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c index 02fc4c96..8642377c 100644 --- a/print-rpki-rtr.c +++ b/print-rpki-rtr.c @@ -388,6 +388,7 @@ trunc: void rpki_rtr_print(netdissect_options *ndo, const u_char *pptr, u_int len) { + ndo->ndo_protocol = "rpki_rtr"; if (!ndo->ndo_vflag) { ND_PRINT(", RPKI-RTR"); return; diff --git a/print-rrcp.c b/print-rrcp.c index 4d4aa6ed..7e140fb9 100644 --- a/print-rrcp.c +++ b/print-rrcp.c @@ -96,6 +96,7 @@ rrcp_print(netdissect_options *ndo, uint8_t rrcp_proto; uint8_t rrcp_opcode; + ndo->ndo_protocol = "rrcp"; ND_TCHECK_1(cp + RRCP_PROTO_OFFSET); rrcp_proto = EXTRACT_U_1(cp + RRCP_PROTO_OFFSET); ND_TCHECK_1(cp + RRCP_OPCODE_ISREPLY_OFFSET); diff --git a/print-rsvp.c b/print-rsvp.c index eb4c917e..27b6933d 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -1880,6 +1880,7 @@ rsvp_print(netdissect_options *ndo, const u_char *tptr; u_short plen, tlen; + ndo->ndo_protocol = "rsvp"; tptr=pptr; rsvp_com_header = (const struct rsvp_common_header *)pptr; diff --git a/print-rt6.c b/print-rt6.c index 2c67c11d..ab279876 100644 --- a/print-rt6.c +++ b/print-rt6.c @@ -44,6 +44,7 @@ rt6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) u_int i, len, type; const u_char *p; + ndo->ndo_protocol = "rt6"; dp = (const struct ip6_rthdr *)bp; ND_TCHECK_1(dp->ip6r_segleft); diff --git a/print-rtsp.c b/print-rtsp.c index 368f0881..8c04e11a 100644 --- a/print-rtsp.c +++ b/print-rtsp.c @@ -43,5 +43,6 @@ static const char *rtspcmds[] = { void rtsp_print(netdissect_options *ndo, const u_char *pptr, u_int len) { + ndo->ndo_protocol = "rtsp"; txtproto_print(ndo, pptr, len, "rtsp", rtspcmds, RESP_CODE_SECOND_TOKEN); } diff --git a/print-rx.c b/print-rx.c index f91e936c..534278bc 100644 --- a/print-rx.c +++ b/print-rx.c @@ -534,6 +534,7 @@ rx_print(netdissect_options *ndo, uint8_t type, flags; uint32_t opcode; + ndo->ndo_protocol = "rx"; if (!ND_TTEST_LEN(bp, sizeof(struct rx_header))) { ND_PRINT(" [|rx] (%u)", length); return; diff --git a/print-sctp.c b/print-sctp.c index f8d51c96..5aed6842 100644 --- a/print-sctp.c +++ b/print-sctp.c @@ -464,6 +464,7 @@ sctp_print(netdissect_options *ndo, const char *sep; int isforces = 0; + ndo->ndo_protocol = "sctp"; if (sctpPacketLength < sizeof(struct sctpHeader)) { ND_PRINT("truncated-sctp - %ld bytes missing!", diff --git a/print-sflow.c b/print-sflow.c index a6cc8eea..1da0e97b 100644 --- a/print-sflow.c +++ b/print-sflow.c @@ -868,6 +868,7 @@ sflow_print(netdissect_options *ndo, uint32_t sflow_sample_type, sflow_sample_len; uint32_t nsamples; + ndo->ndo_protocol = "sflow"; tptr = pptr; tlen = len; sflow_datagram = (const struct sflow_datagram_t *)pptr; diff --git a/print-sip.c b/print-sip.c index 50a846eb..3be6a383 100644 --- a/print-sip.c +++ b/print-sip.c @@ -50,5 +50,6 @@ static const char *sipcmds[] = { void sip_print(netdissect_options *ndo, const u_char *pptr, u_int len) { + ndo->ndo_protocol = "sip"; txtproto_print(ndo, pptr, len, "sip", sipcmds, RESP_CODE_SECOND_TOKEN); } diff --git a/print-sl.c b/print-sl.c index 2aad552f..161c5efa 100644 --- a/print-sl.c +++ b/print-sl.c @@ -63,6 +63,7 @@ sl_if_print(netdissect_options *ndo, u_int length = h->len; const struct ip *ip; + ndo->ndo_protocol = "sl_if"; if (caplen < SLIP_HDRLEN || length < SLIP_HDRLEN) { ND_PRINT("%s", tstr); return (caplen); @@ -103,6 +104,7 @@ sl_bsdos_if_print(netdissect_options *ndo, u_int length = h->len; const struct ip *ip; + ndo->ndo_protocol = "sl_bsdos_if"; if (caplen < SLIP_HDRLEN) { ND_PRINT("%s", tstr); return (caplen); diff --git a/print-sll.c b/print-sll.c index 24dc2d46..0e570bf6 100644 --- a/print-sll.c +++ b/print-sll.c @@ -134,6 +134,7 @@ sll_print(netdissect_options *ndo, const struct sll_header *sllp, u_int length) { u_short ether_type; + ndo->ndo_protocol = "sll"; ND_PRINT("%3s ",tok2str(sll_pkttype_values,"?",EXTRACT_BE_U_2(sllp->sll_pkttype))); /* @@ -200,6 +201,7 @@ sll_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char int llc_hdrlen; u_int hdrlen; + ndo->ndo_protocol = "sll_if"; if (caplen < SLL_HDR_LEN) { /* * XXX - this "can't happen" because "pcap-linux.c" always diff --git a/print-slow.c b/print-slow.c index 976c5766..087af0ff 100644 --- a/print-slow.c +++ b/print-slow.c @@ -249,6 +249,7 @@ slow_print(netdissect_options *ndo, int print_version; u_int subtype; + ndo->ndo_protocol = "slow"; if (len < 1) goto tooshort; ND_TCHECK_1(pptr); diff --git a/print-smb.c b/print-smb.c index aa4732d6..49d51091 100644 --- a/print-smb.c +++ b/print-smb.c @@ -939,6 +939,7 @@ nbt_tcp_print(netdissect_options *ndo, u_int nbt_len; const u_char *maxbuf; + ndo->ndo_protocol = "nbt_tcp"; if (length < 4) goto trunc; if (ndo->ndo_snapend < data) @@ -1115,6 +1116,7 @@ nbt_udp137_print(netdissect_options *ndo, const u_char *p; u_int total, i; + ndo->ndo_protocol = "nbt_udp137"; ND_TCHECK_2(data + 10); name_trn_id = EXTRACT_BE_U_2(data); response = (EXTRACT_U_1(data + 2) >> 7); @@ -1255,6 +1257,7 @@ smb_tcp_print(netdissect_options *ndo, u_int smb_len; const u_char *maxbuf; + ndo->ndo_protocol = "smb_tcp"; if (length < 4) goto trunc; if (ndo->ndo_snapend < data) @@ -1296,6 +1299,7 @@ nbt_udp138_print(netdissect_options *ndo, { const u_char *maxbuf = data + length; + ndo->ndo_protocol = "nbt_udp138"; if (maxbuf > ndo->ndo_snapend) maxbuf = ndo->ndo_snapend; if (maxbuf <= data) @@ -1392,6 +1396,7 @@ netbeui_print(netdissect_options *ndo, const u_char *data2; int is_truncated = 0; + ndo->ndo_protocol = "netbeui"; if (maxbuf > ndo->ndo_snapend) maxbuf = ndo->ndo_snapend; ND_TCHECK_1(data + 4); @@ -1491,6 +1496,7 @@ ipx_netbios_print(netdissect_options *ndo, u_int i; const u_char *maxbuf; + ndo->ndo_protocol = "ipx_netbios"; maxbuf = data + length; /* Don't go past the end of the captured data in the packet. */ if (maxbuf > ndo->ndo_snapend) diff --git a/print-smtp.c b/print-smtp.c index f1a2582b..a85ea8a9 100644 --- a/print-smtp.c +++ b/print-smtp.c @@ -28,5 +28,6 @@ void smtp_print(netdissect_options *ndo, const u_char *pptr, u_int len) { + ndo->ndo_protocol = "smtp"; txtproto_print(ndo, pptr, len, "smtp", NULL, 0); } diff --git a/print-snmp.c b/print-snmp.c index 3153076d..856309b6 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -1884,6 +1884,7 @@ snmp_print(netdissect_options *ndo, int count = 0; int version = 0; + ndo->ndo_protocol = "snmp"; ND_PRINT(" "); /* initial Sequence */ diff --git a/print-stp.c b/print-stp.c index f0fecaf7..eb5c90f1 100644 --- a/print-stp.c +++ b/print-stp.c @@ -412,6 +412,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length) u_int mstp_len; u_int spb_len; + ndo->ndo_protocol = "stp"; stp_bpdu = (const struct stp_bpdu_*)p; /* Minimum STP Frame size. */ diff --git a/print-sunatm.c b/print-sunatm.c index cb9737b9..f0857c2a 100644 --- a/print-sunatm.c +++ b/print-sunatm.c @@ -69,6 +69,7 @@ sunatm_if_print(netdissect_options *ndo, u_char vpi; u_int traftype; + ndo->ndo_protocol = "sunatm_if"; if (caplen < PKT_BEGIN_POS) { ND_PRINT("[|atm]"); return (caplen); diff --git a/print-sunrpc.c b/print-sunrpc.c index 9c62728f..d5ffe8d4 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -167,6 +167,7 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp, uint32_t x; char srcid[20], dstid[20]; /*fits 32bit*/ + ndo->ndo_protocol = "sunrpc"; rp = (const struct sunrpc_msg *)bp; if (!ndo->ndo_nflag) { diff --git a/print-symantec.c b/print-symantec.c index 4fd834e1..8d938b44 100644 --- a/print-symantec.c +++ b/print-symantec.c @@ -77,6 +77,7 @@ symantec_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ const struct symantec_header *sp; u_short ether_type; + ndo->ndo_protocol = "symantec_if"; if (caplen < sizeof (struct symantec_header)) { ND_PRINT("[|symantec]"); return caplen; diff --git a/print-syslog.c b/print-syslog.c index cdb81148..1a563e00 100644 --- a/print-syslog.c +++ b/print-syslog.c @@ -84,6 +84,7 @@ syslog_print(netdissect_options *ndo, uint16_t pri = 0; uint16_t facility,severity; + ndo->ndo_protocol = "syslog"; /* extract decimal figures that are * encapsulated within < > tags * based on this decimal figure extract the diff --git a/print-tcp.c b/print-tcp.c index ab3dbbf3..3b81059b 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -173,6 +173,7 @@ tcp_print(netdissect_options *ndo, int rev; const struct ip6_hdr *ip6; + ndo->ndo_protocol = "tcp"; tp = (const struct tcphdr *)bp; ip = (const struct ip *)bp2; if (IP_V(ip) == 6) diff --git a/print-telnet.c b/print-telnet.c index 6c3e7d53..204654ce 100644 --- a/print-telnet.c +++ b/print-telnet.c @@ -514,6 +514,7 @@ telnet_print(netdissect_options *ndo, const u_char *sp, u_int length) const u_char *osp; int l; + ndo->ndo_protocol = "telnet"; osp = sp; ND_TCHECK_1(sp); diff --git a/print-tftp.c b/print-tftp.c index 0f0c4069..1cd1c3f8 100644 --- a/print-tftp.c +++ b/print-tftp.c @@ -95,6 +95,7 @@ tftp_print(netdissect_options *ndo, u_int opcode; u_int ui; + ndo->ndo_protocol = "tftp"; /* Print length */ ND_PRINT(" %u", length); diff --git a/print-timed.c b/print-timed.c index ecc4c388..f6bfc8ec 100644 --- a/print-timed.c +++ b/print-timed.c @@ -98,6 +98,7 @@ timed_print(netdissect_options *ndo, uint8_t tsp_type; int sec, usec; + ndo->ndo_protocol = "timed"; ND_TCHECK_1(tsp->tsp_type); tsp_type = EXTRACT_U_1(tsp->tsp_type); if (tsp_type < TSPTYPENUMBER) diff --git a/print-tipc.c b/print-tipc.c index 40bc59c8..4596dd7e 100644 --- a/print-tipc.c +++ b/print-tipc.c @@ -341,6 +341,7 @@ tipc_print(netdissect_options *ndo, const u_char *bp, u_int length _U_, uint32_t w0; u_int user; + ndo->ndo_protocol = "tipc"; ap = (const struct tipc_pkthdr *)bp; ND_TCHECK_4(ap->w0); w0 = EXTRACT_BE_U_4(ap->w0); diff --git a/print-token.c b/print-token.c index fa7f07f4..dcd023c0 100644 --- a/print-token.c +++ b/print-token.c @@ -153,6 +153,7 @@ token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen u_int route_len = 0, hdr_len = TOKEN_HDRLEN; int seg; + ndo->ndo_protocol = "token"; trp = (const struct token_header *)p; if (caplen < TOKEN_HDRLEN) { @@ -244,5 +245,6 @@ token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen u_int token_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "token_if"; return (token_print(ndo, p, h->len, h->caplen)); } diff --git a/print-udld.c b/print-udld.c index dda6fd89..4f444caa 100644 --- a/print-udld.c +++ b/print-udld.c @@ -99,6 +99,7 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length) int code, type, len; const u_char *tptr; + ndo->ndo_protocol = "udld"; if (length < UDLD_HEADER_LEN) goto trunc; diff --git a/print-udp.c b/print-udp.c index 8c558cf5..e56deb65 100644 --- a/print-udp.c +++ b/print-udp.c @@ -390,6 +390,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length, uint16_t sport, dport, ulen; const struct ip6_hdr *ip6; + ndo->ndo_protocol = "udp"; up = (const struct udphdr *)bp; ip = (const struct ip *)bp2; if (IP_V(ip) == 6) diff --git a/print-usb.c b/print-usb.c index e2c1d78d..7b750a06 100644 --- a/print-usb.c +++ b/print-usb.c @@ -243,6 +243,7 @@ u_int usb_linux_48_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "usb_linux_48_byte_if"; if (h->caplen < sizeof(pcap_usb_header)) { ND_PRINT("%s", tstr); return(sizeof(pcap_usb_header)); @@ -266,6 +267,7 @@ u_int usb_linux_64_byte_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { + ndo->ndo_protocol = "usb_linux_64_byte_if"; if (h->caplen < sizeof(pcap_usb_header_mmapped)) { ND_PRINT("%s", tstr); return(sizeof(pcap_usb_header_mmapped)); diff --git a/print-vjc.c b/print-vjc.c index cdfa1c96..4fadc8a1 100644 --- a/print-vjc.c +++ b/print-vjc.c @@ -88,6 +88,7 @@ vjc_print(netdissect_options *ndo, const u_char *bp, u_short proto _U_) { int i; + ndo->ndo_protocol = "vjc"; switch (EXTRACT_U_1(bp) & 0xf0) { case TYPE_IP: if (ndo->ndo_eflag) diff --git a/print-vqp.c b/print-vqp.c index a5b13f66..ab00a799 100644 --- a/print-vqp.c +++ b/print-vqp.c @@ -108,6 +108,7 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len) u_int tlen; uint8_t nitems; + ndo->ndo_protocol = "vqp"; tptr=pptr; tlen = len; vqp_common_header = (const struct vqp_common_header_t *)pptr; diff --git a/print-vrrp.c b/print-vrrp.c index b0db29ce..ae879647 100644 --- a/print-vrrp.c +++ b/print-vrrp.c @@ -110,6 +110,7 @@ vrrp_print(netdissect_options *ndo, int version, type, auth_type = VRRP_AUTH_NONE; /* keep compiler happy */ const char *type_s; + ndo->ndo_protocol = "vrrp"; ND_TCHECK_1(bp); version = (EXTRACT_U_1(bp) & 0xf0) >> 4; type = EXTRACT_U_1(bp) & 0x0f; diff --git a/print-vtp.c b/print-vtp.c index 133de552..7abf3689 100644 --- a/print-vtp.c +++ b/print-vtp.c @@ -123,6 +123,7 @@ vtp_print (netdissect_options *ndo, const u_char *tptr; const struct vtp_vlan_ *vtp_vlan; + ndo->ndo_protocol = "vtp"; if (length < VTP_HEADER_LEN) goto trunc; diff --git a/print-vxlan-gpe.c b/print-vxlan-gpe.c index 038b772e..fb903c21 100644 --- a/print-vxlan-gpe.c +++ b/print-vxlan-gpe.c @@ -64,6 +64,7 @@ vxlan_gpe_print(netdissect_options *ndo, const u_char *bp, u_int len) uint8_t next_protocol; uint32_t vni; + ndo->ndo_protocol = "vxlan_gpe"; if (len < VXLAN_GPE_HDR_LEN) goto trunc; diff --git a/print-vxlan.c b/print-vxlan.c index 80c8ddce..826d2aaf 100644 --- a/print-vxlan.c +++ b/print-vxlan.c @@ -50,6 +50,7 @@ vxlan_print(netdissect_options *ndo, const u_char *bp, u_int len) uint8_t flags; uint32_t vni; + ndo->ndo_protocol = "vxlan"; if (len < VXLAN_HDR_LEN) goto trunc; diff --git a/print-wb.c b/print-wb.c index 4d8f5403..42686906 100644 --- a/print-wb.c +++ b/print-wb.c @@ -402,6 +402,7 @@ wb_print(netdissect_options *ndo, const struct pkt_hdr *ph; uint8_t type; + ndo->ndo_protocol = "wb"; ph = (const struct pkt_hdr *)hdr; if (len < sizeof(*ph) || !ND_TTEST_SIZE(ph)) { ND_PRINT("%s", tstr); diff --git a/print-zephyr.c b/print-zephyr.c index eddbe859..3edbeea4 100644 --- a/print-zephyr.c +++ b/print-zephyr.c @@ -169,6 +169,7 @@ zephyr_print(netdissect_options *ndo, const u_char *cp, int length) int lose = 0; int truncated = 0; + ndo->ndo_protocol = "zephyr"; /* squelch compiler warnings */ #define PARSE_STRING \ diff --git a/print-zeromq.c b/print-zeromq.c index 05dc0c47..eb41414a 100644 --- a/print-zeromq.c +++ b/print-zeromq.c @@ -145,6 +145,7 @@ zmtp1_print(netdissect_options *ndo, const u_char *cp, u_int len) { const u_char *ep = min(ndo->ndo_snapend, cp + len); + ndo->ndo_protocol = "zmtp1"; ND_PRINT(": ZMTP/1.0"); while (cp < ep) cp = zmtp1_print_frame(ndo, cp, ep); @@ -214,6 +215,7 @@ zmtp1_datagram_print(netdissect_options *ndo, const u_char *cp, const u_int len) { const u_char *ep = min(ndo->ndo_snapend, cp + len); + ndo->ndo_protocol = "zmtp1_datagram"; cp = zmtp1_print_intermediate_part(ndo, cp, len); while (cp < ep) cp = zmtp1_print_frame(ndo, cp, ep);