* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE.
*
- * Optimized Link State Protocl (OLSR) as per rfc3626
- *
* IPv6 additions by Florian Forster <octo at verplant.org>
*/
+/* \summary: Optimized Link State Routing Protocol (OLSR) printer */
+
+/* specification: RFC 3626 */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
-#include "interface.h"
+#include "netdissect.h"
#include "addrtoname.h"
#include "extract.h"
if (!ND_TTEST(*lq_neighbor))
return (-1);
- ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%"
- ", neighbor-link-quality %.2lf%%",
+ ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2f%%"
+ ", neighbor-link-quality %.2f%%",
ipaddr_string(ndo, lq_neighbor->neighbor),
((double)lq_neighbor->link_quality/2.55),
((double)lq_neighbor->neighbor_link_quality/2.55)));
return (0);
}
-#if INET6
static int
olsr_print_lq_neighbor6(netdissect_options *ndo,
const u_char *msg_data, u_int hello_len)
if (!ND_TTEST(*lq_neighbor))
return (-1);
- ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%"
- ", neighbor-link-quality %.2lf%%",
+ ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2f%%"
+ ", neighbor-link-quality %.2f%%",
ip6addr_string(ndo, lq_neighbor->neighbor),
((double)lq_neighbor->link_quality/2.55),
((double)lq_neighbor->neighbor_link_quality/2.55)));
}
return (0);
}
-#endif /* INET6 */
/*
* print a neighbor list.
ND_TCHECK2(*tptr, sizeof(struct olsr_msg4));
-#if INET6
if (is_ipv6)
{
msgptr.v6 = (const struct olsr_msg6 *) tptr;
}
ND_PRINT((ndo, "\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
- "\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s",
+ "\n\t vtime %.3fs, msg-seq 0x%04x, length %u%s",
tok2str(olsr_msg_values, "Unknown", msg_type),
msg_type, ip6addr_string(ndo, msgptr.v6->originator),
msgptr.v6->ttl,
msg_data = tptr + sizeof(struct olsr_msg6);
}
else /* (!is_ipv6) */
-#endif /* INET6 */
{
msgptr.v4 = (const struct olsr_msg4 *) tptr;
msg_type = msgptr.v4->msg_type;
}
ND_PRINT((ndo, "\n\t%s Message (%#04x), originator %s, ttl %u, hop %u"
- "\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s",
+ "\n\t vtime %.3fs, msg-seq 0x%04x, length %u%s",
tok2str(olsr_msg_values, "Unknown", msg_type),
msg_type, ipaddr_string(ndo, msgptr.v4->originator),
msgptr.v4->ttl,
ND_TCHECK2(*msg_data, sizeof(struct olsr_hello));
ptr.hello = (const struct olsr_hello *)msg_data;
- ND_PRINT((ndo, "\n\t hello-time %.3lfs, MPR willingness %u",
+ ND_PRINT((ndo, "\n\t hello-time %.3fs, MPR willingness %u",
ME_TO_DOUBLE(ptr.hello->htime), ptr.hello->will));
msg_data += sizeof(struct olsr_hello);
msg_tlen -= sizeof(struct olsr_hello);
if (olsr_print_neighbor(ndo, msg_data, hello_len) == -1)
goto trunc;
} else {
-#if INET6
if (is_ipv6) {
if (olsr_print_lq_neighbor6(ndo, msg_data, hello_len) == -1)
goto trunc;
- } else
-#endif
- {
+ } else {
if (olsr_print_lq_neighbor4(ndo, msg_data, hello_len) == -1)
goto trunc;
}
if (olsr_print_neighbor(ndo, msg_data, msg_tlen) == -1)
goto trunc;
} else {
-#if INET6
if (is_ipv6) {
if (olsr_print_lq_neighbor6(ndo, msg_data, msg_tlen) == -1)
goto trunc;
- } else
-#endif
- {
+ } else {
if (olsr_print_lq_neighbor4(ndo, msg_data, msg_tlen) == -1)
goto trunc;
}
{
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) {
ND_TCHECK2(*msg_data, addr_size);
-#if INET6
ND_PRINT((ndo, "\n\t interface address %s",
is_ipv6 ? ip6addr_string(ndo, msg_data) :
ipaddr_string(ndo, msg_data)));
-#else
- ND_PRINT((ndo, "\n\t interface address %s",
- ipaddr_string(ndo, msg_data)));
-#endif
msg_data += addr_size;
msg_tlen -= addr_size;
}
case OLSR_HNA_MSG:
-#if INET6
if (is_ipv6)
{
int i = 0;
}
}
else
-#endif
{
int col = 0;
ND_TCHECK2(*msg_data, addr_size + name_entry_len + name_entry_padding);
-#if INET6
if (is_ipv6)
ND_PRINT((ndo, ", address %s, name \"",
ip6addr_string(ndo, msg_data)));
else
-#endif
ND_PRINT((ndo, ", address %s, name \"",
ipaddr_string(ndo, msg_data)));
(void)fn_printn(ndo, msg_data + addr_size, name_entry_len, NULL);