From: Francois-Xavier Le Bail Date: Mon, 30 Apr 2018 10:52:10 +0000 (+0200) Subject: Rename the fn_printX() functions to nd_printX() X-Git-Tag: tcpdump-4.99-bp~1209 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/3e3e6d2ef4c1b120077378fe32dc0a88ee81f38e Rename the fn_printX() functions to nd_printX() The functions are: nd_print, nd_printztn, nd_printn and nd_printzp. Trying to make it clearer that they currently have to be used only on part of the packet buffer. Update some comments. --- diff --git a/netdissect.h b/netdissect.h index 365b4b95..a491f515 100644 --- a/netdissect.h +++ b/netdissect.h @@ -331,10 +331,10 @@ extern void signed_relts_print(netdissect_options *, int32_t); extern void unsigned_relts_print(netdissect_options *, uint32_t); extern void fn_print_char(netdissect_options *, u_char); -extern int fn_print(netdissect_options *, const u_char *, const u_char *); -extern u_int fn_printztn(netdissect_options *ndo, const u_char *, u_int, const u_char *); -extern int fn_printn(netdissect_options *, const u_char *, u_int, const u_char *); -extern int fn_printzp(netdissect_options *, const u_char *, u_int, const u_char *); +extern int nd_print(netdissect_options *, const u_char *, const u_char *); +extern u_int nd_printztn(netdissect_options *ndo, const u_char *, u_int, const u_char *); +extern int nd_printn(netdissect_options *, const u_char *, u_int, const u_char *); +extern int nd_printzp(netdissect_options *, const u_char *, u_int, const u_char *); /* * Flags for txtproto_print(). diff --git a/print-802_11.c b/print-802_11.c index a3d376b6..e61581dd 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -402,7 +402,7 @@ struct meshcntl_t { #define PRINT_SSID(p) \ if (p.ssid_present) { \ ND_PRINT(" ("); \ - fn_print(ndo, p.ssid.ssid, NULL); \ + nd_print(ndo, p.ssid.ssid, NULL); \ ND_PRINT(")"); \ } diff --git a/print-aoe.c b/print-aoe.c index 322b6fd5..03ca3164 100644 --- a/print-aoe.c +++ b/print-aoe.c @@ -238,7 +238,7 @@ aoev1_query_print(netdissect_options *ndo, ND_TCHECK_LEN(cp, cslen); if (cslen) { ND_PRINT("\n\tConfig String (length %u): ", cslen); - if (fn_printn(ndo, cp, cslen, ndo->ndo_snapend)) + if (nd_printn(ndo, cp, cslen, ndo->ndo_snapend)) goto trunc; } return; diff --git a/print-bfd.c b/print-bfd.c index 8daa56d6..38cbd374 100644 --- a/print-bfd.c +++ b/print-bfd.c @@ -217,7 +217,7 @@ auth_print(netdissect_options *ndo, const u_char *pptr) pptr++; ND_PRINT(", Password: "); /* the length is equal to the password length plus three */ - if (fn_printn(ndo, pptr, auth_len - 3, + if (nd_printn(ndo, pptr, auth_len - 3, ndo->ndo_snapend)) goto trunc; break; diff --git a/print-bgp.c b/print-bgp.c index 8a78ae9e..fe4004d6 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -2955,7 +2955,7 @@ bgp_notification_print(netdissect_options *ndo, else { ND_TCHECK_LEN(tptr + 1, shutdown_comm_length); ND_PRINT(", Shutdown Communication (length: %u): \"", shutdown_comm_length); - (void)fn_printn(ndo, tptr+1, shutdown_comm_length, NULL); + (void)nd_printn(ndo, tptr+1, shutdown_comm_length, NULL); ND_PRINT("\""); remainder_offset += shutdown_comm_length + 1; } diff --git a/print-bootp.c b/print-bootp.c index aef7063c..78d0d2fe 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -361,8 +361,8 @@ bootp_print(netdissect_options *ndo, ND_TCHECK_1(bp->bp_sname); /* check first char only */ if (EXTRACT_U_1(bp->bp_sname)) { ND_PRINT("\n\t sname \""); - if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof(bp->bp_sname), - ndo->ndo_snapend)) { + if (nd_printztn(ndo, bp->bp_sname, (u_int)sizeof(bp->bp_sname), + ndo->ndo_snapend)) { ND_PRINT("\""); ND_PRINT("%s", tstr + 1); return; @@ -372,8 +372,8 @@ bootp_print(netdissect_options *ndo, ND_TCHECK_1(bp->bp_file); /* check first char only */ if (EXTRACT_U_1(bp->bp_file)) { ND_PRINT("\n\t file \""); - if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof(bp->bp_file), - ndo->ndo_snapend)) { + if (nd_printztn(ndo, bp->bp_file, (u_int)sizeof(bp->bp_file), + ndo->ndo_snapend)) { ND_PRINT("\""); ND_PRINT("%s", tstr + 1); return; @@ -712,7 +712,7 @@ rfc1048_print(netdissect_options *ndo, case 'a': /* ASCII strings */ ND_PRINT("\""); - if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) { + if (nd_printn(ndo, bp, len, ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } @@ -853,7 +853,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT("%u/%u ", EXTRACT_U_1(bp), EXTRACT_U_1(bp + 1)); bp += 2; ND_PRINT("\""); - if (fn_printn(ndo, bp, len - 3, ndo->ndo_snapend)) { + if (nd_printn(ndo, bp, len - 3, ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } @@ -876,7 +876,7 @@ rfc1048_print(netdissect_options *ndo, len--; if (type == 0) { ND_PRINT("\""); - if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) { + if (nd_printn(ndo, bp, len, ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } @@ -922,7 +922,7 @@ rfc1048_print(netdissect_options *ndo, case AGENT_SUBOPTION_CIRCUIT_ID: /* fall through */ case AGENT_SUBOPTION_REMOTE_ID: case AGENT_SUBOPTION_SUBSCRIBER_ID: - if (fn_printn(ndo, bp, suboptlen, ndo->ndo_snapend)) + if (nd_printn(ndo, bp, suboptlen, ndo->ndo_snapend)) goto trunc; break; @@ -1020,7 +1020,7 @@ rfc1048_print(netdissect_options *ndo, break; } ND_PRINT("\""); - if (fn_printn(ndo, bp, suboptlen, ndo->ndo_snapend)) { + if (nd_printn(ndo, bp, suboptlen, ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } diff --git a/print-cdp.c b/print-cdp.c index 1e1d66ab..d77bf2cb 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -149,7 +149,7 @@ cdp_print(netdissect_options *ndo, if (!ndo->ndo_vflag) ND_PRINT(", Device-ID "); ND_PRINT("'"); - (void)fn_printn(ndo, tptr, len, NULL); + (void)nd_printn(ndo, tptr, len, NULL); ND_PRINT("'"); break; case 0x02: /* Address */ @@ -158,7 +158,7 @@ cdp_print(netdissect_options *ndo, break; case 0x03: /* Port-ID */ ND_PRINT("'"); - (void)fn_printn(ndo, tptr, len, NULL); + (void)nd_printn(ndo, tptr, len, NULL); ND_PRINT("'"); break; case 0x04: /* Capabilities */ @@ -181,7 +181,7 @@ cdp_print(netdissect_options *ndo, break; case 0x06: /* Platform */ ND_PRINT("'"); - (void)fn_printn(ndo, tptr, len, NULL); + (void)nd_printn(ndo, tptr, len, NULL); ND_PRINT("'"); break; case 0x07: /* Prefixes */ @@ -192,7 +192,7 @@ cdp_print(netdissect_options *ndo, break; case 0x09: /* VTP Mgmt Domain - CDPv2 */ ND_PRINT("'"); - (void)fn_printn(ndo, tptr, len, NULL); + (void)nd_printn(ndo, tptr, len, NULL); ND_PRINT("'"); break; case 0x0a: /* Native VLAN ID - CDPv2 */ @@ -251,7 +251,7 @@ cdp_print(netdissect_options *ndo, break; case 0x14: /* System Name - not documented */ ND_PRINT("'"); - (void)fn_printn(ndo, tptr, len, NULL); + (void)nd_printn(ndo, tptr, len, NULL); ND_PRINT("'"); break; case 0x16: /* System Object ID - not documented */ @@ -264,7 +264,7 @@ cdp_print(netdissect_options *ndo, ND_PRINT("0x%02x", EXTRACT_U_1(tptr)); if (len > 1) { ND_PRINT("/"); - (void)fn_printn(ndo, tptr + 1, len - 1, NULL); + (void)nd_printn(ndo, tptr + 1, len - 1, NULL); } break; default: diff --git a/print-dhcp6.c b/print-dhcp6.c index a45fe5c0..ca9d053e 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -744,7 +744,7 @@ dhcp6opt_print(netdissect_options *ndo, label_len = EXTRACT_U_1(tp); tp++; if (label_len < remain_len - 1) { - (void)fn_printn(ndo, tp, label_len, NULL); + (void)nd_printn(ndo, tp, label_len, NULL); tp += label_len; remain_len -= (label_len + 1); if(EXTRACT_U_1(tp)) ND_PRINT("."); @@ -764,7 +764,7 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (const u_char *)(dh6o + 1); ND_PRINT("="); - (void)fn_printn(ndo, tp, (u_int)optlen, NULL); + (void)nd_printn(ndo, tp, (u_int)optlen, NULL); ND_PRINT(")"); break; diff --git a/print-domain.c b/print-domain.c index 4e211918..d966cb52 100644 --- a/print-domain.c +++ b/print-domain.c @@ -218,7 +218,7 @@ ns_nprint(netdissect_options *ndo, return(NULL); } } else { - if (fn_printn(ndo, cp, l, ndo->ndo_snapend)) + if (nd_printn(ndo, cp, l, ndo->ndo_snapend)) return(NULL); } @@ -249,7 +249,7 @@ ns_cprint(netdissect_options *ndo, return (NULL); i = EXTRACT_U_1(cp); cp++; - if (fn_printn(ndo, cp, i, ndo->ndo_snapend)) + if (nd_printn(ndo, cp, i, ndo->ndo_snapend)) return (NULL); return (cp + i); } @@ -548,7 +548,7 @@ ns_rprint(netdissect_options *ndo, case T_UNSPECA: /* One long string */ if (!ND_TTEST_LEN(cp, len)) return(NULL); - if (fn_printn(ndo, cp, len, ndo->ndo_snapend)) + if (nd_printn(ndo, cp, len, ndo->ndo_snapend)) return(NULL); break; diff --git a/print-dtp.c b/print-dtp.c index 6bb89235..6194dc03 100644 --- a/print-dtp.c +++ b/print-dtp.c @@ -90,7 +90,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) switch (type) { case DTP_DOMAIN_TLV: ND_PRINT(", "); - fn_printzp(ndo, tptr+4, len-4, pptr+length); + nd_printzp(ndo, tptr+4, len-4, pptr+length); break; case DTP_STATUS_TLV: diff --git a/print-hsrp.c b/print-hsrp.c index cc9655ca..ff5cc55a 100644 --- a/print-hsrp.c +++ b/print-hsrp.c @@ -126,8 +126,8 @@ hsrp_print(netdissect_options *ndo, const u_char *bp, u_int len) unsigned_relts_print(ndo, EXTRACT_U_1(hp->hsrp_holdtime)); ND_PRINT(" priority=%u", EXTRACT_U_1(hp->hsrp_priority)); ND_PRINT(" auth=\""); - if (fn_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata), - ndo->ndo_snapend)) { + if (nd_printn(ndo, hp->hsrp_authdata, sizeof(hp->hsrp_authdata), + ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } diff --git a/print-ipx.c b/print-ipx.c index b17cdf61..ed915d06 100644 --- a/print-ipx.c +++ b/print-ipx.c @@ -189,7 +189,7 @@ ipx_sap_print(netdissect_options *ndo, const u_char *ipx, u_int length) ND_PRINT("'"); goto trunc; } - if (fn_printzp(ndo, ipx, 48, ndo->ndo_snapend)) { + if (nd_printzp(ndo, ipx, 48, ndo->ndo_snapend)) { ND_PRINT("'"); goto trunc; } diff --git a/print-isoclns.c b/print-isoclns.c index 2b9d338d..4183a6f9 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -1398,7 +1398,7 @@ isis_print_mcid(netdissect_options *ndo, ND_TCHECK_SIZE(mcid); ND_PRINT("ID: %u, Name: ", EXTRACT_U_1(mcid->format_id)); - if (fn_printzp(ndo, mcid->name, 32, ndo->ndo_snapend)) + if (nd_printzp(ndo, mcid->name, 32, ndo->ndo_snapend)) goto trunc; ND_PRINT("\n\t Lvl: %u", EXTRACT_BE_U_2(mcid->revision_lvl)); @@ -2846,7 +2846,7 @@ isis_print(netdissect_options *ndo, switch (EXTRACT_U_1(tptr)) { case ISIS_SUBTLV_AUTH_SIMPLE: - if (fn_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend)) + if (nd_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend)) goto trunc; break; case ISIS_SUBTLV_AUTH_MD5: @@ -2974,7 +2974,7 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_HOSTNAME: ND_PRINT("\n\t Hostname: "); - if (fn_printzp(ndo, tptr, tmp, ndo->ndo_snapend)) + if (nd_printzp(ndo, tptr, tmp, ndo->ndo_snapend)) goto trunc; break; diff --git a/print-lldp.c b/print-lldp.c index b6af8735..1adbae0d 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -958,7 +958,7 @@ lldp_private_iana_print(netdissect_options *ndo, switch (subtype) { case LLDP_IANA_SUBTYPE_MUDURL: ND_PRINT("\n\t MUD-URL="); - (void)fn_printn(ndo, tptr+4, tlv_len-4, NULL); + (void)nd_printn(ndo, tptr+4, tlv_len-4, NULL); break; default: hexdump=TRUE; diff --git a/print-nfs.c b/print-nfs.c index 6866b1d3..ca70ef50 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -492,7 +492,7 @@ parsefn(netdissect_options *ndo, /* Update 32-bit pointer (NFS filenames padded to 32-bit boundaries) */ dp += ((len + 3) & ~3) / sizeof(*dp); ND_PRINT("\""); - if (fn_printn(ndo, cp, len, ndo->ndo_snapend)) { + if (nd_printn(ndo, cp, len, ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } diff --git a/print-ntp.c b/print-ntp.c index b8772e9e..8adb101d 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -300,7 +300,7 @@ ntp_time_print(netdissect_options *ndo, break; case PRIM_REF: - if (fn_printn(ndo, (const u_char *)&(bp->refid), 4, ndo->ndo_snapend)) + if (nd_printn(ndo, (const u_char *)&(bp->refid), 4, ndo->ndo_snapend)) goto trunc; break; diff --git a/print-olsr.c b/print-olsr.c index ab8b30f7..a50c063c 100644 --- a/print-olsr.c +++ b/print-olsr.c @@ -688,7 +688,7 @@ olsr_print(netdissect_options *ndo, else ND_PRINT(", address %s, name \"", ipaddr_string(ndo, msg_data)); - (void)fn_printn(ndo, msg_data + addr_size, name_entry_len, NULL); + (void)nd_printn(ndo, msg_data + addr_size, name_entry_len, NULL); ND_PRINT("\""); msg_data += addr_size + name_entry_len + name_entry_padding; diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index 9004f927..659ee66b 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -895,7 +895,7 @@ of10_bsn_message_print(netdissect_options *ndo, cp += 4; /* data */ ND_PRINT(", data '"); - if (fn_printn(ndo, cp, len - 8, ep)) { + if (nd_printn(ndo, cp, len - 8, ep)) { ND_PRINT("'"); goto trunc; } @@ -916,7 +916,7 @@ of10_bsn_message_print(netdissect_options *ndo, /* already checked that len >= 4 */ /* data */ ND_PRINT(", data '"); - if (fn_printn(ndo, cp, len - 4, ep)) { + if (nd_printn(ndo, cp, len - 4, ep)) { ND_PRINT("'"); goto trunc; } @@ -1158,7 +1158,7 @@ of10_phy_ports_print(netdissect_options *ndo, /* name */ ND_TCHECK_LEN(cp, OFP_MAX_PORT_NAME_LEN); ND_PRINT(", name '"); - fn_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN); + nd_print(ndo, cp, cp + OFP_MAX_PORT_NAME_LEN); ND_PRINT("'"); cp += OFP_MAX_PORT_NAME_LEN; @@ -1840,31 +1840,31 @@ of10_desc_stats_reply_print(netdissect_options *ndo, /* mfr_desc */ ND_TCHECK_LEN(cp, DESC_STR_LEN); ND_PRINT("\n\t mfr_desc '"); - fn_print(ndo, cp, cp + DESC_STR_LEN); + nd_print(ndo, cp, cp + DESC_STR_LEN); ND_PRINT("'"); cp += DESC_STR_LEN; /* hw_desc */ ND_TCHECK_LEN(cp, DESC_STR_LEN); ND_PRINT("\n\t hw_desc '"); - fn_print(ndo, cp, cp + DESC_STR_LEN); + nd_print(ndo, cp, cp + DESC_STR_LEN); ND_PRINT("'"); cp += DESC_STR_LEN; /* sw_desc */ ND_TCHECK_LEN(cp, DESC_STR_LEN); ND_PRINT("\n\t sw_desc '"); - fn_print(ndo, cp, cp + DESC_STR_LEN); + nd_print(ndo, cp, cp + DESC_STR_LEN); ND_PRINT("'"); cp += DESC_STR_LEN; /* serial_num */ ND_TCHECK_LEN(cp, SERIAL_NUM_LEN); ND_PRINT("\n\t serial_num '"); - fn_print(ndo, cp, cp + SERIAL_NUM_LEN); + nd_print(ndo, cp, cp + SERIAL_NUM_LEN); ND_PRINT("'"); cp += SERIAL_NUM_LEN; /* dp_desc */ ND_TCHECK_LEN(cp, DESC_STR_LEN); ND_PRINT("\n\t dp_desc '"); - fn_print(ndo, cp, cp + DESC_STR_LEN); + nd_print(ndo, cp, cp + DESC_STR_LEN); ND_PRINT("'"); return cp + DESC_STR_LEN; @@ -2012,7 +2012,7 @@ of10_table_stats_reply_print(netdissect_options *ndo, /* name */ ND_TCHECK_LEN(cp, OFP_MAX_TABLE_NAME_LEN); ND_PRINT(", name '"); - fn_print(ndo, cp, cp + OFP_MAX_TABLE_NAME_LEN); + nd_print(ndo, cp, cp + OFP_MAX_TABLE_NAME_LEN); ND_PRINT("'"); cp += OFP_MAX_TABLE_NAME_LEN; /* wildcards */ diff --git a/print-ppp.c b/print-ppp.c index ceb053f5..beb8a69d 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -562,7 +562,7 @@ handle_ctrl_proto(netdissect_options *ndo, /* RFC 1661 says this is intended to be human readable */ if (len > 8) { ND_PRINT("\n\t Message\n\t "); - if (fn_printn(ndo, tptr + 4, len - 4, ndo->ndo_snapend)) + if (nd_printn(ndo, tptr + 4, len - 4, ndo->ndo_snapend)) goto trunc; } break; diff --git a/print-resp.c b/print-resp.c index 76d3744a..cb6a011e 100644 --- a/print-resp.c +++ b/print-resp.c @@ -205,7 +205,7 @@ static int resp_get_length(netdissect_options *, const u_char *, int, const u_ch */ #define RESP_PRINT_SEGMENT(_ndo, _bp, _len) \ ND_PRINT(" \""); \ - if (fn_printn(_ndo, _bp, _len, _ndo->ndo_snapend)) \ + if (nd_printn(_ndo, _bp, _len, _ndo->ndo_snapend)) \ goto trunc; \ fn_print_char(_ndo, '"'); diff --git a/print-rip.c b/print-rip.c index 1ec00d6e..4c78014e 100644 --- a/print-rip.c +++ b/print-rip.c @@ -233,7 +233,7 @@ rip_entry_print_v2(netdissect_options *ndo, const u_char *p, remaining -= sizeof(*eh); if (auth_type == 2) { ND_PRINT("\n\t Simple Text Authentication data: "); - if (fn_printzp(ndo, p, RIP_AUTHLEN, p + remaining)) + if (nd_printzp(ndo, p, RIP_AUTHLEN, p + remaining)) return (0); } else if (auth_type == 3) { const struct rip_auth_crypto_v2 *ch; diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c index fa8ed9da..fcc2f1c2 100644 --- a/print-rpki-rtr.c +++ b/print-rpki-rtr.c @@ -353,9 +353,9 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len if (text_length) { if (pdu_len < tlen + text_length) goto invalid; - /* fn_printn() makes the bounds check */ + /* nd_printn() makes the bounds check */ ND_PRINT("%sError text: ", indent_string(indent+2)); - if (fn_printn(ndo, tptr + tlen, text_length, ndo->ndo_snapend)) + if (nd_printn(ndo, tptr + tlen, text_length, ndo->ndo_snapend)) goto trunc; } } diff --git a/print-rx.c b/print-rx.c index 534278bc..d687a3bb 100644 --- a/print-rx.c +++ b/print-rx.c @@ -771,7 +771,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, goto trunc; \ bp += sizeof(uint32_t); \ ND_PRINT(" \""); \ - if (fn_printn(ndo, bp, _i, ndo->ndo_snapend)) \ + if (nd_printn(ndo, bp, _i, ndo->ndo_snapend)) \ goto trunc; \ ND_PRINT("\""); \ bp += ((_i + sizeof(uint32_t) - 1) / sizeof(uint32_t)) * sizeof(uint32_t); \ @@ -869,7 +869,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport, } \ s[(MAX)] = '\0'; \ ND_PRINT(" \""); \ - fn_print(ndo, s, NULL); \ + nd_print(ndo, s, NULL); \ ND_PRINT("\""); \ } @@ -1190,7 +1190,7 @@ acl_print(netdissect_options *ndo, goto finish; s += n; ND_PRINT(" +{"); - fn_print(ndo, (u_char *)user, NULL); + nd_print(ndo, (u_char *)user, NULL); ND_PRINT(" "); ACLOUT(acl); ND_PRINT("}"); @@ -1204,7 +1204,7 @@ acl_print(netdissect_options *ndo, goto finish; s += n; ND_PRINT(" -{"); - fn_print(ndo, (u_char *)user, NULL); + nd_print(ndo, (u_char *)user, NULL); ND_PRINT(" "); ACLOUT(acl); ND_PRINT("}"); diff --git a/print-snmp.c b/print-snmp.c index 856309b6..86c77294 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -705,7 +705,7 @@ asn1_print_string(netdissect_options *ndo, struct be *elem) p = elem->data.str; if (printable) { ND_PRINT("\""); - if (fn_printn(ndo, p, asnlen, ndo->ndo_snapend)) { + if (nd_printn(ndo, p, asnlen, ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } diff --git a/print-stp.c b/print-stp.c index 548278b9..a59b22fb 100644 --- a/print-stp.c +++ b/print-stp.c @@ -292,7 +292,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_PRINT("\n\tv3len %u, ", EXTRACT_BE_U_2(ptr + MST_BPDU_VER3_LEN_OFFSET)); ND_TCHECK_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12); ND_PRINT("MCID Name "); - if (fn_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend)) + if (nd_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend)) goto trunc; ND_PRINT(", rev %u," "\n\t\tdigest %08x%08x%08x%08x, ", @@ -366,7 +366,7 @@ stp_print_spb_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_PRINT("\n\tv4len %u, ", EXTRACT_BE_U_2(ptr + offset)); ND_PRINT("AUXMCID Name "); - if (fn_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32, + if (nd_printzp(ndo, ptr + offset + SPB_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend)) goto trunc; ND_PRINT(", Rev %u,\n\t\tdigest %08x%08x%08x%08x", diff --git a/print-tftp.c b/print-tftp.c index 1cd1c3f8..548a36c5 100644 --- a/print-tftp.c +++ b/print-tftp.c @@ -121,7 +121,7 @@ tftp_print(netdissect_options *ndo, ND_PRINT(" "); /* Print filename */ ND_PRINT("\""); - ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend); + ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend); ND_PRINT("\""); if (ui == 0) goto trunc; @@ -132,7 +132,7 @@ tftp_print(netdissect_options *ndo, if (length == 0) goto trunc; /* no mode */ ND_PRINT(" "); - ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend); + ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend); if (ui == 0) goto trunc; bp += ui; @@ -143,7 +143,7 @@ tftp_print(netdissect_options *ndo, ND_TCHECK_1(bp); if (EXTRACT_U_1(bp) != '\0') ND_PRINT(" "); - ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend); + ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend); if (ui == 0) goto trunc; bp += ui; @@ -157,7 +157,7 @@ tftp_print(netdissect_options *ndo, ND_TCHECK_1(bp); if (EXTRACT_U_1(bp) != '\0') ND_PRINT(" "); - ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend); + ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend); if (ui == 0) goto trunc; bp += ui; @@ -186,7 +186,7 @@ tftp_print(netdissect_options *ndo, if (length == 0) goto trunc; /* no error message */ ND_PRINT(" \""); - ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend); + ui = nd_printztn(ndo, bp, length, ndo->ndo_snapend); ND_PRINT("\""); if (ui == 0) goto trunc; diff --git a/print-timed.c b/print-timed.c index f6bfc8ec..1f7bc823 100644 --- a/print-timed.c +++ b/print-timed.c @@ -139,7 +139,7 @@ timed_print(netdissect_options *ndo, break; } ND_PRINT(" name "); - if (fn_print(ndo, (const u_char *)tsp->tsp_name, (const u_char *)tsp->tsp_name + sizeof(tsp->tsp_name))) + if (nd_print(ndo, (const u_char *)tsp->tsp_name, (const u_char *)tsp->tsp_name + sizeof(tsp->tsp_name))) goto trunc; return; diff --git a/print-udld.c b/print-udld.c index 3b77dd51..a9ada9e4 100644 --- a/print-udld.c +++ b/print-udld.c @@ -155,12 +155,12 @@ udld_print (netdissect_options *ndo, const u_char *pptr, u_int length) case UDLD_PORT_ID_TLV: case UDLD_DEVICE_NAME_TLV: ND_PRINT(", "); - fn_printzp(ndo, tptr, len, NULL); + nd_printzp(ndo, tptr, len, NULL); break; case UDLD_ECHO_TLV: ND_PRINT(", "); - (void)fn_printn(ndo, tptr, len, NULL); + (void)nd_printn(ndo, tptr, len, NULL); break; case UDLD_MESSAGE_INTERVAL_TLV: diff --git a/print-vrrp.c b/print-vrrp.c index ae879647..f628f905 100644 --- a/print-vrrp.c +++ b/print-vrrp.c @@ -171,7 +171,7 @@ vrrp_print(netdissect_options *ndo, if (version == 2 && auth_type == VRRP_AUTH_SIMPLE) { /* simple text password */ ND_TCHECK_1(bp + 7); ND_PRINT(" auth \""); - if (fn_printn(ndo, bp, 8, ndo->ndo_snapend)) { + if (nd_printn(ndo, bp, 8, ndo->ndo_snapend)) { ND_PRINT("\""); goto trunc; } diff --git a/print-vtp.c b/print-vtp.c index 5a10b25f..358a294e 100644 --- a/print-vtp.c +++ b/print-vtp.c @@ -150,7 +150,7 @@ vtp_print (netdissect_options *ndo, ND_PRINT(" [invalid MgmtD Len %u]", mgmtd_len); return; } - fn_printzp(ndo, tptr + 4, mgmtd_len, NULL); + nd_printzp(ndo, tptr + 4, mgmtd_len, NULL); ND_PRINT(", %s: %u", tok2str(vtp_header_values, "Unknown", type), EXTRACT_U_1(tptr + 2)); @@ -267,7 +267,7 @@ vtp_print (netdissect_options *ndo, if (len < 4*((name_len + 3)/4)) goto trunc; ND_TCHECK_LEN(tptr, name_len); - fn_printzp(ndo, tptr, name_len, NULL); + nd_printzp(ndo, tptr, name_len, NULL); /* * Vlan names are aligned to 32-bit boundaries. diff --git a/print-wb.c b/print-wb.c index 42686906..74591ce1 100644 --- a/print-wb.c +++ b/print-wb.c @@ -205,7 +205,7 @@ wb_id(netdissect_options *ndo, cp = (const char *)(io + nid); if (ND_TTEST_LEN(cp, len)) { ND_PRINT("\""); - fn_print(ndo, (const u_char *)cp, (const u_char *)cp + len); + nd_print(ndo, (const u_char *)cp, (const u_char *)cp + len); ND_PRINT("\""); } diff --git a/util-print.c b/util-print.c index b85299ca..a8cb8f04 100644 --- a/util-print.c +++ b/util-print.c @@ -87,13 +87,14 @@ fn_print_char(netdissect_options *ndo, u_char c) } /* - * Print out a null-terminated filename (or other ASCII string). + * Print out a null-terminated filename (or other ASCII string), part of + * the packet buffer. * If ep is NULL, assume no truncation check is needed. * Return true if truncated. * Stop at ep (if given) or before the null char, whichever is first. */ int -fn_print(netdissect_options *ndo, +nd_print(netdissect_options *ndo, const u_char *s, const u_char *ep) { int ret; @@ -114,13 +115,13 @@ fn_print(netdissect_options *ndo, /* * Print out a null-terminated filename (or other ASCII string) from - * a fixed-length buffer. + * a fixed-length buffer, part of the packet buffer. * If ep is NULL, assume no truncation check is needed. * Return the number of bytes of string processed, including the * terminating null, if not truncated. Return 0 if truncated. */ u_int -fn_printztn(netdissect_options *ndo, +nd_printztn(netdissect_options *ndo, const u_char *s, u_int n, const u_char *ep) { u_int bytes; @@ -156,13 +157,14 @@ fn_printztn(netdissect_options *ndo, } /* - * Print out a counted filename (or other ASCII string). + * Print out a counted filename (or other ASCII string), part of + * the packet buffer. * If ep is NULL, assume no truncation check is needed. * Return true if truncated. * Stop at ep (if given) or after n bytes, whichever is first. */ int -fn_printn(netdissect_options *ndo, +nd_printn(netdissect_options *ndo, const u_char *s, u_int n, const u_char *ep) { u_char c; @@ -177,14 +179,15 @@ fn_printn(netdissect_options *ndo, } /* - * Print out a null-padded filename (or other ASCII string). + * Print out a null-padded filename (or other ASCII string), part of + * the packet buffer. * If ep is NULL, assume no truncation check is needed. * Return true if truncated. * Stop at ep (if given) or after n bytes or before the null char, * whichever is first. */ int -fn_printzp(netdissect_options *ndo, +nd_printzp(netdissect_options *ndo, const u_char *s, u_int n, const u_char *ep) {