- UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in4, &ip->ip_src, sizeof(struct in_addr));
- UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in4, &ip->ip_dst, sizeof(struct in_addr));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in4,
+ ip->ip_src, sizeof(nd_ipv4));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in4,
+ ip->ip_dst, sizeof(nd_ipv4));
- UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in6, &ip6->ip6_src, sizeof(struct in6_addr));
- UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in6, &ip6->ip6_dst, sizeof(struct in6_addr));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in6,
+ ip6->ip6_src, sizeof(nd_ipv6));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in6,
+ ip6->ip6_dst, sizeof(nd_ipv6));
-#define cookie_isinitiator(x, y) cookie_sidecheck((x), (y), 1)
-#define cookie_isresponder(x, y) cookie_sidecheck((x), (y), 0)
+#define cookie_isinitiator(ndo, x, y) cookie_sidecheck(ndo, (x), (y), 1)
+#define cookie_isresponder(ndo, x, y) cookie_sidecheck(ndo, (x), (y), 0)
-cookie_sidecheck(int i, const u_char *bp2, int initiator)
+cookie_sidecheck(netdissect_options *ndo, int i, const u_char *bp2, int initiator)
if (map && t < nmap && map[t].type)
ND_PRINT("type=%s ", map[t].type);
else
ND_PRINT("type=#%u ", t);
if (map && t < nmap && map[t].type)
ND_PRINT("type=%s ", map[t].type);
else
ND_PRINT("type=#%u ", t);
if (map && t < nmap && v < map[t].nvalue && map[t].value[v])
ND_PRINT("%s", map[t].value[v]);
else {
if (map && t < nmap && v < map[t].nvalue && map[t].value[v])
ND_PRINT("%s", map[t].value[v]);
else {
if (doi != 1) {
ND_PRINT(" doi=%u", doi);
ND_PRINT(" situation=%u", sit);
if (doi != 1) {
ND_PRINT(" doi=%u", doi);
ND_PRINT(" situation=%u", sit);
p = (const struct ikev1_pl_p *)ext;
ND_TCHECK_SIZE(p);
ND_PRINT(" #%u protoid=%s transform=%u",
p = (const struct ikev1_pl_p *)ext;
ND_TCHECK_SIZE(p);
ND_PRINT(" #%u protoid=%s transform=%u",
- EXTRACT_U_1(p->p_no), PROTOIDSTR(EXTRACT_U_1(p->prot_id)),
- EXTRACT_U_1(p->num_t));
- spi_size = EXTRACT_U_1(p->spi_size);
+ GET_U_1(p->p_no), PROTOIDSTR(GET_U_1(p->prot_id)),
+ GET_U_1(p->num_t));
+ spi_size = GET_U_1(p->spi_size);
ND_TCHECK_SIZE(ext);
cp = ikev1_sub_print(ndo, ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
ND_TCHECK_SIZE(ext);
cp = ikev1_sub_print(ndo, ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
- { NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 0, 1 */
+ { NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 0, 1 */
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 2, 3 */
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 4, 5 */
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 6, 7 */
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 2, 3 */
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 4, 5 */
{ NULL, 0, { NULL } }, { NULL, 0, { NULL } }, /* 6, 7 */
static const struct attrmap oakley_t_map[] = {
{ NULL, 0, { NULL } },
{ "enc", 8, { NULL, "1des", "idea", "blowfish", "rc5",
static const struct attrmap oakley_t_map[] = {
{ NULL, 0, { NULL } },
{ "enc", 8, { NULL, "1des", "idea", "blowfish", "rc5",
- "3des", "cast", "aes", }, },
+ "3des", "cast", "aes", }, },
{ "hash", 7, { NULL, "md5", "sha1", "tiger",
"sha2-256", "sha2-384", "sha2-512", }, },
{ "auth", 6, { NULL, "preshared", "dss", "rsa sig", "rsa enc",
{ "hash", 7, { NULL, "md5", "sha1", "tiger",
"sha2-256", "sha2-384", "sha2-512", }, },
{ "auth", 6, { NULL, "preshared", "dss", "rsa sig", "rsa enc",
cp = (const u_char *)(p + 1);
ep2 = (const u_char *)p + item_len;
while (cp < ep && cp < ep2) {
cp = (const u_char *)(p + 1);
ep2 = (const u_char *)p + item_len;
while (cp < ep && cp < ep2) {
ND_PRINT(" idtype=%s", STR_OR_ID(type, ipsecidtypestr));
/* A protocol ID of 0 DOES NOT mean IPPROTO_IP! */
ND_PRINT(" idtype=%s", STR_OR_ID(type, ipsecidtypestr));
/* A protocol ID of 0 DOES NOT mean IPPROTO_IP! */
if (!ndo->ndo_nflag && proto_id && (p_name = netdb_protoname(proto_id)) != NULL)
ND_PRINT(" protoid=%s", p_name);
else
ND_PRINT(" protoid=%u", proto_id);
if (!ndo->ndo_nflag && proto_id && (p_name = netdb_protoname(proto_id)) != NULL)
ND_PRINT(" protoid=%s", p_name);
else
ND_PRINT(" protoid=%u", proto_id);
u_int i;
ND_PRINT(" len=%u ", len);
for (i = 0; i < len; i++)
u_int i;
ND_PRINT(" len=%u ", len);
for (i = 0; i < len; i++)
ND_PRINT(" len=%u %s/%u.%u.%u.%u", len,
ipaddr_string(ndo, data),
ND_PRINT(" len=%u %s/%u.%u.%u.%u", len,
ipaddr_string(ndo, data),
- EXTRACT_U_1(mask), EXTRACT_U_1(mask + 1),
- EXTRACT_U_1(mask + 2), EXTRACT_U_1(mask + 3));
+ GET_U_1(mask), GET_U_1(mask + 1),
+ GET_U_1(mask + 2),
+ GET_U_1(mask + 3));
/*XXX*/
ND_PRINT(" len=%u %s/0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len,
ip6addr_string(ndo, data),
/*XXX*/
ND_PRINT(" len=%u %s/0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len,
ip6addr_string(ndo, data),
- EXTRACT_U_1(mask), EXTRACT_U_1(mask + 1), EXTRACT_U_1(mask + 2), EXTRACT_U_1(mask + 3),
- EXTRACT_U_1(mask + 4), EXTRACT_U_1(mask + 5), EXTRACT_U_1(mask + 6), EXTRACT_U_1(mask + 7),
- EXTRACT_U_1(mask + 8), EXTRACT_U_1(mask + 9), EXTRACT_U_1(mask + 10), EXTRACT_U_1(mask + 11),
- EXTRACT_U_1(mask + 12), EXTRACT_U_1(mask + 13), EXTRACT_U_1(mask + 14), EXTRACT_U_1(mask + 15));
+ GET_U_1(mask), GET_U_1(mask + 1),
+ GET_U_1(mask + 2),
+ GET_U_1(mask + 3),
+ GET_U_1(mask + 4),
+ GET_U_1(mask + 5),
+ GET_U_1(mask + 6),
+ GET_U_1(mask + 7),
+ GET_U_1(mask + 8),
+ GET_U_1(mask + 9),
+ GET_U_1(mask + 10),
+ GET_U_1(mask + 11),
+ GET_U_1(mask + 12),
+ GET_U_1(mask + 13),
+ GET_U_1(mask + 14),
+ GET_U_1(mask + 15));
else {
ND_PRINT(" len=%u %s-%s", len,
ipaddr_string(ndo, data),
else {
ND_PRINT(" len=%u %s-%s", len,
ipaddr_string(ndo, data),
else {
ND_PRINT(" len=%u %s-%s", len,
ip6addr_string(ndo, data),
else {
ND_PRINT(" len=%u %s-%s", len,
ip6addr_string(ndo, data),
* Our caller has ensured that the length is >= 4.
*/
ND_PRINT(" len=%u", item_len - 4);
* Our caller has ensured that the length is >= 4.
*/
ND_PRINT(" len=%u", item_len - 4);
* Our caller has ensured that the length is >= 4.
*/
ND_PRINT(" len=%u", item_len - 4);
* Our caller has ensured that the length is >= 4.
*/
ND_PRINT(" len=%u", item_len - 4);
if (doi != 1) {
ND_PRINT(" doi=%u", doi);
ND_PRINT(" proto=%u", proto);
if (doi != 1) {
ND_PRINT(" doi=%u", doi);
ND_PRINT(" proto=%u", proto);
ND_PRINT(" type=%s", NOTIFY_STATUS_STR(type));
else
ND_PRINT(" type=%s", numstr(type));
ND_PRINT(" type=%s", NOTIFY_STATUS_STR(type));
else
ND_PRINT(" type=%s", numstr(type));
ND_PRINT(" type=%s", IPSEC_NOTIFY_STATUS_STR(type));
else
ND_PRINT(" type=%s", numstr(type));
ND_PRINT(" type=%s", IPSEC_NOTIFY_STATUS_STR(type));
else
ND_PRINT(" type=%s", numstr(type));
case IPSECDOI_NTYPE_REPLAY_STATUS:
ND_PRINT(" status=(");
ND_PRINT("replay detection %sabled",
case IPSECDOI_NTYPE_REPLAY_STATUS:
ND_PRINT(" status=(");
ND_PRINT("replay detection %sabled",
if (doi != 1) {
ND_PRINT(" doi=%u", doi);
ND_PRINT(" proto=%u", proto);
if (doi != 1) {
ND_PRINT(" doi=%u", doi);
ND_PRINT(" proto=%u", proto);
ND_PRINT(" nspi=%u", num_spi);
ND_PRINT(" spi=");
q = (const uint8_t *)(p + 1);
ND_PRINT(" nspi=%u", num_spi);
ND_PRINT(" spi=");
q = (const uint8_t *)(p + 1);
/*
* ikev2_sa_print() guarantees that this is >= 4.
*/
prop_length = oprop_length - 4;
ND_PRINT(" #%u protoid=%s transform=%u len=%u",
/*
* ikev2_sa_print() guarantees that this is >= 4.
*/
prop_length = oprop_length - 4;
ND_PRINT(" #%u protoid=%s transform=%u len=%u",
- EXTRACT_U_1(p->p_no), PROTOIDSTR(EXTRACT_U_1(p->prot_id)),
- EXTRACT_U_1(p->num_t), oprop_length);
+ GET_U_1(p->p_no), PROTOIDSTR(GET_U_1(p->prot_id)),
+ GET_U_1(p->num_t), oprop_length);
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
sa_length = osa_length - 4;
ND_PRINT(" len=%u", sa_length);
sa_length = osa_length - 4;
ND_PRINT(" len=%u", sa_length);
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
if (item_len < 8) {
ND_PRINT(" len=%u < 8", item_len);
return (const u_char *)ext + item_len;
}
ND_PRINT(" len=%u group=%s", item_len - 8,
if (item_len < 8) {
ND_PRINT(" len=%u < 8", item_len);
return (const u_char *)ext + item_len;
}
ND_PRINT(" len=%u group=%s", item_len - 8,
if(dumpascii) {
ND_TCHECK_LEN(typedata, idtype_len);
for(i=0; i<idtype_len; i++) {
if(dumpascii) {
ND_TCHECK_LEN(typedata, idtype_len);
for(i=0; i<idtype_len; i++) {
- if(ND_ISPRINT(EXTRACT_U_1(typedata + i))) {
- ND_PRINT("%c", EXTRACT_U_1(typedata + i));
+ if(ND_ISPRINT(GET_U_1(typedata + i))) {
+ ND_PRINT("%c", GET_U_1(typedata + i));
ND_TCHECK_LEN(ext, sizeof(struct ikev2_auth));
p = (const struct ikev2_auth *)ext;
ND_TCHECK_LEN(ext, sizeof(struct ikev2_auth));
p = (const struct ikev2_auth *)ext;
/*
* Our caller has ensured that the length is >= 4.
*/
ND_PRINT(" len=%u method=%s", item_len-4,
/*
* Our caller has ensured that the length is >= 4.
*/
ND_PRINT(" len=%u method=%s", item_len-4,
if (showspi && spi_size) {
ND_PRINT(" spi=");
if (!rawprint(ndo, (const uint8_t *)(p + 1), spi_size))
if (showspi && spi_size) {
ND_PRINT(" spi=");
if (!rawprint(ndo, (const uint8_t *)(p + 1), spi_size))
- if(ND_ISPRINT(EXTRACT_U_1(vid + i)))
- ND_PRINT("%c", EXTRACT_U_1(vid + i));
+ if(ND_ISPRINT(GET_U_1(vid + i)))
+ ND_PRINT("%c", GET_U_1(vid + i));
/* got it decrypted, print stuff inside. */
ikev2_sub_print(ndo, base, np, ext,
ndo->ndo_snapend, phase, doi, proto, depth+1);
/* got it decrypted, print stuff inside. */
ikev2_sub_print(ndo, base, np, ext,
ndo->ndo_snapend, phase, doi, proto, depth+1);
+
+ /*
+ * esp_print_decrypt_buffer_by_ikev2 pushed information
+ * on the buffer stack; we're done with the buffer, so
+ * pop it (which frees the buffer)
+ */
+ nd_pop_packet_info(ndo);
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
- snprintf(buf, sizeof(buf), "#%u", x);
+ nd_snprintf(buf, sizeof(buf), "#%u", x);
- ND_PRINT(" %s", ETYPESTR(EXTRACT_U_1(base->etype)));
- flags = EXTRACT_U_1(base->flags);
+ ND_PRINT(" %s", ETYPESTR(GET_U_1(base->etype)));
+ flags = GET_U_1(base->flags);
if (flags) {
ND_PRINT("[%s%s]", flags & ISAKMP_FLAG_E ? "E" : "",
flags & ISAKMP_FLAG_C ? "C" : "");
if (flags) {
ND_PRINT("[%s%s]", flags & ISAKMP_FLAG_E ? "E" : "",
flags & ISAKMP_FLAG_C ? "C" : "");
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
* or truncated, otherwise we could loop forever processing
* zero-length items or otherwise misdissect the packet.
*/
- ND_PRINT(" %s", ETYPESTR(EXTRACT_U_1(base->etype)));
- flags = EXTRACT_U_1(base->flags);
+ ND_PRINT(" %s", ETYPESTR(GET_U_1(base->etype)));
+ flags = GET_U_1(base->flags);
void
isakmp_rfc3948_print(netdissect_options *ndo,
const u_char *bp, u_int length,
void
isakmp_rfc3948_print(netdissect_options *ndo,
const u_char *bp, u_int length,
ND_PRINT("NONESP-encap: ");
isakmp_print(ndo, bp+4, length-4, bp2);
return;
ND_PRINT("NONESP-encap: ");
isakmp_print(ndo, bp+4, length-4, bp2);
return;
- advance = esp_print(ndo, bp, length, bp2, &enh, &padlen);
- if(advance <= 0)
- return;
-
- bp += advance;
- length -= advance + padlen;
- nh = enh & 0xff;
+ esp_print(ndo, bp, length, bp2, ver, fragmented, ttl_hl);
- ip_print_inner(ndo, bp, length, nh, bp2);
+ /*
+ * Either this has decrypted the payload and
+ * printed it, in which case there's nothing more
+ * to do, or it hasn't, in which case there's
+ * nothing more to do.
+ */