2005-07-11 03:54:22 +00:00
|
|
|
/*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that: (1) source code
|
|
|
|
* distributions retain the above copyright notice and this paragraph
|
|
|
|
* in its entirety, and (2) distributions including binary code include
|
|
|
|
* the above copyright notice and this paragraph in its entirety in
|
|
|
|
* the documentation or other materials provided with the distribution.
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND
|
|
|
|
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
|
|
|
* LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* Original code by Andy Heffernan (ahh@juniper.net)
|
|
|
|
*/
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
#define NETDISSECT_REWORKED
|
2005-07-11 03:54:22 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <tcpdump-stdinc.h>
|
|
|
|
|
|
|
|
#include "interface.h"
|
|
|
|
#include "extract.h"
|
|
|
|
#include "addrtoname.h"
|
|
|
|
|
|
|
|
#include "ip.h"
|
|
|
|
#ifdef INET6
|
|
|
|
#include "ip6.h"
|
|
|
|
#endif
|
|
|
|
#include "ipproto.h"
|
2015-01-06 19:03:11 +00:00
|
|
|
#include "af.h"
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* PGM header (RFC 3208)
|
|
|
|
*/
|
|
|
|
struct pgm_header {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t pgm_sport;
|
|
|
|
uint16_t pgm_dport;
|
|
|
|
uint8_t pgm_type;
|
|
|
|
uint8_t pgm_options;
|
|
|
|
uint16_t pgm_sum;
|
|
|
|
uint8_t pgm_gsid[6];
|
|
|
|
uint16_t pgm_length;
|
2005-07-11 03:54:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pgm_spm {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pgms_seq;
|
|
|
|
uint32_t pgms_trailseq;
|
|
|
|
uint32_t pgms_leadseq;
|
|
|
|
uint16_t pgms_nla_afi;
|
|
|
|
uint16_t pgms_reserved;
|
|
|
|
/* ... uint8_t pgms_nla[0]; */
|
2005-07-11 03:54:22 +00:00
|
|
|
/* ... options */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pgm_nak {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pgmn_seq;
|
|
|
|
uint16_t pgmn_source_afi;
|
|
|
|
uint16_t pgmn_reserved;
|
|
|
|
/* ... uint8_t pgmn_source[0]; */
|
|
|
|
/* ... uint16_t pgmn_group_afi */
|
|
|
|
/* ... uint16_t pgmn_reserved2; */
|
|
|
|
/* ... uint8_t pgmn_group[0]; */
|
2005-07-11 03:54:22 +00:00
|
|
|
/* ... options */
|
|
|
|
};
|
|
|
|
|
2012-05-14 08:01:48 +00:00
|
|
|
struct pgm_ack {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pgma_rx_max_seq;
|
|
|
|
uint32_t pgma_bitmap;
|
2012-05-14 08:01:48 +00:00
|
|
|
/* ... options */
|
|
|
|
};
|
|
|
|
|
2005-07-11 03:54:22 +00:00
|
|
|
struct pgm_poll {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pgmp_seq;
|
|
|
|
uint16_t pgmp_round;
|
|
|
|
uint16_t pgmp_reserved;
|
2005-07-11 03:54:22 +00:00
|
|
|
/* ... options */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pgm_polr {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pgmp_seq;
|
|
|
|
uint16_t pgmp_round;
|
|
|
|
uint16_t pgmp_subtype;
|
|
|
|
uint16_t pgmp_nla_afi;
|
|
|
|
uint16_t pgmp_reserved;
|
|
|
|
/* ... uint8_t pgmp_nla[0]; */
|
2005-07-11 03:54:22 +00:00
|
|
|
/* ... options */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pgm_data {
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t pgmd_seq;
|
|
|
|
uint32_t pgmd_trailseq;
|
2005-07-11 03:54:22 +00:00
|
|
|
/* ... options */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum _pgm_type {
|
|
|
|
PGM_SPM = 0, /* source path message */
|
|
|
|
PGM_POLL = 1, /* POLL Request */
|
|
|
|
PGM_POLR = 2, /* POLL Response */
|
|
|
|
PGM_ODATA = 4, /* original data */
|
|
|
|
PGM_RDATA = 5, /* repair data */
|
|
|
|
PGM_NAK = 8, /* NAK */
|
|
|
|
PGM_NULLNAK = 9, /* Null NAK */
|
|
|
|
PGM_NCF = 10, /* NAK Confirmation */
|
|
|
|
PGM_ACK = 11, /* ACK for congestion control */
|
|
|
|
PGM_SPMR = 12, /* SPM request */
|
|
|
|
PGM_MAX = 255
|
|
|
|
} pgm_type;
|
|
|
|
|
|
|
|
#define PGM_OPT_BIT_PRESENT 0x01
|
|
|
|
#define PGM_OPT_BIT_NETWORK 0x02
|
|
|
|
#define PGM_OPT_BIT_VAR_PKTLEN 0x40
|
|
|
|
#define PGM_OPT_BIT_PARITY 0x80
|
|
|
|
|
|
|
|
#define PGM_OPT_LENGTH 0x00
|
|
|
|
#define PGM_OPT_FRAGMENT 0x01
|
|
|
|
#define PGM_OPT_NAK_LIST 0x02
|
|
|
|
#define PGM_OPT_JOIN 0x03
|
|
|
|
#define PGM_OPT_NAK_BO_IVL 0x04
|
|
|
|
#define PGM_OPT_NAK_BO_RNG 0x05
|
|
|
|
|
|
|
|
#define PGM_OPT_REDIRECT 0x07
|
|
|
|
#define PGM_OPT_PARITY_PRM 0x08
|
|
|
|
#define PGM_OPT_PARITY_GRP 0x09
|
|
|
|
#define PGM_OPT_CURR_TGSIZE 0x0A
|
|
|
|
#define PGM_OPT_NBR_UNREACH 0x0B
|
|
|
|
#define PGM_OPT_PATH_NLA 0x0C
|
|
|
|
|
|
|
|
#define PGM_OPT_SYN 0x0D
|
|
|
|
#define PGM_OPT_FIN 0x0E
|
|
|
|
#define PGM_OPT_RST 0x0F
|
|
|
|
#define PGM_OPT_CR 0x10
|
|
|
|
#define PGM_OPT_CRQST 0x11
|
2012-05-14 08:01:48 +00:00
|
|
|
|
|
|
|
#define PGM_OPT_PGMCC_DATA 0x12
|
|
|
|
#define PGM_OPT_PGMCC_FEEDBACK 0x13
|
2015-01-06 19:03:11 +00:00
|
|
|
|
2005-07-11 03:54:22 +00:00
|
|
|
#define PGM_OPT_MASK 0x7f
|
|
|
|
|
|
|
|
#define PGM_OPT_END 0x80 /* end of options marker */
|
|
|
|
|
|
|
|
#define PGM_MIN_OPT_LEN 4
|
|
|
|
|
|
|
|
void
|
2015-01-06 19:03:11 +00:00
|
|
|
pgm_print(netdissect_options *ndo,
|
|
|
|
register const u_char *bp, register u_int length,
|
|
|
|
register const u_char *bp2)
|
2005-07-11 03:54:22 +00:00
|
|
|
{
|
|
|
|
register const struct pgm_header *pgm;
|
|
|
|
register const struct ip *ip;
|
|
|
|
register char ch;
|
2015-01-06 19:03:11 +00:00
|
|
|
uint16_t sport, dport;
|
2005-07-11 03:54:22 +00:00
|
|
|
int addr_size;
|
|
|
|
const void *nla;
|
|
|
|
int nla_af;
|
|
|
|
#ifdef INET6
|
|
|
|
char nla_buf[INET6_ADDRSTRLEN];
|
|
|
|
register const struct ip6_hdr *ip6;
|
|
|
|
#else
|
|
|
|
char nla_buf[INET_ADDRSTRLEN];
|
|
|
|
#endif
|
2015-01-06 19:03:11 +00:00
|
|
|
uint8_t opt_type, opt_len;
|
|
|
|
uint32_t seq, opts_len, len, offset;
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
pgm = (struct pgm_header *)bp;
|
|
|
|
ip = (struct ip *)bp2;
|
|
|
|
#ifdef INET6
|
|
|
|
if (IP_V(ip) == 6)
|
|
|
|
ip6 = (struct ip6_hdr *)bp2;
|
|
|
|
else
|
|
|
|
ip6 = NULL;
|
|
|
|
#else /* INET6 */
|
|
|
|
if (IP_V(ip) == 6) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "Can't handle IPv6"));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif /* INET6 */
|
|
|
|
ch = '\0';
|
2015-01-06 19:03:11 +00:00
|
|
|
if (!ND_TTEST(pgm->pgm_dport)) {
|
2005-07-11 03:54:22 +00:00
|
|
|
#ifdef INET6
|
|
|
|
if (ip6) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s > %s: [|pgm]",
|
|
|
|
ip6addr_string(ndo, &ip6->ip6_src),
|
|
|
|
ip6addr_string(ndo, &ip6->ip6_dst)));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
} else
|
|
|
|
#endif /* INET6 */
|
|
|
|
{
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s > %s: [|pgm]",
|
|
|
|
ipaddr_string(ndo, &ip->ip_src),
|
|
|
|
ipaddr_string(ndo, &ip->ip_dst)));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sport = EXTRACT_16BITS(&pgm->pgm_sport);
|
|
|
|
dport = EXTRACT_16BITS(&pgm->pgm_dport);
|
|
|
|
|
|
|
|
#ifdef INET6
|
|
|
|
if (ip6) {
|
|
|
|
if (ip6->ip6_nxt == IPPROTO_PGM) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s.%s > %s.%s: ",
|
|
|
|
ip6addr_string(ndo, &ip6->ip6_src),
|
2005-07-11 03:54:22 +00:00
|
|
|
tcpport_string(sport),
|
2015-01-06 19:03:11 +00:00
|
|
|
ip6addr_string(ndo, &ip6->ip6_dst),
|
|
|
|
tcpport_string(dport)));
|
2005-07-11 03:54:22 +00:00
|
|
|
} else {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s > %s: ",
|
|
|
|
tcpport_string(sport), tcpport_string(dport)));
|
2005-07-11 03:54:22 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
#endif /*INET6*/
|
|
|
|
{
|
|
|
|
if (ip->ip_p == IPPROTO_PGM) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s.%s > %s.%s: ",
|
|
|
|
ipaddr_string(ndo, &ip->ip_src),
|
2005-07-11 03:54:22 +00:00
|
|
|
tcpport_string(sport),
|
2015-01-06 19:03:11 +00:00
|
|
|
ipaddr_string(ndo, &ip->ip_dst),
|
|
|
|
tcpport_string(dport)));
|
2005-07-11 03:54:22 +00:00
|
|
|
} else {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "%s > %s: ",
|
|
|
|
tcpport_string(sport), tcpport_string(dport)));
|
2005-07-11 03:54:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*pgm);
|
2005-07-11 03:54:22 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "PGM, length %u", EXTRACT_16BITS(&pgm->pgm_length)));
|
2005-07-11 03:54:22 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
if (!ndo->ndo_vflag)
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " 0x%02x%02x%02x%02x%02x%02x ",
|
2005-07-11 03:54:22 +00:00
|
|
|
pgm->pgm_gsid[0],
|
|
|
|
pgm->pgm_gsid[1],
|
|
|
|
pgm->pgm_gsid[2],
|
|
|
|
pgm->pgm_gsid[3],
|
|
|
|
pgm->pgm_gsid[4],
|
2015-01-06 19:03:11 +00:00
|
|
|
pgm->pgm_gsid[5]));
|
2005-07-11 03:54:22 +00:00
|
|
|
switch (pgm->pgm_type) {
|
|
|
|
case PGM_SPM: {
|
|
|
|
struct pgm_spm *spm;
|
|
|
|
|
|
|
|
spm = (struct pgm_spm *)(pgm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*spm);
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
switch (EXTRACT_16BITS(&spm->pgms_nla_afi)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in_addr);
|
|
|
|
nla_af = AF_INET;
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET6:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in6_addr);
|
|
|
|
nla_af = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
goto trunc;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
bp = (u_char *) (spm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, addr_size);
|
2005-07-11 03:54:22 +00:00
|
|
|
nla = bp;
|
|
|
|
bp += addr_size;
|
|
|
|
|
|
|
|
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "SPM seq %u trail %u lead %u nla %s",
|
2005-07-11 03:54:22 +00:00
|
|
|
EXTRACT_32BITS(&spm->pgms_seq),
|
|
|
|
EXTRACT_32BITS(&spm->pgms_trailseq),
|
|
|
|
EXTRACT_32BITS(&spm->pgms_leadseq),
|
2015-01-06 19:03:11 +00:00
|
|
|
nla_buf));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PGM_POLL: {
|
|
|
|
struct pgm_poll *poll;
|
|
|
|
|
|
|
|
poll = (struct pgm_poll *)(pgm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*poll);
|
|
|
|
ND_PRINT((ndo, "POLL seq %u round %u",
|
2005-07-11 03:54:22 +00:00
|
|
|
EXTRACT_32BITS(&poll->pgmp_seq),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(&poll->pgmp_round)));
|
2005-07-11 03:54:22 +00:00
|
|
|
bp = (u_char *) (poll + 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PGM_POLR: {
|
|
|
|
struct pgm_polr *polr;
|
2015-01-06 19:03:11 +00:00
|
|
|
uint32_t ivl, rnd, mask;
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
polr = (struct pgm_polr *)(pgm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*polr);
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
switch (EXTRACT_16BITS(&polr->pgmp_nla_afi)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in_addr);
|
|
|
|
nla_af = AF_INET;
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET6:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in6_addr);
|
|
|
|
nla_af = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
goto trunc;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
bp = (u_char *) (polr + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, addr_size);
|
2005-07-11 03:54:22 +00:00
|
|
|
nla = bp;
|
|
|
|
bp += addr_size;
|
|
|
|
|
|
|
|
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, sizeof(uint32_t));
|
2005-07-11 03:54:22 +00:00
|
|
|
ivl = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, sizeof(uint32_t));
|
2005-07-11 03:54:22 +00:00
|
|
|
rnd = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, sizeof(uint32_t));
|
2005-07-11 03:54:22 +00:00
|
|
|
mask = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "POLR seq %u round %u nla %s ivl %u rnd 0x%08x "
|
2005-07-11 03:54:22 +00:00
|
|
|
"mask 0x%08x", EXTRACT_32BITS(&polr->pgmp_seq),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PGM_ODATA: {
|
|
|
|
struct pgm_data *odata;
|
|
|
|
|
|
|
|
odata = (struct pgm_data *)(pgm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*odata);
|
|
|
|
ND_PRINT((ndo, "ODATA trail %u seq %u",
|
2005-07-11 03:54:22 +00:00
|
|
|
EXTRACT_32BITS(&odata->pgmd_trailseq),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_32BITS(&odata->pgmd_seq)));
|
2005-07-11 03:54:22 +00:00
|
|
|
bp = (u_char *) (odata + 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PGM_RDATA: {
|
|
|
|
struct pgm_data *rdata;
|
|
|
|
|
|
|
|
rdata = (struct pgm_data *)(pgm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*rdata);
|
|
|
|
ND_PRINT((ndo, "RDATA trail %u seq %u",
|
2005-07-11 03:54:22 +00:00
|
|
|
EXTRACT_32BITS(&rdata->pgmd_trailseq),
|
2015-01-06 19:03:11 +00:00
|
|
|
EXTRACT_32BITS(&rdata->pgmd_seq)));
|
2005-07-11 03:54:22 +00:00
|
|
|
bp = (u_char *) (rdata + 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case PGM_NAK:
|
|
|
|
case PGM_NULLNAK:
|
|
|
|
case PGM_NCF: {
|
|
|
|
struct pgm_nak *nak;
|
|
|
|
const void *source, *group;
|
|
|
|
int source_af, group_af;
|
|
|
|
#ifdef INET6
|
|
|
|
char source_buf[INET6_ADDRSTRLEN], group_buf[INET6_ADDRSTRLEN];
|
|
|
|
#else
|
|
|
|
char source_buf[INET_ADDRSTRLEN], group_buf[INET_ADDRSTRLEN];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nak = (struct pgm_nak *)(pgm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*nak);
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip past the source, saving info along the way
|
|
|
|
* and stopping if we don't have enough.
|
|
|
|
*/
|
|
|
|
switch (EXTRACT_16BITS(&nak->pgmn_source_afi)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in_addr);
|
|
|
|
source_af = AF_INET;
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET6:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in6_addr);
|
|
|
|
source_af = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
goto trunc;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
bp = (u_char *) (nak + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, addr_size);
|
2005-07-11 03:54:22 +00:00
|
|
|
source = bp;
|
|
|
|
bp += addr_size;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Skip past the group, saving info along the way
|
|
|
|
* and stopping if we don't have enough.
|
|
|
|
*/
|
|
|
|
switch (EXTRACT_16BITS(bp)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in_addr);
|
|
|
|
group_af = AF_INET;
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET6:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in6_addr);
|
|
|
|
group_af = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
goto trunc;
|
|
|
|
break;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += (2 * sizeof(uint16_t));
|
|
|
|
ND_TCHECK2(*bp, addr_size);
|
2005-07-11 03:54:22 +00:00
|
|
|
group = bp;
|
|
|
|
bp += addr_size;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Options decoding can go here.
|
|
|
|
*/
|
|
|
|
inet_ntop(source_af, source, source_buf, sizeof(source_buf));
|
|
|
|
inet_ntop(group_af, group, group_buf, sizeof(group_buf));
|
|
|
|
switch (pgm->pgm_type) {
|
|
|
|
case PGM_NAK:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "NAK "));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
case PGM_NULLNAK:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "NNAK "));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
case PGM_NCF:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "NCF "));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "(%s -> %s), seq %u",
|
|
|
|
source_buf, group_buf, EXTRACT_32BITS(&nak->pgmn_seq)));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-05-14 08:01:48 +00:00
|
|
|
case PGM_ACK: {
|
|
|
|
struct pgm_ack *ack;
|
|
|
|
|
|
|
|
ack = (struct pgm_ack *)(pgm + 1);
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK(*ack);
|
|
|
|
ND_PRINT((ndo, "ACK seq %u",
|
|
|
|
EXTRACT_32BITS(&ack->pgma_rx_max_seq)));
|
2012-05-14 08:01:48 +00:00
|
|
|
bp = (u_char *) (ack + 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-07-11 03:54:22 +00:00
|
|
|
case PGM_SPMR:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "SPMR"));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "UNKNOWN type 0x%02x", pgm->pgm_type));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
if (pgm->pgm_options & PGM_OPT_BIT_PRESENT) {
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* make sure there's enough for the first option header
|
|
|
|
*/
|
2015-01-06 19:03:11 +00:00
|
|
|
if (!ND_TTEST2(*bp, PGM_MIN_OPT_LEN)) {
|
|
|
|
ND_PRINT((ndo, "[|OPT]"));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
2015-01-06 19:03:11 +00:00
|
|
|
}
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* That option header MUST be an OPT_LENGTH option
|
|
|
|
* (see the first paragraph of section 9.1 in RFC 3208).
|
|
|
|
*/
|
|
|
|
opt_type = *bp++;
|
|
|
|
if ((opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[First option bad, should be PGM_OPT_LENGTH, is %u]", opt_type & PGM_OPT_MASK));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
opt_len = *bp++;
|
|
|
|
if (opt_len != 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_LENGTH option, length %u != 4]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
opts_len = EXTRACT_16BITS(bp);
|
|
|
|
if (opts_len < 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad total option length %u < 4]", opts_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint16_t);
|
|
|
|
ND_PRINT((ndo, " OPTS LEN %d", opts_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4;
|
|
|
|
|
|
|
|
while (opts_len) {
|
|
|
|
if (opts_len < PGM_MIN_OPT_LEN) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Total option length leaves no room for final option]"));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
opt_type = *bp++;
|
|
|
|
opt_len = *bp++;
|
|
|
|
if (opt_len < PGM_MIN_OPT_LEN) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad option, length %u < %u]", opt_len,
|
|
|
|
PGM_MIN_OPT_LEN));
|
2005-07-11 03:54:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (opts_len < opt_len) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Total option length leaves no room for final option]"));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
if (!ND_TTEST2(*bp, opt_len - 2)) {
|
|
|
|
ND_PRINT((ndo, " [|OPT]"));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
2015-01-06 19:03:11 +00:00
|
|
|
}
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
switch (opt_type & PGM_OPT_MASK) {
|
|
|
|
case PGM_OPT_LENGTH:
|
|
|
|
if (opt_len != 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_LENGTH option, length %u != 4]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " OPTS LEN (extra?) %d", EXTRACT_16BITS(bp)));
|
|
|
|
bp += sizeof(uint16_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_FRAGMENT:
|
|
|
|
if (opt_len != 16) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_FRAGMENT option, length %u != 16]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
seq = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
offset = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
len = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
ND_PRINT((ndo, " FRAG seq %u off %u len %u", seq, offset, len));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 16;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_NAK_LIST:
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
|
|
|
opt_len -= sizeof(uint32_t); /* option header */
|
|
|
|
ND_PRINT((ndo, " NAK LIST"));
|
2005-07-11 03:54:22 +00:00
|
|
|
while (opt_len) {
|
2015-01-06 19:03:11 +00:00
|
|
|
if (opt_len < sizeof(uint32_t)) {
|
|
|
|
ND_PRINT((ndo, "[Option length not a multiple of 4]"));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, sizeof(uint32_t));
|
|
|
|
ND_PRINT((ndo, " %u", EXTRACT_32BITS(bp)));
|
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
opt_len -= sizeof(uint32_t);
|
|
|
|
opts_len -= sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_JOIN:
|
|
|
|
if (opt_len != 8) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_JOIN option, length %u != 8]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
seq = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
ND_PRINT((ndo, " JOIN %u", seq));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_NAK_BO_IVL:
|
|
|
|
if (opt_len != 12) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_NAK_BO_IVL option, length %u != 12]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
offset = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
seq = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
ND_PRINT((ndo, " BACKOFF ivl %u ivlseq %u", offset, seq));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 12;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_NAK_BO_RNG:
|
|
|
|
if (opt_len != 12) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_NAK_BO_RNG option, length %u != 12]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
offset = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2005-07-11 03:54:22 +00:00
|
|
|
seq = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
ND_PRINT((ndo, " BACKOFF max %u min %u", offset, seq));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 12;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_REDIRECT:
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
switch (EXTRACT_16BITS(bp)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in_addr);
|
|
|
|
nla_af = AF_INET;
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET6:
|
2005-07-11 03:54:22 +00:00
|
|
|
addr_size = sizeof(struct in6_addr);
|
|
|
|
nla_af = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
goto trunc;
|
|
|
|
break;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += (2 * sizeof(uint16_t));
|
2005-07-11 03:54:22 +00:00
|
|
|
if (opt_len != 4 + addr_size) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_REDIRECT option, length %u != 4 + address size]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, addr_size);
|
2005-07-11 03:54:22 +00:00
|
|
|
nla = bp;
|
|
|
|
bp += addr_size;
|
|
|
|
|
|
|
|
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " REDIRECT %s", (char *)nla));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4 + addr_size;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_PARITY_PRM:
|
|
|
|
if (opt_len != 8) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_PARITY_PRM option, length %u != 8]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
len = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
ND_PRINT((ndo, " PARITY MAXTGS %u", len));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_PARITY_GRP:
|
|
|
|
if (opt_len != 8) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_PARITY_GRP option, length %u != 8]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
seq = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
ND_PRINT((ndo, " PARITY GROUP %u", seq));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_CURR_TGSIZE:
|
|
|
|
if (opt_len != 8) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_CURR_TGSIZE option, length %u != 8]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2005-07-11 03:54:22 +00:00
|
|
|
len = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
|
|
|
ND_PRINT((ndo, " PARITY ATGS %u", len));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_NBR_UNREACH:
|
|
|
|
if (opt_len != 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_NBR_UNREACH option, length %u != 4]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
|
|
|
ND_PRINT((ndo, " NBR_UNREACH"));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_PATH_NLA:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " PATH_NLA [%d]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
bp += opt_len;
|
|
|
|
opts_len -= opt_len;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_SYN:
|
|
|
|
if (opt_len != 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_SYN option, length %u != 4]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
|
|
|
ND_PRINT((ndo, " SYN"));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_FIN:
|
|
|
|
if (opt_len != 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_FIN option, length %u != 4]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
|
|
|
ND_PRINT((ndo, " FIN"));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_RST:
|
|
|
|
if (opt_len != 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_RST option, length %u != 4]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
|
|
|
ND_PRINT((ndo, " RST"));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_CR:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " CR"));
|
2005-07-11 03:54:22 +00:00
|
|
|
bp += opt_len;
|
|
|
|
opts_len -= opt_len;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_CRQST:
|
|
|
|
if (opt_len != 4) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_CRQST option, length %u != 4]", opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
|
|
|
ND_PRINT((ndo, " CRQST"));
|
2005-07-11 03:54:22 +00:00
|
|
|
opts_len -= 4;
|
|
|
|
break;
|
|
|
|
|
2012-05-14 08:01:48 +00:00
|
|
|
case PGM_OPT_PGMCC_DATA:
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2012-05-14 08:01:48 +00:00
|
|
|
offset = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2012-05-14 08:01:48 +00:00
|
|
|
switch (EXTRACT_16BITS(bp)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET:
|
2012-05-14 08:01:48 +00:00
|
|
|
addr_size = sizeof(struct in_addr);
|
|
|
|
nla_af = AF_INET;
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET6:
|
2012-05-14 08:01:48 +00:00
|
|
|
addr_size = sizeof(struct in6_addr);
|
|
|
|
nla_af = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
goto trunc;
|
|
|
|
break;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += (2 * sizeof(uint16_t));
|
2012-05-14 08:01:48 +00:00
|
|
|
if (opt_len != 12 + addr_size) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_PGMCC_DATA option, length %u != 12 + address size]", opt_len));
|
2012-05-14 08:01:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, addr_size);
|
2012-05-14 08:01:48 +00:00
|
|
|
nla = bp;
|
|
|
|
bp += addr_size;
|
|
|
|
|
|
|
|
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " PGMCC DATA %u %s", offset, (char*)nla));
|
2012-05-14 08:01:48 +00:00
|
|
|
opts_len -= 16;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PGM_OPT_PGMCC_FEEDBACK:
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += 2;
|
2012-05-14 08:01:48 +00:00
|
|
|
offset = EXTRACT_32BITS(bp);
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += sizeof(uint32_t);
|
2012-05-14 08:01:48 +00:00
|
|
|
switch (EXTRACT_16BITS(bp)) {
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET:
|
2012-05-14 08:01:48 +00:00
|
|
|
addr_size = sizeof(struct in_addr);
|
|
|
|
nla_af = AF_INET;
|
|
|
|
break;
|
|
|
|
#ifdef INET6
|
2015-01-06 19:03:11 +00:00
|
|
|
case AFNUM_INET6:
|
2012-05-14 08:01:48 +00:00
|
|
|
addr_size = sizeof(struct in6_addr);
|
|
|
|
nla_af = AF_INET6;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
default:
|
|
|
|
goto trunc;
|
|
|
|
break;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
bp += (2 * sizeof(uint16_t));
|
2012-05-14 08:01:48 +00:00
|
|
|
if (opt_len != 12 + addr_size) {
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[Bad OPT_PGMCC_FEEDBACK option, length %u != 12 + address size]", opt_len));
|
2012-05-14 08:01:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_TCHECK2(*bp, addr_size);
|
2012-05-14 08:01:48 +00:00
|
|
|
nla = bp;
|
|
|
|
bp += addr_size;
|
|
|
|
|
|
|
|
inet_ntop(nla_af, nla, nla_buf, sizeof(nla_buf));
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " PGMCC FEEDBACK %u %s", offset, (char*)nla));
|
2012-05-14 08:01:48 +00:00
|
|
|
opts_len -= 16;
|
|
|
|
break;
|
|
|
|
|
2005-07-11 03:54:22 +00:00
|
|
|
default:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " OPT_%02X [%d] ", opt_type, opt_len));
|
2005-07-11 03:54:22 +00:00
|
|
|
bp += opt_len;
|
|
|
|
opts_len -= opt_len;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (opt_type & PGM_OPT_END)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, " [%u]", length));
|
|
|
|
if (ndo->ndo_packettype == PT_PGM_ZMTP1 &&
|
|
|
|
(pgm->pgm_type == PGM_ODATA || pgm->pgm_type == PGM_RDATA))
|
|
|
|
zmtp1_print_datagram(ndo, bp, EXTRACT_16BITS(&pgm->pgm_length));
|
2005-07-11 03:54:22 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
trunc:
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, "[|pgm]"));
|
2005-07-11 03:54:22 +00:00
|
|
|
if (ch != '\0')
|
2015-01-06 19:03:11 +00:00
|
|
|
ND_PRINT((ndo, ">"));
|
2005-07-11 03:54:22 +00:00
|
|
|
}
|