- u_int8_t icmp6_type; /* type field */
- u_int8_t icmp6_code; /* code field */
- u_int16_t icmp6_cksum; /* checksum field */
+ uint8_t icmp6_type; /* type field */
+ uint8_t icmp6_code; /* code field */
+ uint16_t icmp6_cksum; /* checksum field */
- u_int32_t icmp6_un_data32[1]; /* type-specific field */
- u_int16_t icmp6_un_data16[2]; /* type-specific field */
- u_int8_t icmp6_un_data8[4]; /* type-specific field */
+ uint32_t icmp6_un_data32[1]; /* type-specific field */
+ uint16_t icmp6_un_data16[2]; /* type-specific field */
+ uint8_t icmp6_un_data8[4]; /* type-specific field */
- u_int32_t nd_ra_reachable; /* reachable time */
- u_int32_t nd_ra_retransmit; /* retransmit timer */
+ uint32_t nd_ra_reachable; /* reachable time */
+ uint32_t nd_ra_retransmit; /* retransmit timer */
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
struct nd_opt_hdr { /* Neighbor discovery option header */
#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
struct nd_opt_hdr { /* Neighbor discovery option header */
- u_int8_t nd_opt_pi_type;
- u_int8_t nd_opt_pi_len;
- u_int8_t nd_opt_pi_prefix_len;
- u_int8_t nd_opt_pi_flags_reserved;
- u_int8_t nd_opt_pi_valid_time[4];
- u_int8_t nd_opt_pi_preferred_time[4];
- u_int8_t nd_opt_pi_reserved2[4];
+ nd_uint8_t nd_opt_pi_type;
+ nd_uint8_t nd_opt_pi_len;
+ nd_uint8_t nd_opt_pi_prefix_len;
+ nd_uint8_t nd_opt_pi_flags_reserved;
+ nd_uint32_t nd_opt_pi_valid_time;
+ nd_uint32_t nd_opt_pi_preferred_time;
+ nd_uint32_t nd_opt_pi_reserved2;
- u_int8_t nd_opt_rh_type;
- u_int8_t nd_opt_rh_len;
- u_int16_t nd_opt_rh_reserved1;
- u_int32_t nd_opt_rh_reserved2;
+ uint8_t nd_opt_rh_type;
+ uint8_t nd_opt_rh_len;
+ uint16_t nd_opt_rh_reserved1;
+ uint32_t nd_opt_rh_reserved2;
- u_int8_t nd_opt_mtu_type;
- u_int8_t nd_opt_mtu_len;
- u_int16_t nd_opt_mtu_reserved;
- u_int32_t nd_opt_mtu_mtu;
+ uint8_t nd_opt_mtu_type;
+ uint8_t nd_opt_mtu_len;
+ uint16_t nd_opt_mtu_reserved;
+ uint32_t nd_opt_mtu_mtu;
- u_int8_t nd_opt_rdnss_type;
- u_int8_t nd_opt_rdnss_len;
- u_int16_t nd_opt_rdnss_reserved;
- u_int32_t nd_opt_rdnss_lifetime;
+ uint8_t nd_opt_rdnss_type;
+ uint8_t nd_opt_rdnss_len;
+ uint16_t nd_opt_rdnss_reserved;
+ uint32_t nd_opt_rdnss_lifetime;
struct in6_addr nd_opt_rdnss_addr[1]; /* variable-length */
};
struct nd_opt_dnssl { /* DNSSL RFC 6106 5.2 */
struct in6_addr nd_opt_rdnss_addr[1]; /* variable-length */
};
struct nd_opt_dnssl { /* DNSSL RFC 6106 5.2 */
- u_int8_t nd_opt_dnssl_type;
- u_int8_t nd_opt_dnssl_len;
- u_int16_t nd_opt_dnssl_reserved;
- u_int32_t nd_opt_dnssl_lifetime;
+ uint8_t nd_opt_dnssl_type;
+ uint8_t nd_opt_dnssl_len;
+ uint16_t nd_opt_dnssl_reserved;
+ uint32_t nd_opt_dnssl_lifetime;
/* followed by list of DNS search domains, variable-length */
};
struct nd_opt_advinterval { /* Advertisement interval option */
/* followed by list of DNS search domains, variable-length */
};
struct nd_opt_advinterval { /* Advertisement interval option */
- u_int8_t nd_opt_adv_type;
- u_int8_t nd_opt_adv_len;
- u_int16_t nd_opt_adv_reserved;
- u_int32_t nd_opt_adv_interval;
+ uint8_t nd_opt_adv_type;
+ uint8_t nd_opt_adv_len;
+ uint16_t nd_opt_adv_reserved;
+ uint32_t nd_opt_adv_interval;
- u_int8_t nd_opt_hai_type;
- u_int8_t nd_opt_hai_len;
- u_int16_t nd_opt_hai_reserved;
+ uint8_t nd_opt_hai_type;
+ uint8_t nd_opt_hai_len;
+ uint16_t nd_opt_hai_reserved;
- u_int8_t nd_opt_rti_type;
- u_int8_t nd_opt_rti_len;
- u_int8_t nd_opt_rti_prefixlen;
- u_int8_t nd_opt_rti_flags;
- u_int32_t nd_opt_rti_lifetime;
+ uint8_t nd_opt_rti_type;
+ uint8_t nd_opt_rti_len;
+ uint8_t nd_opt_rti_prefixlen;
+ uint8_t nd_opt_rti_flags;
+ uint32_t nd_opt_rti_lifetime;
-#define NI_SUPTYPE_FLAG_COMPRESS ((u_int16_t)htons(0x1))
-#define NI_FQDN_FLAG_VALIDTTL ((u_int16_t)htons(0x1))
+#define NI_SUPTYPE_FLAG_COMPRESS ((uint16_t)htons(0x1))
+#define NI_FQDN_FLAG_VALIDTTL ((uint16_t)htons(0x1))
-#define NI_NODEADDR_FLAG_TRUNCATE ((u_int16_t)htons(0x1))
-#define NI_NODEADDR_FLAG_ALL ((u_int16_t)htons(0x2))
-#define NI_NODEADDR_FLAG_COMPAT ((u_int16_t)htons(0x4))
-#define NI_NODEADDR_FLAG_LINKLOCAL ((u_int16_t)htons(0x8))
-#define NI_NODEADDR_FLAG_SITELOCAL ((u_int16_t)htons(0x10))
-#define NI_NODEADDR_FLAG_GLOBAL ((u_int16_t)htons(0x20))
-#define NI_NODEADDR_FLAG_ANYCAST ((u_int16_t)htons(0x40)) /* just experimental. not in spec */
+#define NI_NODEADDR_FLAG_TRUNCATE ((uint16_t)htons(0x1))
+#define NI_NODEADDR_FLAG_ALL ((uint16_t)htons(0x2))
+#define NI_NODEADDR_FLAG_COMPAT ((uint16_t)htons(0x4))
+#define NI_NODEADDR_FLAG_LINKLOCAL ((uint16_t)htons(0x8))
+#define NI_NODEADDR_FLAG_SITELOCAL ((uint16_t)htons(0x10))
+#define NI_NODEADDR_FLAG_GLOBAL ((uint16_t)htons(0x20))
+#define NI_NODEADDR_FLAG_ANYCAST ((uint16_t)htons(0x40)) /* just experimental. not in spec */
- u_int32_t ni_fqdn_ttl; /* TTL */
- u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
- u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
+ uint32_t ni_fqdn_ttl; /* TTL */
+ uint8_t ni_fqdn_namelen; /* length in octets of the FQDN */
+ uint8_t ni_fqdn_name[3]; /* XXX: alignment */
struct in6_addr rpu_prefix;
};
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
/* network endian */
struct in6_addr rpu_prefix;
};
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40
/* network endian */
-#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ((u_int32_t)htonl(0x80000000))
-#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ((u_int32_t)htonl(0x40000000))
+#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ((uint32_t)htonl(0x80000000))
+#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ((uint32_t)htonl(0x40000000))
-#define ICMP6_RR_RESULT_FLAGS_OOB ((u_int16_t)htons(0x0002))
-#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ((u_int16_t)htons(0x0001))
+#define ICMP6_RR_RESULT_FLAGS_OOB ((uint16_t)htons(0x0002))
+#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ((uint16_t)htons(0x0001))
static void print_lladdr(netdissect_options *ndo, const u_char *, size_t);
static void icmp6_opt_print(netdissect_options *ndo, const u_char *, int);
static void mld6_print(netdissect_options *ndo, const u_char *);
static void print_lladdr(netdissect_options *ndo, const u_char *, size_t);
static void icmp6_opt_print(netdissect_options *ndo, const u_char *, int);
static void mld6_print(netdissect_options *ndo, const u_char *);
return "infinity";
else {
snprintf(buf, sizeof(buf), "%us", v);
return "infinity";
else {
snprintf(buf, sizeof(buf), "%us", v);
-static int icmp6_cksum(const struct ip6_hdr *ip6, const struct icmp6_hdr *icp,
- u_int len)
+static int icmp6_cksum(netdissect_options *ndo, const struct ip6_hdr *ip6,
+ const struct icmp6_hdr *icp, u_int len)
- return nextproto6_cksum(ip6, (const u_int8_t *)(void *)icp, len, len,
+ return nextproto6_cksum(ndo, ip6, (const uint8_t *)(const void *)icp, len, len,
{ RPL_DIO_NONSTORING, "nonstoring"},
{ RPL_DIO_STORING, "storing"},
{ RPL_DIO_NONSTORING_MULTICAST, "nonstoring-multicast"},
{ RPL_DIO_NONSTORING, "nonstoring"},
{ RPL_DIO_STORING, "storing"},
{ RPL_DIO_NONSTORING_MULTICAST, "nonstoring-multicast"},
-static void
-rpl_format_dagid(char dagid_str[65], const u_char *dagid)
-{
- char *d = dagid_str;
- int i;
-
- for(i=0;i<16;i++) {
- if(isprint(dagid[i])) {
- *d++ = dagid[i];
- } else {
- snprintf(d,4,"0x%02x", dagid[i]);
- d += 4;
- }
- }
- *d++ = '\0';
-}
-
static void
rpl_dio_printopt(netdissect_options *ndo,
const struct rpl_dio_genoption *opt,
static void
rpl_dio_printopt(netdissect_options *ndo,
const struct rpl_dio_genoption *opt,
ND_TTEST2(*opt,(opt->rpl_dio_len+2))) {
unsigned int optlen = opt->rpl_dio_len+2;
ND_TTEST2(*opt,(opt->rpl_dio_len+2))) {
unsigned int optlen = opt->rpl_dio_len+2;
ND_PRINT((ndo, " opt:pad0"));
} else {
ND_PRINT((ndo, " opt:%s len:%u ",
ND_PRINT((ndo, " opt:pad0"));
} else {
ND_PRINT((ndo, " opt:%s len:%u ",
- tok2str(rpl_subopt_values, "%subopt:%u", opt->rpl_dio_type),
+ tok2str(rpl_subopt_values, "subopt:%u", opt->rpl_dio_type),
rpl_dio_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
rpl_dio_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u,rank:%u,%smop:%s,prf:%u]",
dagid_str,
dio->rpl_dtsn,
dio->rpl_instanceid,
ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u,rank:%u,%smop:%s,prf:%u]",
dagid_str,
dio->rpl_dtsn,
dio->rpl_instanceid,
RPL_DIO_GROUNDED(dio->rpl_mopprf) ? "grounded,":"",
tok2str(rpl_mop_values, "mop%u", RPL_DIO_MOP(dio->rpl_mopprf)),
RPL_DIO_PRF(dio->rpl_mopprf)));
if(ndo->ndo_vflag > 1) {
RPL_DIO_GROUNDED(dio->rpl_mopprf) ? "grounded,":"",
tok2str(rpl_mop_values, "mop%u", RPL_DIO_MOP(dio->rpl_mopprf)),
RPL_DIO_PRF(dio->rpl_mopprf)));
if(ndo->ndo_vflag > 1) {
rpl_dao_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
rpl_dao_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
bp += ND_RPL_DAO_MIN_LEN;
length -= ND_RPL_DAO_MIN_LEN;
if(RPL_DAO_D(dao->rpl_flags)) {
ND_TCHECK2(dao->rpl_dagid, DAGID_LEN);
if (length < DAGID_LEN)
goto tooshort;
bp += ND_RPL_DAO_MIN_LEN;
length -= ND_RPL_DAO_MIN_LEN;
if(RPL_DAO_D(dao->rpl_flags)) {
ND_TCHECK2(dao->rpl_dagid, DAGID_LEN);
if (length < DAGID_LEN)
goto tooshort;
- ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u]",
+ ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u%s%s,%02x]",
rpl_daoack_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
rpl_daoack_print(netdissect_options *ndo,
const u_char *bp, u_int length)
{
ND_TCHECK2(*daoack, ND_RPL_DAOACK_MIN_LEN);
if (length < ND_RPL_DAOACK_MIN_LEN)
goto tooshort;
ND_TCHECK2(*daoack, ND_RPL_DAOACK_MIN_LEN);
if (length < ND_RPL_DAOACK_MIN_LEN)
goto tooshort;
bp += ND_RPL_DAOACK_MIN_LEN;
length -= ND_RPL_DAOACK_MIN_LEN;
if(RPL_DAOACK_D(daoack->rpl_flags)) {
bp += ND_RPL_DAOACK_MIN_LEN;
length -= ND_RPL_DAOACK_MIN_LEN;
if(RPL_DAOACK_D(daoack->rpl_flags)) {
- dp = (struct icmp6_hdr *)bp;
- ip = (struct ip6_hdr *)bp2;
- oip = (struct ip6_hdr *)(dp + 1);
+ dp = (const struct icmp6_hdr *)bp;
+ ip = (const struct ip6_hdr *)bp2;
+ oip = (const struct ip6_hdr *)(dp + 1);
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
ND_TCHECK(dp->icmp6_cksum);
if (ndo->ndo_vflag && !fragmented) {
/* 'ep' points to the end of available data. */
ep = ndo->ndo_snapend;
ND_TCHECK(dp->icmp6_cksum);
if (ndo->ndo_vflag && !fragmented) {
- udp_sum = EXTRACT_16BITS(&dp->icmp6_cksum);
- sum = icmp6_cksum(ip, dp, length);
+ udp_sum = EXTRACT_BE_U_2(&dp->icmp6_cksum);
+ sum = icmp6_cksum(ndo, ip, dp, length);
case ICMP6_DST_UNREACH_NOROUTE: /* fall through */
case ICMP6_DST_UNREACH_ADMIN:
case ICMP6_DST_UNREACH_ADDR:
case ICMP6_DST_UNREACH_NOROUTE: /* fall through */
case ICMP6_DST_UNREACH_ADMIN:
case ICMP6_DST_UNREACH_ADDR:
- ND_PRINT((ndo," %s",ip6addr_string(&oip->ip6_dst)));
+ ND_PRINT((ndo," %s",ip6addr_string(ndo, &oip->ip6_dst)));
break;
case ICMP6_DST_UNREACH_BEYONDSCOPE:
ND_PRINT((ndo," %s, source address %s",
break;
case ICMP6_DST_UNREACH_BEYONDSCOPE:
ND_PRINT((ndo," %s, source address %s",
- ip6addr_string(&oip->ip6_dst),
- ip6addr_string(&oip->ip6_src)));
+ ip6addr_string(ndo, &oip->ip6_dst),
+ ip6addr_string(ndo, &oip->ip6_src)));
switch (prot) {
case IPPROTO_TCP:
ND_PRINT((ndo,", %s tcp port %s",
switch (prot) {
case IPPROTO_TCP:
ND_PRINT((ndo,", %s tcp port %s",
- ip6addr_string(&oip->ip6_dst),
- tcpport_string(dport)));
+ ip6addr_string(ndo, &oip->ip6_dst),
+ tcpport_string(ndo, dport)));
break;
case IPPROTO_UDP:
ND_PRINT((ndo,", %s udp port %s",
break;
case IPPROTO_UDP:
ND_PRINT((ndo,", %s udp port %s",
- ip6addr_string(&oip->ip6_dst),
- udpport_string(dport)));
+ ip6addr_string(ndo, &oip->ip6_dst),
+ udpport_string(ndo, dport)));
break;
default:
ND_PRINT((ndo,", %s protocol %d port %d unreachable",
break;
default:
ND_PRINT((ndo,", %s protocol %d port %d unreachable",
- ND_PRINT((ndo,", mtu %u", EXTRACT_32BITS(&dp->icmp6_mtu)));
+ ND_PRINT((ndo,", mtu %u", EXTRACT_BE_U_4(&dp->icmp6_mtu)));
break;
case ICMP6_TIME_EXCEEDED:
ND_TCHECK(oip->ip6_dst);
switch (dp->icmp6_code) {
case ICMP6_TIME_EXCEED_TRANSIT:
ND_PRINT((ndo," for %s",
break;
case ICMP6_TIME_EXCEEDED:
ND_TCHECK(oip->ip6_dst);
switch (dp->icmp6_code) {
case ICMP6_TIME_EXCEED_TRANSIT:
ND_PRINT((ndo," for %s",
break;
case ICMP6_TIME_EXCEED_REASSEMBLY:
ND_PRINT((ndo," (reassembly)"));
break;
case ICMP6_TIME_EXCEED_REASSEMBLY:
ND_PRINT((ndo," (reassembly)"));
- ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", erroneous - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr)));
- ND_PRINT((ndo,", next header - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", next header - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr)));
- ND_PRINT((ndo,", option - octet %u", EXTRACT_32BITS(&dp->icmp6_pptr)));
+ ND_PRINT((ndo,", option - octet %u", EXTRACT_BE_U_4(&dp->icmp6_pptr)));
break;
default:
ND_PRINT((ndo,", code-#%d",
break;
default:
ND_PRINT((ndo,", code-#%d",
- ND_PRINT((ndo,", seq %u", EXTRACT_16BITS(&dp->icmp6_seq)));
+ ND_PRINT((ndo,", seq %u", EXTRACT_BE_U_2(&dp->icmp6_seq)));
ND_TCHECK(p->nd_ra_retransmit);
ND_PRINT((ndo,"\n\thop limit %u, Flags [%s]" \
", pref %s, router lifetime %us, reachable time %us, retrans time %us",
(u_int)p->nd_ra_curhoplimit,
bittok2str(icmp6_opt_ra_flag_values,"none",(p->nd_ra_flags_reserved)),
get_rtpref(p->nd_ra_flags_reserved),
ND_TCHECK(p->nd_ra_retransmit);
ND_PRINT((ndo,"\n\thop limit %u, Flags [%s]" \
", pref %s, router lifetime %us, reachable time %us, retrans time %us",
(u_int)p->nd_ra_curhoplimit,
bittok2str(icmp6_opt_ra_flag_values,"none",(p->nd_ra_flags_reserved)),
get_rtpref(p->nd_ra_flags_reserved),
- EXTRACT_16BITS(&p->nd_ra_router_lifetime),
- EXTRACT_32BITS(&p->nd_ra_reachable),
- EXTRACT_32BITS(&p->nd_ra_retransmit)));
+ EXTRACT_BE_U_2(&p->nd_ra_router_lifetime),
+ EXTRACT_BE_U_4(&p->nd_ra_reachable),
+ EXTRACT_BE_U_4(&p->nd_ra_retransmit)));
- ND_PRINT((ndo,", who has %s", ip6addr_string(&p->nd_ns_target)));
+ ND_PRINT((ndo,", who has %s", ip6addr_string(ndo, &p->nd_ns_target)));
ND_TCHECK(p->nd_na_target);
ND_PRINT((ndo,", tgt is %s",
ND_TCHECK(p->nd_na_target);
ND_PRINT((ndo,", tgt is %s",
if (ndo->ndo_vflag) {
ND_PRINT((ndo,", Flags [%s]",
bittok2str(icmp6_nd_na_flag_values,
"none",
if (ndo->ndo_vflag) {
ND_PRINT((ndo,", Flags [%s]",
bittok2str(icmp6_nd_na_flag_values,
"none",
- ND_PRINT((ndo,", %s", getname6((const u_char *)&RDR(dp)->nd_rd_dst)));
+ ND_PRINT((ndo,", %s", ip6addr_string(ndo, &RDR(dp)->nd_rd_dst)));
case ICMP6_MOBILEPREFIX_SOLICIT: /* fall through */
case ICMP6_HADISCOV_REQUEST:
ND_TCHECK(dp->icmp6_data16[0]);
case ICMP6_MOBILEPREFIX_SOLICIT: /* fall through */
case ICMP6_HADISCOV_REQUEST:
ND_TCHECK(dp->icmp6_data16[0]);
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0])));
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
- cp = (u_char *)dp + length;
- in6 = (struct in6_addr *)(dp + 1);
- for (; (u_char *)in6 < cp; in6++) {
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0])));
+ cp = (const u_char *)dp + length;
+ in6 = (const struct in6_addr *)(dp + 1);
+ for (; (const u_char *)in6 < cp; in6++) {
- ND_PRINT((ndo,", %s", ip6addr_string(in6)));
+ ND_PRINT((ndo,", %s", ip6addr_string(ndo, in6)));
- ND_PRINT((ndo,", id 0x%04x", EXTRACT_16BITS(&dp->icmp6_data16[0])));
+ ND_PRINT((ndo,", id 0x%04x", EXTRACT_BE_U_2(&dp->icmp6_data16[0])));
+ ND_TCHECK(dp->icmp6_data16[1]);
const struct nd_opt_homeagent_info *oph;
const struct nd_opt_route_info *opri;
const u_char *cp, *ep, *domp;
const struct nd_opt_homeagent_info *oph;
const struct nd_opt_route_info *opri;
const u_char *cp, *ep, *domp;
print_lladdr(ndo, cp + 2, l);
break;
case ND_OPT_PREFIX_INFORMATION:
print_lladdr(ndo, cp + 2, l);
break;
case ND_OPT_PREFIX_INFORMATION:
ND_TCHECK(opp->nd_opt_pi_prefix);
ND_PRINT((ndo,"%s/%u%s, Flags [%s], valid time %s",
ND_TCHECK(opp->nd_opt_pi_prefix);
ND_PRINT((ndo,"%s/%u%s, Flags [%s], valid time %s",
opp->nd_opt_pi_prefix_len,
(op->nd_opt_len != 4) ? "badlen" : "",
bittok2str(icmp6_opt_pi_flag_values, "none", opp->nd_opt_pi_flags_reserved),
opp->nd_opt_pi_prefix_len,
(op->nd_opt_len != 4) ? "badlen" : "",
bittok2str(icmp6_opt_pi_flag_values, "none", opp->nd_opt_pi_flags_reserved),
- get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_valid_time))));
- ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_preferred_time))));
+ get_lifetime(EXTRACT_BE_U_4(&opp->nd_opt_pi_valid_time))));
+ ND_PRINT((ndo,", pref. time %s", get_lifetime(EXTRACT_BE_U_4(&opp->nd_opt_pi_preferred_time))));
break;
case ND_OPT_REDIRECTED_HEADER:
print_unknown_data(ndo, bp,"\n\t ",op->nd_opt_len<<3);
/* xxx */
break;
case ND_OPT_MTU:
break;
case ND_OPT_REDIRECTED_HEADER:
print_unknown_data(ndo, bp,"\n\t ",op->nd_opt_len<<3);
/* xxx */
break;
case ND_OPT_MTU:
- EXTRACT_32BITS(&opm->nd_opt_mtu_mtu),
- (op->nd_opt_len != 1) ? "bad option length" : "" ));
+ EXTRACT_BE_U_4(&opm->nd_opt_mtu_mtu),
+ (op->nd_opt_len != 1) ? "bad option length" : "" ));
l = (op->nd_opt_len - 1) / 2;
ND_PRINT((ndo," lifetime %us,",
l = (op->nd_opt_len - 1) / 2;
ND_PRINT((ndo," lifetime %us,",
for (i = 0; i < l; i++) {
ND_TCHECK(oprd->nd_opt_rdnss_addr[i]);
ND_PRINT((ndo," addr: %s",
for (i = 0; i < l; i++) {
ND_TCHECK(oprd->nd_opt_rdnss_addr[i]);
ND_PRINT((ndo," addr: %s",
ND_PRINT((ndo," lifetime %us, domain(s):",
ND_PRINT((ndo," lifetime %us, domain(s):",
ND_TCHECK(oph->nd_opt_hai_lifetime);
ND_PRINT((ndo," preference %u, lifetime %u",
ND_TCHECK(oph->nd_opt_hai_lifetime);
ND_PRINT((ndo," preference %u, lifetime %u",
- EXTRACT_16BITS(&oph->nd_opt_hai_preference),
- EXTRACT_16BITS(&oph->nd_opt_hai_lifetime)));
+ EXTRACT_BE_U_2(&oph->nd_opt_hai_preference),
+ EXTRACT_BE_U_2(&oph->nd_opt_hai_lifetime)));
ND_TCHECK(opri->nd_opt_rti_lifetime);
memset(&in6, 0, sizeof(in6));
ND_TCHECK(opri->nd_opt_rti_lifetime);
memset(&in6, 0, sizeof(in6));
- ND_PRINT((ndo," %s/%u", ip6addr_string(&in6),
+ ND_PRINT((ndo," %s/%u", ip6addr_string(ndo, &in6),
opri->nd_opt_rti_prefixlen));
ND_PRINT((ndo,", pref=%s", get_rtpref(opri->nd_opt_rti_flags)));
ND_PRINT((ndo,", lifetime=%s",
opri->nd_opt_rti_prefixlen));
ND_PRINT((ndo,", pref=%s", get_rtpref(opri->nd_opt_rti_flags)));
ND_PRINT((ndo,", lifetime=%s",
- ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_16BITS(&mp->mld6_maxdelay)));
- ND_PRINT((ndo,"addr: %s", ip6addr_string(&mp->mld6_addr)));
+ ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_BE_U_2(&mp->mld6_maxdelay)));
+ ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr)));
ND_PRINT((ndo,", %d group record(s)", ngroups));
if (ndo->ndo_vflag > 0) {
/* Print the group records */
ND_PRINT((ndo,", %d group record(s)", ngroups));
if (ndo->ndo_vflag > 0) {
/* Print the group records */
- ND_PRINT((ndo," [gaddr %s", ip6addr_string(&bp[group + 4])));
+ ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + group + 4)));
ND_PRINT((ndo," %s", tok2str(mldv2report2str, " [v2-report-#%d]",
ND_PRINT((ndo," %s", tok2str(mldv2report2str, " [v2-report-#%d]",
nsrcs = (bp[group + 2] << 8) + bp[group + 3];
/* Check the number of sources and print them */
if (len < group + 20 + (nsrcs * sizeof(struct in6_addr))) {
nsrcs = (bp[group + 2] << 8) + bp[group + 3];
/* Check the number of sources and print them */
if (len < group + 20 + (nsrcs * sizeof(struct in6_addr))) {
for (j = 0; j < nsrcs; j++) {
ND_TCHECK2(bp[group + 20 + j * sizeof(struct in6_addr)],
sizeof(struct in6_addr));
for (j = 0; j < nsrcs; j++) {
ND_TCHECK2(bp[group + 20 + j * sizeof(struct in6_addr)],
sizeof(struct in6_addr));
- ND_PRINT((ndo," %s", ip6addr_string(&bp[group + 20 + j * sizeof(struct in6_addr)])));
+ ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + group + 20 + (j * sizeof(struct in6_addr)))));
ND_PRINT((ndo," [max resp delay=%d]", mrt));
}
ND_TCHECK2(bp[8], sizeof(struct in6_addr));
ND_PRINT((ndo," [max resp delay=%d]", mrt));
}
ND_TCHECK2(bp[8], sizeof(struct in6_addr));
- ND_PRINT((ndo," [gaddr %s", ip6addr_string(&bp[8])));
+ ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + 8)));
if (nsrcs > 0) {
if (len < 28 + nsrcs * sizeof(struct in6_addr))
ND_PRINT((ndo," [invalid number of sources]"));
if (nsrcs > 0) {
if (len < 28 + nsrcs * sizeof(struct in6_addr))
ND_PRINT((ndo," [invalid number of sources]"));
for (i = 0; i < nsrcs; i++) {
ND_TCHECK2(bp[28 + i * sizeof(struct in6_addr)],
sizeof(struct in6_addr));
for (i = 0; i < nsrcs; i++) {
ND_TCHECK2(bp[28 + i * sizeof(struct in6_addr)],
sizeof(struct in6_addr));
- ND_PRINT((ndo," %s", ip6addr_string(&bp[28 + i * sizeof(struct in6_addr)])));
+ ND_PRINT((ndo," %s", ip6addr_string(ndo, bp + 28 + (i * sizeof(struct in6_addr)))));
ND_PRINT((ndo," node information query"));
ND_TCHECK2(*dp, sizeof(*ni6));
ND_PRINT((ndo," node information query"));
ND_TCHECK2(*dp, sizeof(*ni6));
break;
}
ND_PRINT((ndo,", subject=%s",
break;
}
ND_PRINT((ndo,", subject=%s",
break;
}
ND_PRINT((ndo,", subject=%s",
break;
}
ND_PRINT((ndo,", subject=%s",
ND_PRINT((ndo," node information reply"));
ND_PRINT((ndo," (")); /*)*/
switch (ni6->ni_code) {
ND_PRINT((ndo," node information reply"));
ND_PRINT((ndo," (")); /*)*/
switch (ni6->ni_code) {
ND_PRINT((ndo,", "));
ND_PRINT((ndo,"DNS name"));
cp = (const u_char *)(ni6 + 1) + 4;
ND_PRINT((ndo,", "));
ND_PRINT((ndo,"DNS name"));
cp = (const u_char *)(ni6 + 1) + 4;
if (cp[0] == ep - cp - 1) {
/* icmp-name-lookup-03, pascal string */
if (ndo->ndo_vflag)
if (cp[0] == ep - cp - 1) {
/* icmp-name-lookup-03, pascal string */
if (ndo->ndo_vflag)
- if ((EXTRACT_16BITS(&ni6->ni_flags) & 0x01) != 0)
- ND_PRINT((ndo," [TTL=%u]", *(u_int32_t *)(ni6 + 1)));
+ if ((EXTRACT_BE_U_2(&ni6->ni_flags) & 0x01) != 0)
+ ND_PRINT((ndo," [TTL=%u]", EXTRACT_BE_U_4(ni6 + 1)));
- ND_PRINT((ndo,", seq=%u", EXTRACT_32BITS(&rr6->rr_seqnum)));
+ ND_PRINT((ndo,", seq=%u", EXTRACT_BE_U_4(&rr6->rr_seqnum)));
F(ICMP6_RR_FLAGS_PREVDONE, "P")));
}
ND_PRINT((ndo,"seg=%u,", rr6->rr_segnum));
F(ICMP6_RR_FLAGS_PREVDONE, "P")));
}
ND_PRINT((ndo,"seg=%u,", rr6->rr_segnum));
ND_PRINT((ndo,",min=%u", match->rpm_minlen));
ND_PRINT((ndo,",max=%u", match->rpm_maxlen));
}
ND_PRINT((ndo,",min=%u", match->rpm_minlen));
ND_PRINT((ndo,",max=%u", match->rpm_maxlen));
}
- if (inet_ntop(AF_INET6, &match->rpm_prefix, hbuf, sizeof(hbuf)))
+ if (addrtostr6(&match->rpm_prefix, hbuf, sizeof(hbuf)))
ND_PRINT((ndo,",%s/%u", hbuf, match->rpm_matchlen));
else
ND_PRINT((ndo,",?/%u", match->rpm_matchlen));
ND_PRINT((ndo,",%s/%u", hbuf, match->rpm_matchlen));
else
ND_PRINT((ndo,",?/%u", match->rpm_matchlen));
ND_PRINT((ndo,"vltime=infty,"));
else
ND_PRINT((ndo,"vltime=%u,",
ND_PRINT((ndo,"vltime=infty,"));
else
ND_PRINT((ndo,"vltime=%u,",
if (~use->rpu_pltime == 0)
ND_PRINT((ndo,"pltime=infty,"));
else
ND_PRINT((ndo,"pltime=%u,",
if (~use->rpu_pltime == 0)
ND_PRINT((ndo,"pltime=infty,"));
else
ND_PRINT((ndo,"pltime=%u,",
- if (inet_ntop(AF_INET6, &use->rpu_prefix, hbuf,
- sizeof(hbuf)))
+ if (addrtostr6(&use->rpu_prefix, hbuf, sizeof(hbuf)))
ND_PRINT((ndo,"%s/%u/%u", hbuf, use->rpu_uselen,
use->rpu_keeplen));
else
ND_PRINT((ndo,"%s/%u/%u", hbuf, use->rpu_uselen,
use->rpu_keeplen));
else