+ hello_len,
+ (hello_len_valid == 0) ? " (invalid)" : "");
+
+ if (hello_len_valid == 0)
+ break;
+
+ msg_data += sizeof(struct olsr_hello_link);
+ msg_tlen -= sizeof(struct olsr_hello_link);
+ hello_len -= sizeof(struct olsr_hello_link);
+
+ if (msg_type == OLSR_HELLO_MSG) {
+ olsr_print_neighbor(msg_data, hello_len);
+ } else {
+#if INET6
+ if (is_ipv6)
+ olsr_print_lq_neighbor6(msg_data, hello_len);
+ else
+#endif
+ olsr_print_lq_neighbor4(msg_data, hello_len);
+ }
+
+ msg_data += hello_len;
+ msg_tlen -= hello_len;
+ }
+ break;
+
+ case OLSR_TC_MSG:
+ case OLSR_TC_LQ_MSG:
+ if (!TTEST2(*msg_data, sizeof(struct olsr_tc)))
+ goto trunc;
+
+ ptr.tc = (struct olsr_tc *)msg_data;
+ printf("\n\t advertised neighbor seq 0x%04x",
+ EXTRACT_16BITS(ptr.tc->ans_seq));
+ msg_data += sizeof(struct olsr_tc);
+ msg_tlen -= sizeof(struct olsr_tc);
+
+ if (msg_type == OLSR_TC_MSG) {
+ olsr_print_neighbor(msg_data, msg_tlen);
+ } else {
+#if INET6
+ if (is_ipv6)
+ olsr_print_lq_neighbor6(msg_data, msg_tlen);
+ else
+#endif
+ olsr_print_lq_neighbor4(msg_data, msg_tlen);
+ }
+ break;
+
+ case OLSR_MID_MSG:
+ {
+ size_t addr_size = sizeof(struct in_addr);
+
+#if INET6
+ if (is_ipv6)
+ addr_size = sizeof(struct in6_addr);
+#endif
+
+ while (msg_tlen >= addr_size) {
+ if (!TTEST2(*msg_data, addr_size))
+ goto trunc;
+
+ printf("\n\t interface address %s",
+#if INET6
+ is_ipv6 ? ip6addr_string(msg_data) :
+#endif
+ ipaddr_string(msg_data));
+ msg_data += addr_size;
+ msg_tlen -= addr_size;
+ }
+ break;
+ }
+
+ case OLSR_HNA_MSG:
+ printf("\n\t Advertised networks (total %u)",
+ (unsigned int) (msg_tlen / sizeof(struct olsr_hna6)));
+#if INET6
+ if (is_ipv6)
+ {
+ int i = 0;
+ while (msg_tlen >= sizeof(struct olsr_hna6)) {
+ struct olsr_hna6 *hna6;
+
+ if (!TTEST2(*msg_data, sizeof(struct olsr_hna6)))
+ goto trunc;
+
+ hna6 = (struct olsr_hna6 *)msg_data;
+
+ printf("\n\t #%i: %s/%u",
+ i, ip6addr_string(hna6->network),
+ mask62plen (hna6->mask));
+
+ msg_data += sizeof(struct olsr_hna6);
+ msg_tlen -= sizeof(struct olsr_hna6);
+ }
+ }
+ else
+#endif
+ {
+ int col = 0;
+ while (msg_tlen >= sizeof(struct olsr_hna4)) {
+ if (!TTEST2(*msg_data, sizeof(struct olsr_hna4)))
+ goto trunc;