+/*
+ * print a neighbor list with LQ extensions.
+ */
+static int
+olsr_print_lq_neighbor4(netdissect_options *ndo,
+ const u_char *msg_data, u_int hello_len)
+{
+ struct olsr_lq_neighbor4 *lq_neighbor;
+
+ while (hello_len >= sizeof(struct olsr_lq_neighbor4)) {
+
+ lq_neighbor = (struct olsr_lq_neighbor4 *)msg_data;
+ if (!ND_TTEST(*lq_neighbor))
+ return (-1);
+
+ ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%"
+ ", neighbor-link-quality %.2lf%%",
+ ipaddr_string(ndo, lq_neighbor->neighbor),
+ ((double)lq_neighbor->link_quality/2.55),
+ ((double)lq_neighbor->neighbor_link_quality/2.55)));
+
+ msg_data += sizeof(struct olsr_lq_neighbor4);
+ hello_len -= sizeof(struct olsr_lq_neighbor4);
+ }
+ return (0);
+}
+
+#if INET6
+static int
+olsr_print_lq_neighbor6(netdissect_options *ndo,
+ const u_char *msg_data, u_int hello_len)
+{
+ struct olsr_lq_neighbor6 *lq_neighbor;
+
+ while (hello_len >= sizeof(struct olsr_lq_neighbor6)) {
+
+ lq_neighbor = (struct olsr_lq_neighbor6 *)msg_data;
+ if (!ND_TTEST(*lq_neighbor))
+ return (-1);
+
+ ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%"
+ ", neighbor-link-quality %.2lf%%",
+ ip6addr_string(ndo, lq_neighbor->neighbor),
+ ((double)lq_neighbor->link_quality/2.55),
+ ((double)lq_neighbor->neighbor_link_quality/2.55)));
+
+ msg_data += sizeof(struct olsr_lq_neighbor6);
+ hello_len -= sizeof(struct olsr_lq_neighbor6);
+ }
+ return (0);
+}
+#endif /* INET6 */
+
+/*
+ * print a neighbor list.
+ */
+static int
+olsr_print_neighbor(netdissect_options *ndo,
+ const u_char *msg_data, u_int hello_len)
+{
+ int neighbor;
+
+ ND_PRINT((ndo, "\n\t neighbor\n\t\t"));
+ neighbor = 1;
+
+ while (hello_len >= sizeof(struct in_addr)) {
+
+ if (!ND_TTEST2(*msg_data, sizeof(struct in_addr)))
+ return (-1);
+ /* print 4 neighbors per line */
+
+ ND_PRINT((ndo, "%s%s", ipaddr_string(ndo, msg_data),
+ neighbor % 4 == 0 ? "\n\t\t" : " "));
+
+ msg_data += sizeof(struct in_addr);
+ hello_len -= sizeof(struct in_addr);
+ }
+ return (0);
+}
+
+