-static int
-ahcp_time_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+static void
+ahcp_time_print(netdissect_options *ndo,
+ const u_char *cp, uint8_t len)
ND_PRINT(": strftime() error");
else
ND_PRINT(": %s UTC", buf);
ND_PRINT(": strftime() error");
else
ND_PRINT(": %s UTC", buf);
-static int
-ahcp_seconds_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+static void
+ahcp_seconds_print(netdissect_options *ndo,
+ const u_char *cp, uint8_t len)
-static int
-ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+static void
+ahcp_ipv6_addresses_print(netdissect_options *ndo,
+ const u_char *cp, uint8_t len)
-static int
-ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+static void
+ahcp_ipv4_addresses_print(netdissect_options *ndo,
+ const u_char *cp, uint8_t len)
-static int
-ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+static void
+ahcp_ipv6_prefixes_print(netdissect_options *ndo,
+ const u_char *cp, uint8_t len)
- ND_TCHECK_LEN(cp, 17);
- ND_PRINT("%s%s/%u", sep, ip6addr_string(ndo, cp),
- GET_U_1(cp + 16));
+ ND_PRINT("%s%s/%u", sep, GET_IP6ADDR_STRING(cp), GET_U_1(cp + 16));
-static int
-ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+static void
+ahcp_ipv4_prefixes_print(netdissect_options *ndo,
+ const u_char *cp, uint8_t len)
- ND_TCHECK_5(cp);
- ND_PRINT("%s%s/%u", sep, ipaddr_string(ndo, cp),
- GET_U_1(cp + 4));
+ ND_PRINT("%s%s/%u", sep, GET_IPADDR_STRING(cp), GET_U_1(cp + 4));
-/* Data decoders signal truncated data with -1. */
-static int
-(* const data_decoders[AHCP1_OPT_MAX + 1])(netdissect_options *, const u_char *, const u_char *) = {
+static void
+(* const data_decoders[AHCP1_OPT_MAX + 1])(netdissect_options *, const u_char *, uint8_t) = {
/* [AHCP1_OPT_PAD] = */ NULL,
/* [AHCP1_OPT_MANDATORY] = */ NULL,
/* [AHCP1_OPT_ORIGIN_TIME] = */ ahcp_time_print,
/* [AHCP1_OPT_PAD] = */ NULL,
/* [AHCP1_OPT_MANDATORY] = */ NULL,
/* [AHCP1_OPT_ORIGIN_TIME] = */ ahcp_time_print,
-ahcp1_options_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+ahcp1_options_print(netdissect_options *ndo,
+ const u_char *cp, uint16_t len)
ND_PRINT("\n\t %s", tok2str(ahcp1_opt_str, "Unknown-%u", option_no));
if (option_no == AHCP1_OPT_PAD || option_no == AHCP1_OPT_MANDATORY)
continue;
/* Length */
ND_PRINT("\n\t %s", tok2str(ahcp1_opt_str, "Unknown-%u", option_no));
if (option_no == AHCP1_OPT_PAD || option_no == AHCP1_OPT_MANDATORY)
continue;
/* Length */
- if (data_decoders[option_no](ndo, cp, cp + option_len) < 0)
- break; /* truncated and already marked up */
+ data_decoders[option_no](ndo, cp, option_len);
} else {
ND_PRINT(" (Length %u)", option_len);
ND_TCHECK_LEN(cp, option_len);
}
cp += option_len;
} else {
ND_PRINT(" (Length %u)", option_len);
ND_TCHECK_LEN(cp, option_len);
}
cp += option_len;
-ahcp1_body_print(netdissect_options *ndo, const u_char *cp, const u_char *ep)
+ahcp1_body_print(netdissect_options *ndo,
+ const u_char *cp, u_int len)
if (ndo->ndo_vflag) {
ND_PRINT("\n\t%s", tok2str(ahcp1_msg_str, "Unknown-%u", type));
if (ndo->ndo_vflag) {
ND_PRINT("\n\t%s", tok2str(ahcp1_msg_str, "Unknown-%u", type));
ND_PRINT(", MBZ %u", mbz);
ND_PRINT(", Length %u", body_len);
}
ND_PRINT(", MBZ %u", mbz);
ND_PRINT(", Length %u", body_len);
}
-ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len)
+ahcp_print(netdissect_options *ndo,
+ const u_char *cp, u_int len)
goto invalid;
if (!ndo->ndo_vflag) {
ND_TCHECK_LEN(cp, AHCP1_HEADER_FIX_LEN - 2);
cp += AHCP1_HEADER_FIX_LEN - 2;
goto invalid;
if (!ndo->ndo_vflag) {
ND_TCHECK_LEN(cp, AHCP1_HEADER_FIX_LEN - 2);
cp += AHCP1_HEADER_FIX_LEN - 2;
- ND_TCHECK_8(cp);
- ND_PRINT(", Source Id %s", linkaddr_string(ndo, cp, LINKADDR_OTHER, 8));
+ ND_PRINT(", Source Id %s", GET_LINKADDR_STRING(cp, LINKADDR_OTHER, 8));
- ND_TCHECK_8(cp);
- ND_PRINT(", Destination Id %s", linkaddr_string(ndo, cp, LINKADDR_OTHER, 8));
+ ND_PRINT(", Destination Id %s", GET_LINKADDR_STRING(cp, LINKADDR_OTHER, 8));