diff options
| author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-02-13 10:34:48 +0100 |
|---|---|---|
| committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-02-13 10:34:48 +0100 |
| commit | abd8d4f3b6ca2284eeaa32ac73f8bce46ed8e68f (patch) | |
| tree | 48a36106a4695263f7e545bdaceca790dc65d389 /print-dhcp6.c | |
| parent | 0002ff41f0186db484acb2d0bde39d58c351ab7a (diff) | |
| download | tcpdump-abd8d4f3b6ca2284eeaa32ac73f8bce46ed8e68f.tar.gz | |
DHCPv6: Remove macros to make some code clearer
Diffstat (limited to 'print-dhcp6.c')
| -rw-r--r-- | print-dhcp6.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/print-dhcp6.c b/print-dhcp6.c index c3bee560..f7bc45a7 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -105,13 +105,11 @@ static const struct tok dh6_msgtype_str[] = { /* DHCP6 base packet format */ struct dhcp6 { union { - nd_uint8_t m; - nd_uint32_t x; + nd_uint8_t msgtype; + nd_uint32_t xid; } dh6_msgtypexid; /* options follow */ }; -#define dh6_msgtype dh6_msgtypexid.m -#define dh6_xid dh6_msgtypexid.x #define DH6_XIDMASK 0x00ffffff /* DHCPv6 relay messages */ @@ -805,8 +803,8 @@ dhcp6_print(netdissect_options *ndo, dh6 = (const struct dhcp6 *)cp; dh6relay = (const struct dhcp6_relay *)cp; - ND_TCHECK_4(dh6->dh6_xid); - msgtype = EXTRACT_U_1(dh6->dh6_msgtype); + ND_TCHECK_4(dh6->dh6_msgtypexid.xid); + msgtype = EXTRACT_U_1(dh6->dh6_msgtypexid.msgtype); name = tok2str(dh6_msgtype_str, "msgtype-%u", msgtype); if (!ndo->ndo_vflag) { @@ -818,7 +816,8 @@ dhcp6_print(netdissect_options *ndo, ND_PRINT(" %s (", name); /*)*/ if (msgtype != DH6_RELAY_FORW && msgtype != DH6_RELAY_REPLY) { - ND_PRINT("xid=%x", EXTRACT_BE_U_4(dh6->dh6_xid) & DH6_XIDMASK); + ND_PRINT("xid=%x", + EXTRACT_BE_U_4(dh6->dh6_msgtypexid.xid) & DH6_XIDMASK); extp = (const u_char *)(dh6 + 1); dhcp6opt_print(ndo, extp, ep); } else { /* relay messages */ |
