void dvmrp_print(netdissect_options *ndo, register const u_char *bp, register u_int len) { register const u_char *ep; register u_char type; ep = (const u_char *)ndo->ndo_snapend; if (bp >= ep) return; ND_TCHECK(bp[1]); type = bp[1]; /* Skip IGMP header */ bp += 8; len -= 8; switch (type) { case DVMRP_PROBE: ND_PRINT((ndo, " Probe")); if (ndo->ndo_vflag) { if (print_probe(ndo, bp, ep, len) < 0) goto trunc; } break; case DVMRP_REPORT: ND_PRINT((ndo, " Report")); if (ndo->ndo_vflag > 1) { if (print_report(ndo, bp, ep, len) < 0) goto trunc; } break; case DVMRP_ASK_NEIGHBORS: ND_PRINT((ndo, " Ask-neighbors(old)")); break; case DVMRP_NEIGHBORS: ND_PRINT((ndo, " Neighbors(old)")); if (print_neighbors(ndo, bp, ep, len) < 0) goto trunc; break; case DVMRP_ASK_NEIGHBORS2: ND_PRINT((ndo, " Ask-neighbors2")); break; case DVMRP_NEIGHBORS2: ND_PRINT((ndo, " Neighbors2")); /* * extract version and capabilities from IGMP group * address field */ bp -= 4; ND_TCHECK2(bp[0], 4); target_level = (bp[0] << 24) | (bp[1] << 16) | (bp[2] << 8) | bp[3]; bp += 4; if (print_neighbors2(ndo, bp, ep, len) < 0) goto trunc; break; case DVMRP_PRUNE: ND_PRINT((ndo, " Prune")); if (print_prune(ndo, bp) < 0) goto trunc; break; case DVMRP_GRAFT: ND_PRINT((ndo, " Graft")); if (print_graft(ndo, bp) < 0) goto trunc; break; case DVMRP_GRAFT_ACK: ND_PRINT((ndo, " Graft-ACK")); if (print_graft_ack(ndo, bp) < 0) goto trunc; break; default: ND_PRINT((ndo, " [type %d]", type)); break; } return; trunc: ND_PRINT((ndo, "[|dvmrp]")); return; }
void dvmrp_print(netdissect_options *ndo, const u_char *bp, u_int len) { const u_char *ep; u_char type; uint8_t major_version, minor_version; ndo->ndo_protocol = "dvmrp"; ep = ndo->ndo_snapend; if (bp >= ep) return; ND_TCHECK_1(bp + 1); type = GET_U_1(bp + 1); /* Skip IGMP header */ bp += 8; len -= 8; switch (type) { case DVMRP_PROBE: ND_PRINT(" Probe"); if (ndo->ndo_vflag) { if (print_probe(ndo, bp, ep, len) < 0) goto trunc; } break; case DVMRP_REPORT: ND_PRINT(" Report"); if (ndo->ndo_vflag > 1) { if (print_report(ndo, bp, ep, len) < 0) goto trunc; } break; case DVMRP_ASK_NEIGHBORS: ND_PRINT(" Ask-neighbors(old)"); break; case DVMRP_NEIGHBORS: ND_PRINT(" Neighbors(old)"); if (print_neighbors(ndo, bp, ep, len) < 0) goto trunc; break; case DVMRP_ASK_NEIGHBORS2: ND_PRINT(" Ask-neighbors2"); break; case DVMRP_NEIGHBORS2: ND_PRINT(" Neighbors2"); /* * extract version from IGMP group address field */ bp -= 4; ND_TCHECK_4(bp); major_version = GET_U_1(bp + 3); minor_version = GET_U_1(bp + 2); bp += 4; if (print_neighbors2(ndo, bp, ep, len, major_version, minor_version) < 0) goto trunc; break; case DVMRP_PRUNE: ND_PRINT(" Prune"); if (print_prune(ndo, bp) < 0) goto trunc; break; case DVMRP_GRAFT: ND_PRINT(" Graft"); if (print_graft(ndo, bp) < 0) goto trunc; break; case DVMRP_GRAFT_ACK: ND_PRINT(" Graft-ACK"); if (print_graft_ack(ndo, bp) < 0) goto trunc; break; default: ND_PRINT(" [type %u]", type); break; } return; trunc: nd_print_trunc(ndo); return; }