- }
- i -= sizeof(*rp);
-
- rp = (const struct rip *)dat;
-
- ND_PRINT((ndo, "%sRIPv%u",
- (ndo->ndo_vflag >= 1) ? "\n\t" : "",
- rp->rip_vers));
-
- switch (rp->rip_vers) {
- case 0:
- /*
- * RFC 1058.
- *
- * XXX - RFC 1058 says
- *
- * 0 Datagrams whose version number is zero are to be ignored.
- * These are from a previous version of the protocol, whose
- * packet format was machine-specific.
- *
- * so perhaps we should just dump the packet, in hex.
- */
- print_unknown_data(ndo, (const uint8_t *)&rp->rip_cmd, "\n\t", length);
- break;
- default:
- /* dump version and lets see if we know the commands name*/
- ND_PRINT((ndo, ", %s, length: %u",
- tok2str(rip_cmd_values,
- "unknown command (%u)",
- rp->rip_cmd),
- length));
-
- if (ndo->ndo_vflag < 1)
- return;
-
- switch (rp->rip_cmd) {
- case RIPCMD_REQUEST:
- case RIPCMD_RESPONSE:
- j = length / sizeof(*ni);
- ND_PRINT((ndo, ", routes: %u%s", j, rp->rip_vers == 2 ? " or less" : ""));
- ni = (const struct rip_netinfo *)(rp + 1);
- for (; i >= sizeof(*ni); ++ni) {
- if (rp->rip_vers == 1)
- {
- rip_entry_print_v1(ndo, ni);
- i -= sizeof(*ni);