- register const struct rip6 *rp = (const struct rip6 *)dat;
- register const struct netinfo6 *ni;
- register u_int amt;
- register u_int i;
- int j;
- int trunc;
-
- if (ndo->ndo_snapend < dat)
- return;
- amt = ndo->ndo_snapend - dat;
- i = min(length, amt);
- if (i < (sizeof(struct rip6) - sizeof(struct netinfo6)))
- return;
- i -= (sizeof(struct rip6) - sizeof(struct netinfo6));
-
- switch (rp->rip6_cmd) {
+ const struct rip6 *rp = (const struct rip6 *)dat;
+ uint8_t cmd, vers;
+ const struct netinfo6 *ni;
+ unsigned int length_left;
+ u_int j;
+
+ ndo->ndo_protocol = "ripng";
+ vers = GET_U_1(rp->rip6_vers);
+ if (vers != RIP6_VERSION) {
+ nd_print_protocol(ndo);
+ ND_PRINT(" [version %u, must be %u]", vers, RIP6_VERSION);
+ goto invalid;
+ }
+ cmd = GET_U_1(rp->rip6_cmd);
+ switch (cmd) {