From e2982e7f6f0b624a773ec5a58885ee80fab46d34 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Le Bail Date: Sun, 7 Jan 2018 11:47:30 +0100 Subject: Update ND_PRINT() as a variadic macro --- print-dvmrp.c | 78 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'print-dvmrp.c') diff --git a/print-dvmrp.c b/print-dvmrp.c index 91daec83..20c5ec36 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -87,7 +87,7 @@ dvmrp_print(netdissect_options *ndo, switch (type) { case DVMRP_PROBE: - ND_PRINT((ndo, " Probe")); + ND_PRINT(" Probe"); if (ndo->ndo_vflag) { if (print_probe(ndo, bp, ep, len) < 0) goto trunc; @@ -95,7 +95,7 @@ dvmrp_print(netdissect_options *ndo, break; case DVMRP_REPORT: - ND_PRINT((ndo, " Report")); + ND_PRINT(" Report"); if (ndo->ndo_vflag > 1) { if (print_report(ndo, bp, ep, len) < 0) goto trunc; @@ -103,21 +103,21 @@ dvmrp_print(netdissect_options *ndo, break; case DVMRP_ASK_NEIGHBORS: - ND_PRINT((ndo, " Ask-neighbors(old)")); + ND_PRINT(" Ask-neighbors(old)"); break; case DVMRP_NEIGHBORS: - ND_PRINT((ndo, " Neighbors(old)")); + ND_PRINT(" Neighbors(old)"); if (print_neighbors(ndo, bp, ep, len) < 0) goto trunc; break; case DVMRP_ASK_NEIGHBORS2: - ND_PRINT((ndo, " Ask-neighbors2")); + ND_PRINT(" Ask-neighbors2"); break; case DVMRP_NEIGHBORS2: - ND_PRINT((ndo, " Neighbors2")); + ND_PRINT(" Neighbors2"); /* * extract version from IGMP group address field */ @@ -132,31 +132,31 @@ dvmrp_print(netdissect_options *ndo, break; case DVMRP_PRUNE: - ND_PRINT((ndo, " Prune")); + ND_PRINT(" Prune"); if (print_prune(ndo, bp) < 0) goto trunc; break; case DVMRP_GRAFT: - ND_PRINT((ndo, " Graft")); + ND_PRINT(" Graft"); if (print_graft(ndo, bp) < 0) goto trunc; break; case DVMRP_GRAFT_ACK: - ND_PRINT((ndo, " Graft-ACK")); + ND_PRINT(" Graft-ACK"); if (print_graft_ack(ndo, bp) < 0) goto trunc; break; default: - ND_PRINT((ndo, " [type %d]", type)); + ND_PRINT(" [type %d]", type); break; } return; trunc: - ND_PRINT((ndo, "[|dvmrp]")); + ND_PRINT("[|dvmrp]"); return; } @@ -171,7 +171,7 @@ print_report(netdissect_options *ndo, while (len > 0) { if (len < 3) { - ND_PRINT((ndo, " [|]")); + ND_PRINT(" [|]"); return (0); } ND_TCHECK_3(bp); @@ -185,16 +185,16 @@ print_report(netdissect_options *ndo, if (EXTRACT_U_1(bp + 2)) width = 4; - ND_PRINT((ndo, "\n\tMask %s", intoa(htonl(mask)))); + ND_PRINT("\n\tMask %s", intoa(htonl(mask))); bp += 3; len -= 3; do { if (bp + width + 1 > ep) { - ND_PRINT((ndo, " [|]")); + ND_PRINT(" [|]"); return (0); } if (len < width + 1) { - ND_PRINT((ndo, "\n\t [Truncated Report]")); + ND_PRINT("\n\t [Truncated Report]"); return (0); } origin = 0; @@ -211,8 +211,8 @@ print_report(netdissect_options *ndo, bp++; done = metric & 0x80; metric &= 0x7f; - ND_PRINT((ndo, "\n\t %s metric %d", intoa(htonl(origin)), - metric)); + ND_PRINT("\n\t %s metric %d", intoa(htonl(origin)), + metric); len -= width + 1; } while (!done); } @@ -231,21 +231,21 @@ print_probe(netdissect_options *ndo, ND_TCHECK_4(bp); if ((len < 4) || ((bp + 4) > ep)) { /* { (ctags) */ - ND_PRINT((ndo, " [|}")); + ND_PRINT(" [|}"); return (0); } genid = (EXTRACT_U_1(bp) << 24) | (EXTRACT_U_1(bp + 1) << 16) | (EXTRACT_U_1(bp + 2) << 8) | EXTRACT_U_1(bp + 3); bp += 4; len -= 4; - ND_PRINT((ndo, ndo->ndo_vflag > 1 ? "\n\t" : " ")); - ND_PRINT((ndo, "genid %u", genid)); + ND_PRINT(ndo->ndo_vflag > 1 ? "\n\t" : " "); + ND_PRINT("genid %u", genid); if (ndo->ndo_vflag < 2) return (0); while ((len > 0) && (bp < ep)) { ND_TCHECK_4(bp); - ND_PRINT((ndo, "\n\tneighbor %s", ipaddr_string(ndo, bp))); + ND_PRINT("\n\tneighbor %s", ipaddr_string(ndo, bp)); bp += 4; len -= 4; } return (0); @@ -276,9 +276,9 @@ print_neighbors(netdissect_options *ndo, len -= 7; while (--ncount >= 0) { ND_TCHECK_4(bp); - ND_PRINT((ndo, " [%s ->", ipaddr_string(ndo, laddr))); - ND_PRINT((ndo, " %s, (%d/%d)]", - ipaddr_string(ndo, bp), metric, thresh)); + ND_PRINT(" [%s ->", ipaddr_string(ndo, laddr)); + ND_PRINT(" %s, (%d/%d)]", + ipaddr_string(ndo, bp), metric, thresh); bp += 4; len -= 4; } @@ -298,7 +298,7 @@ print_neighbors2(netdissect_options *ndo, u_char metric, thresh, flags; int ncount; - ND_PRINT((ndo, " (v %u.%u):", major_version, minor_version)); + ND_PRINT(" (v %u.%u):", major_version, minor_version); while (len > 0 && bp < ep) { ND_TCHECK_8(bp); @@ -314,25 +314,25 @@ print_neighbors2(netdissect_options *ndo, bp++; len -= 8; while (--ncount >= 0 && (len >= 4) && (bp + 4) <= ep) { - ND_PRINT((ndo, " [%s -> ", ipaddr_string(ndo, laddr))); - ND_PRINT((ndo, "%s (%d/%d", ipaddr_string(ndo, bp), - metric, thresh)); + ND_PRINT(" [%s -> ", ipaddr_string(ndo, laddr)); + ND_PRINT("%s (%d/%d", ipaddr_string(ndo, bp), + metric, thresh); if (flags & DVMRP_NF_TUNNEL) - ND_PRINT((ndo, "/tunnel")); + ND_PRINT("/tunnel"); if (flags & DVMRP_NF_SRCRT) - ND_PRINT((ndo, "/srcrt")); + ND_PRINT("/srcrt"); if (flags & DVMRP_NF_QUERIER) - ND_PRINT((ndo, "/querier")); + ND_PRINT("/querier"); if (flags & DVMRP_NF_DISABLED) - ND_PRINT((ndo, "/disabled")); + ND_PRINT("/disabled"); if (flags & DVMRP_NF_DOWN) - ND_PRINT((ndo, "/down")); - ND_PRINT((ndo, ")]")); + ND_PRINT("/down"); + ND_PRINT(")]"); bp += 4; len -= 4; } if (ncount != -1) { - ND_PRINT((ndo, " [|]")); + ND_PRINT(" [|]"); return (0); } } @@ -346,9 +346,9 @@ print_prune(netdissect_options *ndo, const u_char *bp) { ND_TCHECK_LEN(bp, 12); - ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4))); + ND_PRINT(" src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4)); bp += 8; - ND_PRINT((ndo, " timer ")); + ND_PRINT(" timer "); unsigned_relts_print(ndo, EXTRACT_BE_U_4(bp)); return (0); trunc: @@ -360,7 +360,7 @@ print_graft(netdissect_options *ndo, const u_char *bp) { ND_TCHECK_8(bp); - ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4))); + ND_PRINT(" src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4)); return (0); trunc: return (-1); @@ -371,7 +371,7 @@ print_graft_ack(netdissect_options *ndo, const u_char *bp) { ND_TCHECK_8(bp); - ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4))); + ND_PRINT(" src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4)); return (0); trunc: return (-1); -- cgit v1.2.1