From: Francois-Xavier Le Bail Date: Fri, 15 Jun 2018 13:44:51 +0000 (+0200) Subject: Add the ndo parameter to some functions X-Git-Tag: tcpdump-4.99-bp~879 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/1af20c3adc4dfef93de41d4fcd02f0aeb6bbfd4e Add the ndo parameter to some functions This parameter will be needed at the next step. --- diff --git a/cpack.c b/cpack.c index 12470fc2..94406f26 100644 --- a/cpack.c +++ b/cpack.c @@ -95,7 +95,7 @@ cpack_init(struct cpack_state *cs, const uint8_t *buf, size_t buflen) /* Unpack a 64-bit unsigned integer. */ int -cpack_uint64(struct cpack_state *cs, uint64_t *u) +cpack_uint64(netdissect_options *ndo, struct cpack_state *cs, uint64_t *u) { const uint8_t *next; @@ -111,7 +111,7 @@ cpack_uint64(struct cpack_state *cs, uint64_t *u) /* Unpack a 64-bit signed integer. */ int -cpack_int64(struct cpack_state *cs, int64_t *u) +cpack_int64(netdissect_options *ndo, struct cpack_state *cs, int64_t *u) { const uint8_t *next; @@ -127,7 +127,7 @@ cpack_int64(struct cpack_state *cs, int64_t *u) /* Unpack a 32-bit unsigned integer. */ int -cpack_uint32(struct cpack_state *cs, uint32_t *u) +cpack_uint32(netdissect_options *ndo, struct cpack_state *cs, uint32_t *u) { const uint8_t *next; @@ -143,7 +143,7 @@ cpack_uint32(struct cpack_state *cs, uint32_t *u) /* Unpack a 32-bit signed integer. */ int -cpack_int32(struct cpack_state *cs, int32_t *u) +cpack_int32(netdissect_options *ndo, struct cpack_state *cs, int32_t *u) { const uint8_t *next; @@ -159,7 +159,7 @@ cpack_int32(struct cpack_state *cs, int32_t *u) /* Unpack a 16-bit unsigned integer. */ int -cpack_uint16(struct cpack_state *cs, uint16_t *u) +cpack_uint16(netdissect_options *ndo, struct cpack_state *cs, uint16_t *u) { const uint8_t *next; @@ -175,7 +175,7 @@ cpack_uint16(struct cpack_state *cs, uint16_t *u) /* Unpack a 16-bit signed integer. */ int -cpack_int16(struct cpack_state *cs, int16_t *u) +cpack_int16(netdissect_options *ndo, struct cpack_state *cs, int16_t *u) { const uint8_t *next; @@ -191,7 +191,7 @@ cpack_int16(struct cpack_state *cs, int16_t *u) /* Unpack an 8-bit unsigned integer. */ int -cpack_uint8(struct cpack_state *cs, uint8_t *u) +cpack_uint8(netdissect_options *ndo, struct cpack_state *cs, uint8_t *u) { /* No space left? */ if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len) @@ -206,7 +206,7 @@ cpack_uint8(struct cpack_state *cs, uint8_t *u) /* Unpack an 8-bit signed integer. */ int -cpack_int8(struct cpack_state *cs, int8_t *u) +cpack_int8(netdissect_options *ndo, struct cpack_state *cs, int8_t *u) { /* No space left? */ if ((size_t)(cs->c_next - cs->c_buf) >= cs->c_len) diff --git a/cpack.h b/cpack.h index b9a37850..6e709778 100644 --- a/cpack.h +++ b/cpack.h @@ -30,6 +30,8 @@ #ifndef _CPACK_H #define _CPACK_H +#include "netdissect.h" + struct cpack_state { const uint8_t *c_buf; const uint8_t *c_next; @@ -38,14 +40,14 @@ struct cpack_state { int cpack_init(struct cpack_state *, const uint8_t *, size_t); -int cpack_uint8(struct cpack_state *, uint8_t *); -int cpack_int8(struct cpack_state *, int8_t *); -int cpack_uint16(struct cpack_state *, uint16_t *); -int cpack_int16(struct cpack_state *, int16_t *); -int cpack_uint32(struct cpack_state *, uint32_t *); -int cpack_int32(struct cpack_state *, int32_t *); -int cpack_uint64(struct cpack_state *, uint64_t *); -int cpack_int64(struct cpack_state *, int64_t *); +int cpack_uint8(netdissect_options *, struct cpack_state *, uint8_t *); +int cpack_int8(netdissect_options *, struct cpack_state *, int8_t *); +int cpack_uint16(netdissect_options *, struct cpack_state *, uint16_t *); +int cpack_int16(netdissect_options *, struct cpack_state *, int16_t *); +int cpack_uint32(netdissect_options *, struct cpack_state *, uint32_t *); +int cpack_int32(netdissect_options *, struct cpack_state *, int32_t *); +int cpack_uint64(netdissect_options *, struct cpack_state *, uint64_t *); +int cpack_int64(netdissect_options *, struct cpack_state *, int64_t *); const uint8_t *cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment); const uint8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize); diff --git a/nfsfh.h b/nfsfh.h index 5cf8fc44..bf378bbf 100644 --- a/nfsfh.h +++ b/nfsfh.h @@ -63,4 +63,4 @@ typedef struct { #define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\ dev_eq(a.Fsid_dev, b.Fsid_dev)) -extern void Parse_fh(const unsigned char *, u_int, my_fsid *, uint32_t *, const char **, const char **, int); +extern void Parse_fh(netdissect_options *, const unsigned char *, u_int, my_fsid *, uint32_t *, const char **, const char **, int); diff --git a/parsenfsfh.c b/parsenfsfh.c index 79648abe..a569b54b 100644 --- a/parsenfsfh.c +++ b/parsenfsfh.c @@ -77,11 +77,11 @@ #define FHT_HPUX9 11 #define FHT_BSD44 12 -static int is_UCX(const unsigned char *, u_int); +static int is_UCX(netdissect_options *, const unsigned char *, u_int); void -Parse_fh(const unsigned char *fh, u_int len, my_fsid *fsidp, - uint32_t *inop, +Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len, + my_fsid *fsidp, uint32_t *inop, const char **osnamep, /* if non-NULL, return OS name here */ const char **fsnamep, /* if non-NULL, return server fs name here (for VMS) */ int ourself) /* true if file handle was generated on this host */ @@ -220,7 +220,7 @@ Parse_fh(const unsigned char *fh, u_int len, my_fsid *fsidp, } } else { - if (is_UCX(fhp, len)) { + if (is_UCX(ndo, fhp, len)) { fhtype = FHT_VMSUCX; } else { @@ -429,7 +429,7 @@ Parse_fh(const unsigned char *fh, u_int len, my_fsid *fsidp, * (3) followed by string of nulls */ static int -is_UCX(const unsigned char *fhp, u_int len) +is_UCX(netdissect_options *ndo, const unsigned char *fhp, u_int len) { u_int i; int seen_null = 0; diff --git a/print-802_11.c b/print-802_11.c index 73b79764..51bc878b 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -1947,7 +1947,7 @@ extract_header_length(netdissect_options *ndo, } static int -extract_mesh_header_length(const u_char *p) +extract_mesh_header_length(netdissect_options *ndo, const u_char *p) { return (EXTRACT_U_1(p) &~ 3) ? 0 : 6*(1 + (EXTRACT_U_1(p) & 3)); } @@ -2052,7 +2052,7 @@ ieee802_11_print(netdissect_options *ndo, nd_print_trunc(ndo); return hdrlen; } - meshdrlen = extract_mesh_header_length(p+hdrlen); + meshdrlen = extract_mesh_header_length(ndo, p + hdrlen); hdrlen += meshdrlen; } else meshdrlen = 0; @@ -2561,7 +2561,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_TSFT: { uint64_t tsft; - rc = cpack_uint64(s, &tsft); + rc = cpack_uint64(ndo, s, &tsft); if (rc != 0) goto trunc; ND_PRINT("%" PRIu64 "us tsft ", tsft); @@ -2571,7 +2571,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_FLAGS: { uint8_t flagsval; - rc = cpack_uint8(s, &flagsval); + rc = cpack_uint8(ndo, s, &flagsval); if (rc != 0) goto trunc; *flagsp = flagsval; @@ -2591,7 +2591,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_RATE: { uint8_t rate; - rc = cpack_uint8(s, &rate); + rc = cpack_uint8(ndo, s, &rate); if (rc != 0) goto trunc; /* @@ -2642,10 +2642,10 @@ print_radiotap_field(netdissect_options *ndo, uint16_t frequency; uint16_t flags; - rc = cpack_uint16(s, &frequency); + rc = cpack_uint16(ndo, s, &frequency); if (rc != 0) goto trunc; - rc = cpack_uint16(s, &flags); + rc = cpack_uint16(ndo, s, &flags); if (rc != 0) goto trunc; /* @@ -2662,10 +2662,10 @@ print_radiotap_field(netdissect_options *ndo, uint8_t hopset; uint8_t hoppat; - rc = cpack_uint8(s, &hopset); + rc = cpack_uint8(ndo, s, &hopset); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &hoppat); + rc = cpack_uint8(ndo, s, &hoppat); if (rc != 0) goto trunc; ND_PRINT("fhset %u fhpat %u ", hopset, hoppat); @@ -2675,7 +2675,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_DBM_ANTSIGNAL: { int8_t dbm_antsignal; - rc = cpack_int8(s, &dbm_antsignal); + rc = cpack_int8(ndo, s, &dbm_antsignal); if (rc != 0) goto trunc; ND_PRINT("%ddBm signal ", dbm_antsignal); @@ -2685,7 +2685,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_DBM_ANTNOISE: { int8_t dbm_antnoise; - rc = cpack_int8(s, &dbm_antnoise); + rc = cpack_int8(ndo, s, &dbm_antnoise); if (rc != 0) goto trunc; ND_PRINT("%ddBm noise ", dbm_antnoise); @@ -2695,7 +2695,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_LOCK_QUALITY: { uint16_t lock_quality; - rc = cpack_uint16(s, &lock_quality); + rc = cpack_uint16(ndo, s, &lock_quality); if (rc != 0) goto trunc; ND_PRINT("%u sq ", lock_quality); @@ -2705,7 +2705,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_TX_ATTENUATION: { int16_t tx_attenuation; - rc = cpack_int16(s, &tx_attenuation); + rc = cpack_int16(ndo, s, &tx_attenuation); if (rc != 0) goto trunc; ND_PRINT("%d tx power ", -tx_attenuation); @@ -2715,7 +2715,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_DB_TX_ATTENUATION: { int8_t db_tx_attenuation; - rc = cpack_int8(s, &db_tx_attenuation); + rc = cpack_int8(ndo, s, &db_tx_attenuation); if (rc != 0) goto trunc; ND_PRINT("%ddB tx attenuation ", -db_tx_attenuation); @@ -2725,7 +2725,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_DBM_TX_POWER: { int8_t dbm_tx_power; - rc = cpack_int8(s, &dbm_tx_power); + rc = cpack_int8(ndo, s, &dbm_tx_power); if (rc != 0) goto trunc; ND_PRINT("%ddBm tx power ", dbm_tx_power); @@ -2735,7 +2735,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_ANTENNA: { uint8_t antenna; - rc = cpack_uint8(s, &antenna); + rc = cpack_uint8(ndo, s, &antenna); if (rc != 0) goto trunc; ND_PRINT("antenna %u ", antenna); @@ -2745,7 +2745,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_DB_ANTSIGNAL: { uint8_t db_antsignal; - rc = cpack_uint8(s, &db_antsignal); + rc = cpack_uint8(ndo, s, &db_antsignal); if (rc != 0) goto trunc; ND_PRINT("%udB signal ", db_antsignal); @@ -2755,7 +2755,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_DB_ANTNOISE: { uint8_t db_antnoise; - rc = cpack_uint8(s, &db_antnoise); + rc = cpack_uint8(ndo, s, &db_antnoise); if (rc != 0) goto trunc; ND_PRINT("%udB noise ", db_antnoise); @@ -2765,7 +2765,7 @@ print_radiotap_field(netdissect_options *ndo, case IEEE80211_RADIOTAP_RX_FLAGS: { uint16_t rx_flags; - rc = cpack_uint16(s, &rx_flags); + rc = cpack_uint16(ndo, s, &rx_flags); if (rc != 0) goto trunc; /* Do nothing for now */ @@ -2778,16 +2778,16 @@ print_radiotap_field(netdissect_options *ndo, uint8_t channel; uint8_t maxpower; - rc = cpack_uint32(s, &flags); + rc = cpack_uint32(ndo, s, &flags); if (rc != 0) goto trunc; - rc = cpack_uint16(s, &frequency); + rc = cpack_uint16(ndo, s, &frequency); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &channel); + rc = cpack_uint8(ndo, s, &channel); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &maxpower); + rc = cpack_uint8(ndo, s, &maxpower); if (rc != 0) goto trunc; print_chaninfo(ndo, frequency, flags, presentflags); @@ -2806,13 +2806,13 @@ print_radiotap_field(netdissect_options *ndo, }; float htrate; - rc = cpack_uint8(s, &known); + rc = cpack_uint8(ndo, s, &known); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &flags); + rc = cpack_uint8(ndo, s, &flags); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &mcs_index); + rc = cpack_uint8(ndo, s, &mcs_index); if (rc != 0) goto trunc; if (known & IEEE80211_RADIOTAP_MCS_MCS_INDEX_KNOWN) { @@ -2894,16 +2894,16 @@ print_radiotap_field(netdissect_options *ndo, uint8_t delim_crc; uint8_t reserved; - rc = cpack_uint32(s, &reference_num); + rc = cpack_uint32(ndo, s, &reference_num); if (rc != 0) goto trunc; - rc = cpack_uint16(s, &flags); + rc = cpack_uint16(ndo, s, &flags); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &delim_crc); + rc = cpack_uint8(ndo, s, &delim_crc); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &reserved); + rc = cpack_uint8(ndo, s, &reserved); if (rc != 0) goto trunc; /* Do nothing for now */ @@ -2953,27 +2953,27 @@ print_radiotap_field(netdissect_options *ndo, "unknown (31)" }; - rc = cpack_uint16(s, &known); + rc = cpack_uint16(ndo, s, &known); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &flags); + rc = cpack_uint8(ndo, s, &flags); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &bandwidth); + rc = cpack_uint8(ndo, s, &bandwidth); if (rc != 0) goto trunc; for (i = 0; i < 4; i++) { - rc = cpack_uint8(s, &mcs_nss[i]); + rc = cpack_uint8(ndo, s, &mcs_nss[i]); if (rc != 0) goto trunc; } - rc = cpack_uint8(s, &coding); + rc = cpack_uint8(ndo, s, &coding); if (rc != 0) goto trunc; - rc = cpack_uint8(s, &group_id); + rc = cpack_uint8(ndo, s, &group_id); if (rc != 0) goto trunc; - rc = cpack_uint16(s, &partial_aid); + rc = cpack_uint16(ndo, s, &partial_aid); if (rc != 0) goto trunc; for (i = 0; i < 4; i++) { @@ -3223,23 +3223,23 @@ ieee802_11_radio_print(netdissect_options *ndo, nd_print_trunc(ndo); break; } - if (cpack_uint8(&cpacker, &vendor_oui[0]) != 0) { + if (cpack_uint8(ndo, &cpacker, &vendor_oui[0]) != 0) { nd_print_trunc(ndo); break; } - if (cpack_uint8(&cpacker, &vendor_oui[1]) != 0) { + if (cpack_uint8(ndo, &cpacker, &vendor_oui[1]) != 0) { nd_print_trunc(ndo); break; } - if (cpack_uint8(&cpacker, &vendor_oui[2]) != 0) { + if (cpack_uint8(ndo, &cpacker, &vendor_oui[2]) != 0) { nd_print_trunc(ndo); break; } - if (cpack_uint8(&cpacker, &vendor_subnamespace) != 0) { + if (cpack_uint8(ndo, &cpacker, &vendor_subnamespace) != 0) { nd_print_trunc(ndo); break; } - if (cpack_uint16(&cpacker, &skip_length) != 0) { + if (cpack_uint16(ndo, &cpacker, &skip_length) != 0) { nd_print_trunc(ndo); break; } diff --git a/print-arp.c b/print-arp.c index 034a0566..5e744587 100644 --- a/print-arp.c +++ b/print-arp.c @@ -176,7 +176,7 @@ struct atmarp_pkthdr { #define ATMTPA(ap) (aar_tpa(ap)) static int -isnonzero(const u_char *a, size_t len) +isnonzero(netdissect_options *ndo, const u_char *a, size_t len) { while (len > 0) { if (EXTRACT_U_1(a) != 0) @@ -421,7 +421,7 @@ arp_print(netdissect_options *ndo, case ARPOP_REQUEST: ND_PRINT("who-has "); tpaddr_print_ip(ndo, ap, pro); - if (isnonzero((const u_char *)THA(ap), HRD_LEN(ap))) + if (isnonzero(ndo, (const u_char *)THA(ap), HRD_LEN(ap))) ND_PRINT(" (%s)", linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap))); ND_PRINT(" tell "); diff --git a/print-babel.c b/print-babel.c index 70310d70..e2ed5663 100644 --- a/print-babel.c +++ b/print-babel.c @@ -108,7 +108,7 @@ static const struct tok diversity_str[] = { }; static const char * -format_id(const u_char *id) +format_id(netdissect_options *ndo, const u_char *id) { static char buf[25]; nd_snprintf(buf, 25, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", @@ -467,7 +467,7 @@ babel_print_v2(netdissect_options *ndo, else { ND_PRINT("\n\tRouter Id"); if(len < 10) goto invalid; - ND_PRINT(" %s", format_id(message + 4)); + ND_PRINT(" %s", format_id(ndo, message + 4)); } } break; @@ -577,7 +577,7 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT("(%u hops) for %s seqno %u id %s", EXTRACT_U_1(message + 6), ae == 0 ? "invalid AE 0" : format_prefix(ndo, prefix, plen), - seqno, format_id(message + 8)); + seqno, format_id(ndo, message + 8)); } } break; @@ -713,7 +713,7 @@ babel_print_v2(netdissect_options *ndo, hopc, format_prefix(ndo, prefix, plen)); ND_PRINT("%s) seqno %u id %s", format_prefix(ndo, src_prefix, src_plen), - seqno, format_id(router_id)); + seqno, format_id(ndo, router_id)); } } break; diff --git a/print-cdp.c b/print-cdp.c index e63ce911..0efa0b49 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -87,7 +87,7 @@ static const struct tok cdp_capability_values[] = { static int cdp_print_addr(netdissect_options *, const u_char *, u_int); static int cdp_print_prefixes(netdissect_options *, const u_char *, u_int); -static unsigned int cdp_get_number(const u_char *, u_int); +static unsigned int cdp_get_number(netdissect_options *, const u_char *, u_int); void cdp_print(netdissect_options *ndo, @@ -231,7 +231,7 @@ cdp_print(netdissect_options *ndo, ND_PRINT("app %u, vlan %u", EXTRACT_U_1(tptr), EXTRACT_BE_U_2(tptr + 1)); break; case 0x10: /* Power - not documented */ - ND_PRINT("%1.2fW", cdp_get_number(tptr, len) / 1000.0); + ND_PRINT("%1.2fW", cdp_get_number(ndo, tptr, len) / 1000.0); break; case 0x11: /* MTU - not documented */ if (len < 4) @@ -417,7 +417,8 @@ trunc: /* read in a -byte number, MSB first * (of course this can handle max sizeof(int)) */ -static unsigned int cdp_get_number(const u_char * p, u_int l) +static unsigned int +cdp_get_number(netdissect_options *ndo, const u_char * p, u_int l) { unsigned int res=0; while( l>0 ) diff --git a/print-dccp.c b/print-dccp.c index 8d3ad0ae..b1df446a 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -191,7 +191,8 @@ static const char *dccp_feature_nums[] = { }; static u_int -dccp_csum_coverage(const struct dccp_hdr* dh, u_int len) +dccp_csum_coverage(netdissect_options *ndo, + const struct dccp_hdr* dh, u_int len) { u_int cov; @@ -205,14 +206,14 @@ static uint16_t dccp_cksum(netdissect_options *ndo, const struct ip *ip, const struct dccp_hdr *dh, u_int len) { return nextproto4_cksum(ndo, ip, (const uint8_t *)(const void *)dh, len, - dccp_csum_coverage(dh, len), IPPROTO_DCCP); + dccp_csum_coverage(ndo, dh, len), IPPROTO_DCCP); } static uint16_t dccp6_cksum(netdissect_options *ndo, const struct ip6_hdr *ip6, const struct dccp_hdr *dh, u_int len) { return nextproto6_cksum(ndo, ip6, (const uint8_t *)(const void *)dh, len, - dccp_csum_coverage(dh, len), IPPROTO_DCCP); + dccp_csum_coverage(ndo, dh, len), IPPROTO_DCCP); } static const char *dccp_reset_code(uint8_t code) @@ -222,7 +223,8 @@ static const char *dccp_reset_code(uint8_t code) return dccp_reset_codes[code]; } -static uint64_t dccp_seqno(const u_char *bp) +static uint64_t +dccp_seqno(netdissect_options *ndo, const u_char *bp) { const struct dccp_hdr *dh = (const struct dccp_hdr *)bp; uint64_t seqno; @@ -238,7 +240,7 @@ static uint64_t dccp_seqno(const u_char *bp) } static unsigned int -dccp_basic_hdr_len(const struct dccp_hdr *dh) +dccp_basic_hdr_len(netdissect_options *ndo, const struct dccp_hdr *dh) { return DCCPH_X(dh) ? sizeof(struct dccp_hdr_ext) : sizeof(struct dccp_hdr); } @@ -246,7 +248,7 @@ dccp_basic_hdr_len(const struct dccp_hdr *dh) static void dccp_print_ack_no(netdissect_options *ndo, const u_char *bp) { const struct dccp_hdr *dh = (const struct dccp_hdr *)bp; - const u_char *ackp = bp + dccp_basic_hdr_len(dh); + const u_char *ackp = bp + dccp_basic_hdr_len(ndo, dh); uint64_t ackno; if (DCCPH_X(dh) != 0) { @@ -303,7 +305,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, } /* get the length of the generic header */ - fixed_hdrlen = dccp_basic_hdr_len(dh); + fixed_hdrlen = dccp_basic_hdr_len(ndo, dh); if (len < fixed_hdrlen) { ND_PRINT("truncated-dccp - %u bytes missing!", fixed_hdrlen - len); @@ -488,7 +490,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (ndo->ndo_vflag < 2) return; - ND_PRINT("seq %" PRIu64, dccp_seqno(bp)); + ND_PRINT("seq %" PRIu64, dccp_seqno(ndo, bp)); /* process options */ if (hlen > fixed_hdrlen){ diff --git a/print-forces.c b/print-forces.c index 5bef1f33..f7f0cd55 100644 --- a/print-forces.c +++ b/print-forces.c @@ -429,7 +429,7 @@ tlv_valid(u_int tlvl, u_int rlen) } static int -ilv_valid(const struct forces_ilv *ilv, u_int rlen) +ilv_valid(netdissect_options *ndo, const struct forces_ilv *ilv, u_int rlen) { if (rlen < ILV_HDRL) return INVALID_RLEN; @@ -742,7 +742,7 @@ sdatailv_print(netdissect_options *ndo, char *ib = indent_pr(indent, 1); const u_char *tdp = (const u_char *) ILV_DATA(ilv); ND_TCHECK_SIZE(ilv); - invilv = ilv_valid(ilv, rlen); + invilv = ilv_valid(ndo, ilv, rlen); if (invilv) { ND_PRINT("%s[", ib + 1); hex_print_with_offset(ndo, ib, tdp, rlen, 0); @@ -1399,7 +1399,7 @@ print_metatlv(netdissect_options *ndo, ND_PRINT("\n%s METADATA length %u\n", ib, rlen); while (rlen != 0) { ND_TCHECK_SIZE(ilv); - invilv = ilv_valid(ilv, rlen); + invilv = ilv_valid(ndo, ilv, rlen); if (invilv) { break; } diff --git a/print-hncp.c b/print-hncp.c index c195068e..867c6ddc 100644 --- a/print-hncp.c +++ b/print-hncp.c @@ -157,7 +157,7 @@ is_ipv4_mapped_address(const u_char *addr) } static const char * -format_nid(const u_char *data) +format_nid(netdissect_options *ndo, const u_char *data) { static char buf[4][sizeof("01:01:01:01")]; static int i = 0; @@ -169,7 +169,7 @@ format_nid(const u_char *data) } static const char * -format_256(const u_char *data) +format_256(netdissect_options *ndo, const u_char *data) { static char buf[4][sizeof("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")]; static int i = 0; @@ -489,7 +489,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - node_identifier = format_nid(value); + node_identifier = format_nid(ndo, value); ND_PRINT(" NID: %s", node_identifier); } break; @@ -501,7 +501,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - node_identifier = format_nid(value); + node_identifier = format_nid(ndo, value); endpoint_identifier = EXTRACT_BE_U_4(value + 4); ND_PRINT(" NID: %s EPID: %08x", node_identifier, @@ -529,7 +529,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - node_identifier = format_nid(value); + node_identifier = format_nid(ndo, value); sequence_number = EXTRACT_BE_U_4(value + 4); interval = format_interval(EXTRACT_BE_U_4(value + 8)); hash = EXTRACT_BE_U_8(value + 12); @@ -550,7 +550,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - peer_node_identifier = format_nid(value); + peer_node_identifier = format_nid(ndo, value); peer_endpoint_identifier = EXTRACT_BE_U_4(value + 4); endpoint_identifier = EXTRACT_BE_U_4(value + 8); ND_PRINT(" Peer-NID: %s Peer-EPID: %08x Local-EPID: %08x", @@ -584,7 +584,7 @@ hncp_print_rec(netdissect_options *ndo, } ND_PRINT(" Verdict: %u Fingerprint: %s Common Name: ", EXTRACT_U_1(value), - format_256(value + 4)); + format_256(ndo, value + 4)); (void)nd_printzp(ndo, value + 36, bodylen - 36, NULL); } break; @@ -836,7 +836,7 @@ hncp_print_rec(netdissect_options *ndo, nd_print_invalid(ndo); break; } - ND_PRINT(" PSK: %s", format_256(value)); + ND_PRINT(" PSK: %s", format_256(ndo, value)); hncp_print_rec(ndo, value + 32, bodylen - 32, indent+1); } break; diff --git a/print-ipx.c b/print-ipx.c index c724e87f..67e0eb7f 100644 --- a/print-ipx.c +++ b/print-ipx.c @@ -60,7 +60,7 @@ struct ipxHdr { #define ipxSize 30 -static const char *ipxaddr_string(uint32_t, const u_char *); +static const char *ipxaddr_string(netdissect_options *, uint32_t, const u_char *); static void ipx_decode(netdissect_options *, const struct ipxHdr *, const u_char *, u_int); static void ipx_sap_print(netdissect_options *, const u_char *, u_int); static void ipx_rip_print(netdissect_options *, const u_char *, u_int); @@ -79,11 +79,11 @@ ipx_print(netdissect_options *ndo, const u_char *p, u_int length) ND_TCHECK_2(ipx->srcSkt); ND_PRINT("%s.%04x > ", - ipxaddr_string(EXTRACT_BE_U_4(ipx->srcNet), ipx->srcNode), + ipxaddr_string(ndo, EXTRACT_BE_U_4(ipx->srcNet), ipx->srcNode), EXTRACT_BE_U_2(ipx->srcSkt)); ND_PRINT("%s.%04x: ", - ipxaddr_string(EXTRACT_BE_U_4(ipx->dstNet), ipx->dstNode), + ipxaddr_string(ndo, EXTRACT_BE_U_4(ipx->dstNet), ipx->dstNode), EXTRACT_BE_U_2(ipx->dstSkt)); /* take length from ipx header */ @@ -102,7 +102,7 @@ trunc: } static const char * -ipxaddr_string(uint32_t net, const u_char *node) +ipxaddr_string(netdissect_options *ndo, uint32_t net, const u_char *node) { static char line[256]; @@ -208,7 +208,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length) if (length < 10) goto trunc; ND_PRINT(" addr %s", - ipxaddr_string(EXTRACT_BE_U_4(ipx), ipx + 4)); + ipxaddr_string(ndo, EXTRACT_BE_U_4(ipx), ipx + 4)); ipx += 10; length -= 10; /* diff --git a/print-isakmp.c b/print-isakmp.c index 17e7ede9..3af263a8 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -766,7 +766,7 @@ cookie_find(const cookie_t *in) /* record initiator */ static void -cookie_record(const cookie_t *in, const u_char *bp2) +cookie_record(netdissect_options *ndo, const cookie_t *in, const u_char *bp2) { int i; const struct ip *ip; @@ -802,10 +802,10 @@ cookie_record(const cookie_t *in, const u_char *bp2) ninitiator = (ninitiator + 1) % MAXINITIATORS; } -#define cookie_isinitiator(x, y) cookie_sidecheck((x), (y), 1) -#define cookie_isresponder(x, y) cookie_sidecheck((x), (y), 0) +#define cookie_isinitiator(ndo, x, y) cookie_sidecheck(ndo, (x), (y), 1) +#define cookie_isresponder(ndo, x, y) cookie_sidecheck(ndo, (x), (y), 0) static int -cookie_sidecheck(int i, const u_char *bp2, int initiator) +cookie_sidecheck(netdissect_options *ndo, int i, const u_char *bp2, int initiator) { const struct ip *ip; const struct ip6_hdr *ip6; @@ -2831,13 +2831,13 @@ ikev1_print(netdissect_options *ndo, /* the first packet */ ND_PRINT(" I"); if (bp2) - cookie_record(&base->i_ck, bp2); + cookie_record(ndo, &base->i_ck, bp2); } else ND_PRINT(" ?"); } else { - if (bp2 && cookie_isinitiator(i, bp2)) + if (bp2 && cookie_isinitiator(ndo, i, bp2)) ND_PRINT(" I"); - else if (bp2 && cookie_isresponder(i, bp2)) + else if (bp2 && cookie_isresponder(ndo, i, bp2)) ND_PRINT(" R"); else ND_PRINT(" ?"); diff --git a/print-isoclns.c b/print-isoclns.c index ca330ced..d4b0214c 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -1680,7 +1680,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo, /* shared routine for printing system, node and lsp-ids */ static char * -isis_print_id(const uint8_t *cp, u_int id_len) +isis_print_id(netdissect_options *ndo, const uint8_t *cp, u_int id_len) { u_int i; static char id[sizeof("xxxx.xxxx.xxxx.yy-zz")]; @@ -1866,7 +1866,7 @@ isis_print_ext_is_reach(netdissect_options *ndo, if (tlv_remaining < NODE_ID_LEN) return(0); - ND_PRINT("%sIS Neighbor: %s", ident, isis_print_id(tptr, NODE_ID_LEN)); + ND_PRINT("%sIS Neighbor: %s", ident, isis_print_id(ndo, tptr, NODE_ID_LEN)); tptr+=NODE_ID_LEN; tlv_remaining-=NODE_ID_LEN; @@ -2415,9 +2415,9 @@ isis_print(netdissect_options *ndo, goto trunc; if (ndo->ndo_vflag == 0) { ND_PRINT(", src-id %s", - isis_print_id(header_iih_lan->source_id, SYSTEM_ID_LEN)); + isis_print_id(ndo, header_iih_lan->source_id, SYSTEM_ID_LEN)); ND_PRINT(", lan-id %s, prio %u", - isis_print_id(header_iih_lan->lan_id,NODE_ID_LEN), + isis_print_id(ndo, header_iih_lan->lan_id,NODE_ID_LEN), EXTRACT_U_1(header_iih_lan->priority)); ND_PRINT(", length %u", length); return (1); @@ -2429,14 +2429,14 @@ isis_print(netdissect_options *ndo, } ND_PRINT("\n\t source-id: %s, holding time: %us, Flags: [%s]", - isis_print_id(header_iih_lan->source_id,SYSTEM_ID_LEN), + isis_print_id(ndo, header_iih_lan->source_id,SYSTEM_ID_LEN), EXTRACT_BE_U_2(header_iih_lan->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", EXTRACT_U_1(header_iih_lan->circuit_type))); ND_PRINT("\n\t lan-id: %s, Priority: %u, PDU length: %u", - isis_print_id(header_iih_lan->lan_id, NODE_ID_LEN), + isis_print_id(ndo, header_iih_lan->lan_id, NODE_ID_LEN), EXTRACT_U_1(header_iih_lan->priority) & ISIS_LAN_PRIORITY_MASK, pdu_len); @@ -2459,7 +2459,7 @@ isis_print(netdissect_options *ndo, if (length < ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { - ND_PRINT(", src-id %s", isis_print_id(header_iih_ptp->source_id, SYSTEM_ID_LEN)); + ND_PRINT(", src-id %s", isis_print_id(ndo, header_iih_ptp->source_id, SYSTEM_ID_LEN)); ND_PRINT(", length %u", length); return (1); } @@ -2470,7 +2470,7 @@ isis_print(netdissect_options *ndo, } ND_PRINT("\n\t source-id: %s, holding time: %us, Flags: [%s]", - isis_print_id(header_iih_ptp->source_id,SYSTEM_ID_LEN), + isis_print_id(ndo, header_iih_ptp->source_id,SYSTEM_ID_LEN), EXTRACT_BE_U_2(header_iih_ptp->holding_time), tok2str(isis_iih_circuit_type_values, "unknown circuit type 0x%02x", @@ -2501,7 +2501,7 @@ isis_print(netdissect_options *ndo, goto trunc; if (ndo->ndo_vflag == 0) { ND_PRINT(", lsp-id %s, seq 0x%08x, lifetime %5us", - isis_print_id(header_lsp->lsp_id, LSP_ID_LEN), + isis_print_id(ndo, header_lsp->lsp_id, LSP_ID_LEN), EXTRACT_BE_U_4(header_lsp->sequence_number), EXTRACT_BE_U_2(header_lsp->remaining_lifetime)); ND_PRINT(", length %u", length); @@ -2514,7 +2514,7 @@ isis_print(netdissect_options *ndo, } ND_PRINT("\n\t lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t chksum: 0x%04x", - isis_print_id(header_lsp->lsp_id, LSP_ID_LEN), + isis_print_id(ndo, header_lsp->lsp_id, LSP_ID_LEN), EXTRACT_BE_U_4(header_lsp->sequence_number), EXTRACT_BE_U_2(header_lsp->remaining_lifetime), EXTRACT_BE_U_2(header_lsp->checksum)); @@ -2558,7 +2558,7 @@ isis_print(netdissect_options *ndo, if (length < ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { - ND_PRINT(", src-id %s", isis_print_id(header_csnp->source_id, NODE_ID_LEN)); + ND_PRINT(", src-id %s", isis_print_id(ndo, header_csnp->source_id, NODE_ID_LEN)); ND_PRINT(", length %u", length); return (1); } @@ -2569,12 +2569,12 @@ isis_print(netdissect_options *ndo, } ND_PRINT("\n\t source-id: %s, PDU length: %u", - isis_print_id(header_csnp->source_id, NODE_ID_LEN), + isis_print_id(ndo, header_csnp->source_id, NODE_ID_LEN), pdu_len); ND_PRINT("\n\t start lsp-id: %s", - isis_print_id(header_csnp->start_lsp_id, LSP_ID_LEN)); + isis_print_id(ndo, header_csnp->start_lsp_id, LSP_ID_LEN)); ND_PRINT("\n\t end lsp-id: %s", - isis_print_id(header_csnp->end_lsp_id, LSP_ID_LEN)); + isis_print_id(ndo, header_csnp->end_lsp_id, LSP_ID_LEN)); if (ndo->ndo_vflag > 1) { if (!print_unknown_data(ndo, pptr, "\n\t ", ISIS_CSNP_HEADER_SIZE)) @@ -2596,7 +2596,7 @@ isis_print(netdissect_options *ndo, if (length < ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE) goto trunc; if (ndo->ndo_vflag == 0) { - ND_PRINT(", src-id %s", isis_print_id(header_psnp->source_id, NODE_ID_LEN)); + ND_PRINT(", src-id %s", isis_print_id(ndo, header_psnp->source_id, NODE_ID_LEN)); ND_PRINT(", length %u", length); return (1); } @@ -2607,7 +2607,7 @@ isis_print(netdissect_options *ndo, } ND_PRINT("\n\t source-id: %s, PDU length: %u", - isis_print_id(header_psnp->source_id, NODE_ID_LEN), + isis_print_id(ndo, header_psnp->source_id, NODE_ID_LEN), pdu_len); if (ndo->ndo_vflag > 1) { @@ -2680,7 +2680,7 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_ISNEIGH: while (tlen >= MAC_ADDR_LEN) { ND_TCHECK_LEN(tptr, MAC_ADDR_LEN); - ND_PRINT("\n\t SNPA: %s", isis_print_id(tptr, MAC_ADDR_LEN)); + ND_PRINT("\n\t SNPA: %s", isis_print_id(ndo, tptr, MAC_ADDR_LEN)); tlen -= MAC_ADDR_LEN; tptr += MAC_ADDR_LEN; } @@ -2700,7 +2700,7 @@ isis_print(netdissect_options *ndo, ND_PRINT("\n\t LAN address length %u bytes ", lan_alen); while (tlen >= lan_alen) { ND_TCHECK_LEN(tptr, lan_alen); - ND_PRINT("\n\t\tIS Neighbor: %s", isis_print_id(tptr, lan_alen)); + ND_PRINT("\n\t\tIS Neighbor: %s", isis_print_id(ndo, tptr, lan_alen)); tlen -= lan_alen; tptr +=lan_alen; } @@ -2755,7 +2755,7 @@ isis_print(netdissect_options *ndo, while (tlen >= sizeof(struct isis_tlv_is_reach)) { ND_TCHECK_SIZE(tlv_is_reach); ND_PRINT("\n\t IS Neighbor: %s", - isis_print_id(tlv_is_reach->neighbor_nodeid, NODE_ID_LEN)); + isis_print_id(ndo, tlv_is_reach->neighbor_nodeid, NODE_ID_LEN)); isis_print_metric_block(ndo, &tlv_is_reach->isis_metric_block); tlen -= sizeof(struct isis_tlv_is_reach); tlv_is_reach++; @@ -2767,7 +2767,7 @@ isis_print(netdissect_options *ndo, while (tlen >= sizeof(struct isis_tlv_es_reach)) { ND_TCHECK_SIZE(tlv_es_reach); ND_PRINT("\n\t ES Neighbor: %s", - isis_print_id(tlv_es_reach->neighbor_sysid, SYSTEM_ID_LEN)); + isis_print_id(ndo, tlv_es_reach->neighbor_sysid, SYSTEM_ID_LEN)); isis_print_metric_block(ndo, &tlv_es_reach->isis_metric_block); tlen -= sizeof(struct isis_tlv_es_reach); tlv_es_reach++; @@ -2908,7 +2908,7 @@ isis_print(netdissect_options *ndo, if(tlen>=SYSTEM_ID_LEN) { ND_TCHECK_LEN(tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN); ND_PRINT("\n\t Neighbor System-ID: %s", - isis_print_id(tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN)); + isis_print_id(ndo, tlv_ptp_adj->neighbor_sysid, SYSTEM_ID_LEN)); tlen-=SYSTEM_ID_LEN; } if(tlen>=sizeof(tlv_ptp_adj->neighbor_extd_local_circuit_id)) { @@ -2992,7 +2992,7 @@ isis_print(netdissect_options *ndo, if (tlen < NODE_ID_LEN) break; ND_TCHECK_LEN(tptr, NODE_ID_LEN); - ND_PRINT("\n\t IS Neighbor: %s", isis_print_id(tptr, NODE_ID_LEN)); + ND_PRINT("\n\t IS Neighbor: %s", isis_print_id(ndo, tptr, NODE_ID_LEN)); tptr+=NODE_ID_LEN; tlen-=NODE_ID_LEN; @@ -3030,7 +3030,7 @@ isis_print(netdissect_options *ndo, while(tlen>=sizeof(struct isis_tlv_lsp)) { ND_TCHECK_1(tlv_lsp->lsp_id + LSP_ID_LEN - 1); ND_PRINT("\n\t lsp-id: %s", - isis_print_id(tlv_lsp->lsp_id, LSP_ID_LEN)); + isis_print_id(ndo, tlv_lsp->lsp_id, LSP_ID_LEN)); ND_TCHECK_4(tlv_lsp->sequence_number); ND_PRINT(", seq: 0x%08x", EXTRACT_BE_U_4(tlv_lsp->sequence_number)); ND_TCHECK_2(tlv_lsp->remaining_lifetime); @@ -3060,13 +3060,13 @@ isis_print(netdissect_options *ndo, if (tlv_len >= SYSTEM_ID_LEN + 1) { ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN + 1); ND_PRINT("\n\t Purge Originator System-ID: %s", - isis_print_id(tptr + 1, SYSTEM_ID_LEN)); + isis_print_id(ndo, tptr + 1, SYSTEM_ID_LEN)); } if (tlv_len == 2 * SYSTEM_ID_LEN + 1) { ND_TCHECK_LEN(tptr, 2 * SYSTEM_ID_LEN + 1); ND_PRINT("\n\t Received from System-ID: %s", - isis_print_id(tptr + SYSTEM_ID_LEN + 1, SYSTEM_ID_LEN)); + isis_print_id(ndo, tptr + SYSTEM_ID_LEN + 1, SYSTEM_ID_LEN)); } break; @@ -3114,7 +3114,7 @@ isis_print(netdissect_options *ndo, /* is there an additional sysid field present ?*/ if (tlen == SYSTEM_ID_LEN) { ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN); - ND_PRINT(", for %s", isis_print_id(tptr,SYSTEM_ID_LEN)); + ND_PRINT(", for %s", isis_print_id(ndo, tptr,SYSTEM_ID_LEN)); } break; @@ -3152,7 +3152,7 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_PART_DIS: while (tlen >= SYSTEM_ID_LEN) { ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN); - ND_PRINT("\n\t %s", isis_print_id(tptr, SYSTEM_ID_LEN)); + ND_PRINT("\n\t %s", isis_print_id(ndo, tptr, SYSTEM_ID_LEN)); tptr+=SYSTEM_ID_LEN; tlen-=SYSTEM_ID_LEN; } diff --git a/print-juniper.c b/print-juniper.c index db7f2e15..c4fb9dd8 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -1163,7 +1163,8 @@ ip_heuristic_guess(netdissect_options *ndo, } static int -juniper_read_tlv_value(const u_char *p, u_int tlv_type, u_int tlv_len) +juniper_read_tlv_value(netdissect_options *ndo, + const u_char *p, u_int tlv_type, u_int tlv_len) { int tlv_value; @@ -1288,7 +1289,7 @@ juniper_parse_header(netdissect_options *ndo, tlv_type, tlv_len); - tlv_value = juniper_read_tlv_value(tptr, tlv_type, tlv_len); + tlv_value = juniper_read_tlv_value(ndo, tptr, tlv_type, tlv_len); switch (tlv_type) { case JUNIPER_EXT_TLV_IFD_NAME: /* FIXME */ diff --git a/print-lldp.c b/print-lldp.c index 34373996..ba412566 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -924,7 +924,7 @@ lldp_private_8023_print(netdissect_options *ndo, * Extract 34bits of latitude/longitude coordinates. */ static uint64_t -lldp_extract_latlon(const u_char *tptr) +lldp_extract_latlon(netdissect_options *ndo, const u_char *tptr) { uint64_t latlon; @@ -1037,9 +1037,9 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ND_PRINT("\n\t Latitude resolution %u, latitude value %" PRIu64, - (EXTRACT_U_1(tptr + 5) >> 2), lldp_extract_latlon(tptr + 5)); + (EXTRACT_U_1(tptr + 5) >> 2), lldp_extract_latlon(ndo, tptr + 5)); ND_PRINT("\n\t Longitude resolution %u, longitude value %" PRIu64, - (EXTRACT_U_1(tptr + 10) >> 2), lldp_extract_latlon(tptr + 10)); + (EXTRACT_U_1(tptr + 10) >> 2), lldp_extract_latlon(ndo, tptr + 10)); ND_PRINT("\n\t Altitude type %s (%u)", tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_U_1(tptr + 15) >> 4), (EXTRACT_U_1(tptr + 15) >> 4)); diff --git a/print-nfs.c b/print-nfs.c index 8600afbd..f1db2d77 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -46,8 +46,7 @@ static void nfs_printfh(netdissect_options *, const uint32_t *, const u_int); static int xid_map_enter(netdissect_options *, const struct sunrpc_msg *, const u_char *); -static int xid_map_find(const struct sunrpc_msg *, const u_char *, - uint32_t *, uint32_t *); +static int xid_map_find(netdissect_options *, const struct sunrpc_msg *, const u_char *, uint32_t *, uint32_t *); static void interp_reply(netdissect_options *, const struct sunrpc_msg *, uint32_t, uint32_t, int); static const uint32_t *parse_post_op_attr(netdissect_options *, const uint32_t *, int); @@ -395,7 +394,7 @@ nfsreply_noaddr_print(netdissect_options *ndo, case SUNRPC_MSG_ACCEPTED: ND_PRINT("reply ok %u", length); - if (xid_map_find(rp, bp2, &proc, &vers) >= 0) + if (xid_map_find(ndo, rp, bp2, &proc, &vers) >= 0) interp_reply(ndo, rp, proc, vers, length); break; @@ -916,7 +915,7 @@ nfs_printfh(netdissect_options *ndo, return; } - Parse_fh((const u_char *)dp, len, &fsid, &ino, NULL, &sfsname, 0); + Parse_fh(ndo, (const u_char *)dp, len, &fsid, &ino, NULL, &sfsname, 0); if (sfsname) { /* file system ID is ASCII, not numeric, for this server OS */ @@ -1026,8 +1025,8 @@ xid_map_enter(netdissect_options *ndo, * version in vers return, or returns -1 on failure */ static int -xid_map_find(const struct sunrpc_msg *rp, const u_char *bp, uint32_t *proc, - uint32_t *vers) +xid_map_find(netdissect_options *ndo, const struct sunrpc_msg *rp, + const u_char *bp, uint32_t *proc, uint32_t *vers) { int i; struct xid_map_entry *xmep; diff --git a/print-rx.c b/print-rx.c index b0aadac7..9231aee6 100644 --- a/print-rx.c +++ b/print-rx.c @@ -494,8 +494,8 @@ static struct rx_cache_entry rx_cache[RX_CACHE_SIZE]; static uint32_t rx_cache_next = 0; static uint32_t rx_cache_hint = 0; static void rx_cache_insert(netdissect_options *, const u_char *, const struct ip *, u_int); -static int rx_cache_find(const struct rx_header *, const struct ip *, - uint32_t, uint32_t *); +static int rx_cache_find(netdissect_options *, const struct rx_header *, + const struct ip *, uint32_t, uint32_t *); static void fs_print(netdissect_options *, const u_char *, u_int); static void fs_reply_print(netdissect_options *, const u_char *, u_int, uint32_t); @@ -636,7 +636,7 @@ rx_print(netdissect_options *ndo, EXTRACT_BE_U_4(rxh->seq) == 1) || type == RX_PACKET_TYPE_ABORT) && (flags & RX_CLIENT_INITIATED) == 0 && - rx_cache_find(rxh, (const struct ip *) bp2, + rx_cache_find(ndo, rxh, (const struct ip *) bp2, sport, &opcode)) { switch (sport) { @@ -713,8 +713,8 @@ rx_cache_insert(netdissect_options *ndo, */ static int -rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, - uint32_t *opcode) +rx_cache_find(netdissect_options *ndo, const struct rx_header *rxh, + const struct ip *ip, u_int sport, uint32_t *opcode) { uint32_t i; struct rx_cache_entry *rxent; diff --git a/print-stp.c b/print-stp.c index 0327ba49..b42a019d 100644 --- a/print-stp.c +++ b/print-stp.c @@ -87,7 +87,7 @@ static const struct tok rstp_obj_port_role_values[] = { #define ND_TCHECK_BRIDGE_ID(p) ND_TCHECK_8(p) static char * -stp_print_bridge_id(const u_char *p) +stp_print_bridge_id(netdissect_options *ndo, const u_char *p) { static char bridge_id_str[sizeof("pppp.aa:bb:cc:dd:ee:ff")]; @@ -113,7 +113,7 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK_2(stp_bpdu->port_id); ND_PRINT(", bridge-id %s.%04x, length %u", - stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id), + stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->bridge_id), EXTRACT_BE_U_2(stp_bpdu->port_id), length); /* in non-verbose mode just print the bridge-id */ @@ -130,7 +130,7 @@ stp_print_config_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, (float) EXTRACT_BE_U_2(stp_bpdu->forward_delay) / STP_TIME_BASE); ND_PRINT("\n\troot-id %s, root-pathcost %u", - stp_print_bridge_id((const u_char *)&stp_bpdu->root_id), + stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->root_id), EXTRACT_BE_U_4(stp_bpdu->root_path_cost)); /* Port role is only valid for 802.1w */ @@ -270,12 +270,12 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK_4(stp_bpdu->root_path_cost); ND_PRINT("CIST root-id %s, CIST ext-pathcost %u", - stp_print_bridge_id((const u_char *)&stp_bpdu->root_id), + stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->root_id), EXTRACT_BE_U_4(stp_bpdu->root_path_cost)); ND_TCHECK_SIZE(&stp_bpdu->bridge_id); ND_PRINT("\n\tCIST regional-root-id %s, ", - stp_print_bridge_id((const u_char *)&stp_bpdu->bridge_id)); + stp_print_bridge_id(ndo, (const u_char *)&stp_bpdu->bridge_id)); ND_TCHECK_2(stp_bpdu->port_id); ND_PRINT("CIST port-id %04x,", EXTRACT_BE_U_2(stp_bpdu->port_id)); @@ -308,7 +308,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_TCHECK_BRIDGE_ID(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET); ND_PRINT("\n\tCIST bridge-id %s, ", - stp_print_bridge_id(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET)); + stp_print_bridge_id(ndo, ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET)); ND_TCHECK_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET); ND_PRINT("CIST remaining-hops %u", EXTRACT_U_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET)); @@ -330,7 +330,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, tok2str(rstp_obj_port_role_values, "Unknown", RSTP_EXTRACT_PORT_ROLE(EXTRACT_U_1(ptr + offset)))); ND_PRINT("\n\t\tMSTI regional-root-id %s, pathcost %u", - stp_print_bridge_id(ptr + offset + + stp_print_bridge_id(ndo, ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET), EXTRACT_BE_U_4(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET)); ND_PRINT("\n\t\tMSTI bridge-prio %u, port-prio %u, hops %u", diff --git a/smbutil.c b/smbutil.c index 26a52340..117da960 100644 --- a/smbutil.c +++ b/smbutil.c @@ -69,7 +69,7 @@ int_unix_date(uint32_t dos_date) * in network byte order */ static time_t -make_unix_date(const u_char *date_ptr) +make_unix_date(netdissect_options *ndo, const u_char *date_ptr) { uint32_t dos_date = 0; @@ -83,7 +83,7 @@ make_unix_date(const u_char *date_ptr) * in halfword-swapped network byte order! */ static time_t -make_unix_date2(const u_char *date_ptr) +make_unix_date2(netdissect_options *ndo, const u_char *date_ptr) { uint32_t x, x2; @@ -97,7 +97,7 @@ make_unix_date2(const u_char *date_ptr) * It's originally in "100ns units since jan 1st 1601" */ static time_t -interpret_long_date(const u_char *p) +interpret_long_date(netdissect_options *ndo, const u_char *p) { double d; time_t ret; @@ -766,7 +766,7 @@ smb_fdata1(netdissect_options *ndo, if (x == 0 || x == 0xFFFFFFFF) t = 0; else - t = make_unix_date(buf); + t = make_unix_date(ndo, buf); buf += 4; break; case 2: @@ -775,12 +775,12 @@ smb_fdata1(netdissect_options *ndo, if (x == 0 || x == 0xFFFFFFFF) t = 0; else - t = make_unix_date2(buf); + t = make_unix_date2(ndo, buf); buf += 4; break; case 3: ND_TCHECK_8(buf); - t = interpret_long_date(buf); + t = interpret_long_date(ndo, buf); buf += 8; break; default: