static const struct tok ospf_option_values[] = {
- { OSPF_OPTION_T, "MultiTopology" }, /* draft-ietf-ospf-mt-09 */
+ { OSPF_OPTION_MT, "MultiTopology" }, /* draft-ietf-ospf-mt-09 */
{ OSPF_OPTION_E, "External" },
{ OSPF_OPTION_MC, "Multicast" },
{ OSPF_OPTION_NP, "NSSA" },
- { OSPF_OPTION_L, "LLS" },
+ { OSPF_OPTION_L, "LLS" },
{ OSPF_OPTION_DC, "Demand Circuit" },
{ OSPF_OPTION_O, "Opaque" },
{ OSPF_OPTION_DN, "Up/Down" },
tlv_length);
return -1;
}
- ND_TCHECK_4(tptr);
subtlv_type = GET_BE_U_2(tptr);
subtlv_length = GET_BE_U_2(tptr + 2);
tptr+=4;
ND_PRINT("\n\t TLV length %u < 4", tlv_length);
return -1;
}
- ND_TCHECK_4(tptr);
ND_PRINT(", %s", GET_IPADDR_STRING(tptr));
break;
/*
* Print all the per-topology metrics.
*/
-static int
+static void
ospf_print_tos_metrics(netdissect_options *ndo,
const union un_tos *tos)
{
* All but the first metric contain a valid topology id.
*/
while (toscount != 0) {
- ND_TCHECK_SIZE(tos);
tos_type = GET_U_1(tos->metrics.tos_type);
ND_PRINT("\n\t\ttopology %s (%u), metric %u",
tok2str(ospf_topology_values, "Unknown",
tos++;
toscount--;
}
- return 0;
-trunc:
- return 1;
}
/*
return (ls_end);
}
- if (ospf_print_tos_metrics(ndo, &rlp->un_tos))
- goto trunc;
+ ospf_print_tos_metrics(ndo, &rlp->un_tos);
rlp = (const struct rlalink *)((const u_char *)(rlp + 1) +
(GET_U_1(rlp->un_tos.link.link_tos_count) * sizeof(union un_tos)));
break;
case LS_TYPE_NETWORK:
- ND_TCHECK_4(lsap->lsa_un.un_nla.nla_mask);
ND_PRINT("\n\t Mask %s\n\t Connected Routers:",
GET_IPADDR_STRING(lsap->lsa_un.un_nla.nla_mask));
ap = lsap->lsa_un.un_nla.nla_router;
else
ND_PRINT(" %u", (ul & ASLA_MASK_METRIC));
- ND_TCHECK_4(almp->asla_forward);
if (GET_IPV4_TO_NETWORK_ORDER(almp->asla_forward) != 0) {
ND_PRINT(", forward %s", GET_IPADDR_STRING(almp->asla_forward));
}
- ND_TCHECK_4(almp->asla_tag);
if (GET_IPV4_TO_NETWORK_ORDER(almp->asla_tag) != 0) {
ND_PRINT(", tag %s", GET_IPADDR_STRING(almp->asla_tag));
}
/* Multicast extensions as of 23 July 1991 */
mcp = lsap->lsa_un.un_mcla;
while ((const u_char *)mcp < ls_end) {
- ND_TCHECK_4(mcp->mcla_vid);
switch (GET_BE_U_4(mcp->mcla_vtype)) {
case MCLA_VERTEX_ROUTER:
return (NULL);
}
-static int
+static void
ospf_decode_lls(netdissect_options *ndo,
const struct ospfhdr *op, u_int length)
{
case OSPF_TYPE_HELLO:
if (!(GET_U_1(op->ospf_hello.hello_options) & OSPF_OPTION_L))
- return (0);
+ return;
break;
case OSPF_TYPE_DD:
if (!(GET_U_1(op->ospf_db.db_options) & OSPF_OPTION_L))
- return (0);
+ return;
break;
default:
- return (0);
+ return;
}
/* dig deeper if LLS data is available; see RFC4813 */
dataend = (const u_char *)op + length;
if (GET_BE_U_2(op->ospf_authtype) == OSPF_AUTH_MD5) {
- dptr = dptr + op->ospf_authdata[3];
- length2 += op->ospf_authdata[3];
+ dptr = dptr + GET_U_1(op->ospf_authdata + 3);
+ length2 += GET_U_1(op->ospf_authdata + 3);
}
if (length2 >= length) {
ND_PRINT("\n\t[LLS truncated]");
- return (1);
+ return;
}
ND_PRINT("\n\t LLS: checksum: 0x%04x", (u_int) GET_BE_U_2(dptr));
ND_PRINT(", length: %u", length2);
dptr += 2;
- ND_TCHECK_1(dptr);
while (dptr < dataend) {
lls_type = GET_BE_U_2(dptr);
ND_PRINT("\n\t %s (%u)",
dptr += lls_len;
}
-
- return (0);
-trunc:
- return (1);
}
static int
GET_IPADDR_STRING(op->ospf_hello.hello_mask),
GET_U_1(op->ospf_hello.hello_priority));
- ND_TCHECK_4(op->ospf_hello.hello_dr);
if (GET_IPV4_TO_NETWORK_ORDER(op->ospf_hello.hello_dr) != 0)
ND_PRINT("\n\t Designated Router %s",
GET_IPADDR_STRING(op->ospf_hello.hello_dr));
- ND_TCHECK_4(op->ospf_hello.hello_bdr);
if (GET_IPV4_TO_NETWORK_ORDER(op->ospf_hello.hello_bdr) != 0)
ND_PRINT(", Backup Designated Router %s",
GET_IPADDR_STRING(op->ospf_hello.hello_bdr));
dataend = bp + length;
}
- ND_TCHECK_4(op->ospf_routerid);
ND_PRINT("\n\tRouter-ID %s", GET_IPADDR_STRING(op->ospf_routerid));
- ND_TCHECK_4(op->ospf_areaid);
if (GET_IPV4_TO_NETWORK_ORDER(op->ospf_areaid) != 0)
ND_PRINT(", Area %s", GET_IPADDR_STRING(op->ospf_areaid));
else
case OSPF_AUTH_MD5:
ND_PRINT("\n\tKey-ID: %u, Auth-Length: %u, Crypto Sequence Number: 0x%08x",
- *((op->ospf_authdata) + 2),
- *((op->ospf_authdata) + 3),
+ GET_U_1(op->ospf_authdata + 2),
+ GET_U_1(op->ospf_authdata + 3),
GET_BE_U_4((op->ospf_authdata) + 4));
break;
/* ospf version 2 */
if (ospf_decode_v2(ndo, op, dataend))
goto trunc;
- if (length > GET_BE_U_2(op->ospf_len)) {
- if (ospf_decode_lls(ndo, op, length))
- goto trunc;
- }
+ if (length > GET_BE_U_2(op->ospf_len))
+ ospf_decode_lls(ndo, op, length);
break;
default:
return;
trunc:
- nd_print_trunc(ndo);
+ nd_trunc_longjmp(ndo);
}