*/
+/* \summary: Open Shortest Path First (OSPF) printer */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
};
static const struct tok type2str[] = {
- { OSPF_TYPE_UMD, "UMD" },
{ OSPF_TYPE_HELLO, "Hello" },
{ OSPF_TYPE_DD, "Database Description" },
{ OSPF_TYPE_LS_REQ, "LS-Request" },
/*
* Print all the per-topology metrics.
*/
-static void
+static int
ospf_print_tos_metrics(netdissect_options *ndo,
const union un_tos *tos)
{
/*
* All but the first metric contain a valid topology id.
*/
- while (toscount) {
+ while (toscount > 0) {
+ ND_TCHECK(*tos);
ND_PRINT((ndo, "\n\t\ttopology %s (%u), metric %u",
tok2str(ospf_topology_values, "Unknown",
metric_count ? tos->metrics.tos_type : 0),
tos++;
toscount--;
}
+ return 0;
+trunc:
+ return 1;
}
/*
return (ls_end);
}
- ospf_print_tos_metrics(ndo, &rlp->un_tos);
+ if (ospf_print_tos_metrics(ndo, &rlp->un_tos))
+ goto trunc;
rlp = (const struct rlalink *)((const u_char *)(rlp + 1) +
((rlp->un_tos.link.link_tos_count) * sizeof(union un_tos)));
switch (op->ospf_type) {
- case OSPF_TYPE_UMD:
- /*
- * Rob Coltun's special monitoring packets;
- * do nothing
- */
- break;
-
case OSPF_TYPE_HELLO:
+ ND_TCHECK(op->ospf_hello.hello_options);
ND_PRINT((ndo, "\n\tOptions [%s]",
bittok2str(ospf_option_values,"none",op->ospf_hello.hello_options)));
/* If the type is valid translate it, or just print the type */
/* value. If it's not valid, say so and return */
ND_TCHECK(op->ospf_type);
- cp = tok2str(type2str, "unknown LS-type", op->ospf_type);
+ cp = tok2str(type2str, "unknown LS-type %u", op->ospf_type);
ND_PRINT((ndo, "OSPFv%u, %s, length %u", op->ospf_version, cp, length));
if (*cp == 'u')
return;