- if (ndo->ndo_snapend < dat) {
- ND_PRINT(" %s", tstr);
- return;
- }
- i = ndo->ndo_snapend - dat;
- if (i > length)
- i = length;
- if (i < sizeof(*rp)) {
- ND_PRINT(" %s", tstr);
- return;
- }
- i -= sizeof(*rp);
-
- rp = (const struct rip *)dat;
-
- vers = EXTRACT_U_1(rp->rip_vers);
- ND_PRINT("%sRIPv%u",
- (ndo->ndo_vflag >= 1) ? "\n\t" : "",
- vers);
-
- if (vers == 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);
- return;
+ ndo->ndo_protocol = "rip";
+ ND_PRINT("%s", (ndo->ndo_vflag >= 1) ? "\n\t" : "");
+ nd_print_protocol_caps(ndo);
+ ND_ICHECKMSG_ZU("packet length", len, <, sizeof(*rp));
+
+ rp = (const struct rip *)p;
+
+ vers = GET_U_1(rp->rip_vers);
+ ND_PRINT("v%u", vers);
+ if (vers != 1 && vers != 2) {
+ ND_PRINT(" [version != 1 && version != 2]");
+ goto invalid;