neighbor = 1;
while (hello_len >= sizeof(nd_ipv4)) {
-
- ND_TCHECK_LEN(msg_data, sizeof(nd_ipv4));
/* print 4 neighbors per line */
-
ND_PRINT("%s%s", GET_IPADDR_STRING(msg_data),
neighbor % 4 == 0 ? "\n\t\t" : " ");
hello_len -= sizeof(nd_ipv4);
}
return (0);
-trunc:
- return -1;
}
ndo->ndo_protocol = "olsr";
tptr = pptr;
+ nd_print_protocol_caps(ndo);
+ ND_PRINT("v%u", (is_ipv6) ? 6 : 4);
+
if (length < sizeof(struct olsr_common)) {
goto trunc;
}
ND_TCHECK_LEN(tptr, sizeof(struct olsr_common));
ptr.common = (const struct olsr_common *)tptr;
- length = min(length, GET_BE_U_2(ptr.common->packet_len));
+ length = ND_MIN(length, GET_BE_U_2(ptr.common->packet_len));
- ND_PRINT("OLSRv%i, seq 0x%04x, length %u",
- (is_ipv6 == 0) ? 4 : 6,
+ ND_PRINT(", seq 0x%04x, length %u",
GET_BE_U_2(ptr.common->packet_seq),
length);
} msgptr;
int msg_len_valid = 0;
- if (is_ipv6)
- {
+ if (is_ipv6) {
ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg6));
msgptr.v6 = (const struct olsr_msg6 *) tptr;
msg_type = GET_U_1(msgptr.v6->msg_type);
msg_tlen = msg_len - sizeof(struct olsr_msg6);
msg_data = tptr + sizeof(struct olsr_msg6);
- }
- else /* (!is_ipv6) */
- {
+ } else { /* (!is_ipv6) */
ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg4));
msgptr.v4 = (const struct olsr_msg4 *) tptr;
msg_type = GET_U_1(msgptr.v4->msg_type);
}
case OLSR_HNA_MSG:
- if (is_ipv6)
- {
+ if (is_ipv6) {
int i = 0;
ND_PRINT("\n\t Advertised networks (total %u)",
msg_data += sizeof(struct olsr_hna6);
msg_tlen -= sizeof(struct olsr_hna6);
}
- }
- else
- {
+ } else {
int col = 0;
ND_PRINT("\n\t Advertised networks (total %u)",
if (msg_tlen < 4)
goto trunc;
- ND_TCHECK_4(msg_data);
name_entries = GET_BE_U_2(msg_data + 2);
addr_size = 4;
if (msg_tlen < 4)
break;
- ND_TCHECK_4(msg_data);
name_entry_type = GET_BE_U_2(msg_data);
name_entry_len = GET_BE_U_2(msg_data + 2);