/* packet-icmpv6.c
* Routines for ICMPv6 packet disassembly
*
- * $Id: packet-icmpv6.c,v 1.29 2000/11/09 21:57:35 guy Exp $
+ * $Id: packet-icmpv6.c,v 1.30 2000/11/11 10:23:41 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0001, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_SUPTYPE_FLAG_COMPRESS, sizeof(flags) * 8,
"Compressed reply supported",
"No compressed reply support"));
} else {
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0001, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_SUPTYPE_FLAG_COMPRESS, sizeof(flags) * 8,
"Compressed", "Not compressed"));
}
break;
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0001, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_FQDN_FLAG_VALIDTTL, sizeof(flags) * 8,
"Valid TTL field", "Meaningless TTL field"));
}
break;
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0020, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_NODEADDR_FLAG_GLOBAL, sizeof(flags) * 8,
"Global address",
"Not global address"));
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0010, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_NODEADDR_FLAG_SITELOCAL, sizeof(flags) * 8,
"Site-local address",
"Not site-local address"));
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0008, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_NODEADDR_FLAG_LINKLOCAL, sizeof(flags) * 8,
"Link-local address",
"Not link-local address"));
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0004, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_NODEADDR_FLAG_COMPAT, sizeof(flags) * 8,
"IPv4 compatible/mapped address",
"Not IPv4 compatible/mapped address"));
/* fall through */
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0002, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_NODEADDR_FLAG_ALL, sizeof(flags) * 8,
"All unicast address",
"Unicast addresses on the queried interface"));
proto_tree_add_text(field_tree, NullTVB,
offset + offsetof(struct icmp6_nodeinfo, ni_flags),
sizeof(ni->ni_flags), "%s",
- decode_boolean_bitfield(flags, 0x0001, sizeof(flags) * 8,
+ decode_boolean_bitfield(flags, NI_NODEADDR_FLAG_TRUNCATE, sizeof(flags) * 8,
"Truncated", "Not truncated"));
break;
}
field_tree = proto_item_add_subtree(tf, ett_icmpv6flag);
proto_tree_add_text(field_tree, NullTVB, flagoff, 4, "%s",
decode_boolean_bitfield(na_flags,
- 0x80000000, 32, "Router", "Not router"));
+ ND_NA_FLAG_ROUTER, 32, "Router", "Not router"));
proto_tree_add_text(field_tree, NullTVB, flagoff, 4, "%s",
decode_boolean_bitfield(na_flags,
- 0x40000000, 32, "Solicited", "Not adverted"));
+ ND_NA_FLAG_SOLICITED, 32, "Solicited", "Not adverted"));
proto_tree_add_text(field_tree, NullTVB, flagoff, 4, "%s",
decode_boolean_bitfield(na_flags,
- 0x20000000, 32, "Override", "Not override"));
+ ND_NA_FLAG_OVERRIDE, 32, "Override", "Not override"));
targetoff = offset + offsetof(struct nd_neighbor_advert, nd_na_target);
na_target_p = (struct e_in6_addr*) &pd[targetoff];
/* packet-ipv6.c
* Routines for IPv6 packet disassembly
*
- * $Id: packet-ipv6.c,v 1.43 2000/08/13 14:08:06 deniel Exp $
+ * $Id: packet-ipv6.c,v 1.44 2000/11/11 10:23:41 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
memcpy(&frag, (void *) &pd[offset], sizeof(frag));
len = sizeof(frag);
- *fragstart = ntohs(frag.ip6f_offlg) & 0xfff8;
+ frag.ip6f_offlg = ntohs(frag.ip6f_offlg);
+ *fragstart = frag.ip6f_offlg & IP6F_OFF_MASK;
if (check_col(fd, COL_INFO)) {
col_add_fstr(fd, COL_INFO,
"IPv6 fragment (nxt=%s (0x%02x) off=%u id=0x%x)",
proto_tree_add_text(rthdr_tree, NullTVB,
offset + offsetof(struct ip6_frag, ip6f_offlg), 2,
"Offset: %u",
- ntohs(frag.ip6f_offlg) & 0xfff8);
+ frag.ip6f_offlg & IP6F_OFF_MASK);
proto_tree_add_text(rthdr_tree, NullTVB,
offset + offsetof(struct ip6_frag, ip6f_offlg), 2,
*/
proto_tree_add_uint_format(ipv6_tree, hf_ipv6_flow, NullTVB,
offset + offsetof(struct ip6_hdr, ip6_flow), 4,
- (unsigned long)(ntohl(ipv6.ip6_flow & IPV6_FLOWLABEL_MASK)),
+ (unsigned long)(ntohl(ipv6.ip6_flow) & IPV6_FLOWLABEL_MASK),
"Flowlabel: 0x%05lx",
- (unsigned long)(ntohl(ipv6.ip6_flow & IPV6_FLOWLABEL_MASK)));
+ (unsigned long)(ntohl(ipv6.ip6_flow) & IPV6_FLOWLABEL_MASK));
proto_tree_add_uint(ipv6_tree, hf_ipv6_plen, NullTVB,
offset + offsetof(struct ip6_hdr, ip6_plen), 2,
/* packet-ipv6.h
* Definitions for IPv6 packet disassembly
*
- * $Id: packet-ipv6.h,v 1.15 2000/11/09 16:39:59 itojun Exp $
+ * $Id: packet-ipv6.h,v 1.16 2000/11/11 10:23:41 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
#define IP6H_SRC 8
#define IP6H_DST 24
-#ifdef WORDS_BIGENDIAN
#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */
#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */
-#else
-#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */
-#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */
-#endif
/*
* Extension Headers
guint32 ip6f_ident; /* identification */
};
-#if BYTE_ORDER == BIG_ENDIAN
#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */
#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
-#else /* BYTE_ORDER == LITTLE_ENDIAN */
-#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */
-#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */
-#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
/*
* Definition for ICMPv6.
#define nd_na_code nd_na_hdr.icmp6_code
#define nd_na_cksum nd_na_hdr.icmp6_cksum
#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
-#if BYTE_ORDER == BIG_ENDIAN
#define ND_NA_FLAG_ROUTER 0x80000000
#define ND_NA_FLAG_SOLICITED 0x40000000
#define ND_NA_FLAG_OVERRIDE 0x20000000
-#elif BYTE_ORDER == LITTLE_ENDIAN
-#define ND_NA_FLAG_ROUTER 0x80
-#define ND_NA_FLAG_SOLICITED 0x40
-#define ND_NA_FLAG_OVERRIDE 0x20
-#endif
struct nd_redirect { /* redirect */
struct icmp6_hdr nd_rd_hdr;
#define NI_QTYPE_NODEADDR 3 /* Node Addresses */
#define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */
-#if BYTE_ORDER == BIG_ENDIAN
#define NI_SUPTYPE_FLAG_COMPRESS 0x1
#define NI_FQDN_FLAG_VALIDTTL 0x1
-#elif BYTE_ORDER == LITTLE_ENDIAN
-#define NI_SUPTYPE_FLAG_COMPRESS 0x0100
-#define NI_FQDN_FLAG_VALIDTTL 0x0100
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
#define NI_NODEADDR_FLAG_TRUNCATE 0x1
#define NI_NODEADDR_FLAG_ALL 0x2
#define NI_NODEADDR_FLAG_COMPAT 0x4
#define NI_NODEADDR_FLAG_SITELOCAL 0x10
#define NI_NODEADDR_FLAG_GLOBAL 0x20
#define NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */
-#elif BYTE_ORDER == LITTLE_ENDIAN
-#define NI_NODEADDR_FLAG_TRUNCATE 0x0100
-#define NI_NODEADDR_FLAG_ALL 0x0200
-#define NI_NODEADDR_FLAG_COMPAT 0x0400
-#define NI_NODEADDR_FLAG_LINKLOCAL 0x0800
-#define NI_NODEADDR_FLAG_SITELOCAL 0x1000
-#define NI_NODEADDR_FLAG_GLOBAL 0x2000
-#define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */
-#endif
struct ni_reply_fqdn {
guint32 ni_fqdn_ttl; /* TTL */