--- icmp6.h +++ icmp6.h @@ -396,7 +396,11 @@ u_int8_t rr_segnum; u_int8_t rr_flags; u_int16_t rr_maxdelay; - u_int32_t rr_reserved; + union { + u_int8_t rr_reserved8[4]; + u_int16_t rr_reserved16[2]; + u_int32_t rr_reserved; + }; }; #define ICMP6_RR_FLAGS_TEST 0x80 #define ICMP6_RR_FLAGS_REQRESULT 0x40 --- print-icmp.c +++ print-icmp.c @@ -47,6 +47,12 @@ * Per RFC 792, September 1981. */ +/* rfc1191 */ +struct mtu_discovery { + u_int16_t unused; + u_int16_t nexthopmtu; +}; + /* * Structure of an icmp header. */ @@ -61,7 +67,10 @@ u_int16_t icd_id; u_int16_t icd_seq; } ih_idseq; - u_int32_t ih_void; + union { + u_int32_t ih_void; + struct mtu_discovery ih_mtu_discovery; + }; /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ struct ih_pmtu { @@ -74,6 +83,7 @@ #define icmp_id icmp_hun.ih_idseq.icd_id #define icmp_seq icmp_hun.ih_idseq.icd_seq #define icmp_void icmp_hun.ih_void +#define icmp_mtu_discovery icmp_hun.ih_mtu_discovery #define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void #define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu union { @@ -258,12 +268,6 @@ { 0, NULL } }; -/* rfc1191 */ -struct mtu_discovery { - u_int16_t unused; - u_int16_t nexthopmtu; -}; - /* rfc1256 */ struct ih_rdiscovery { u_int8_t ird_addrnum; @@ -386,7 +390,7 @@ case ICMP_UNREACH_NEEDFRAG: { register const struct mtu_discovery *mp; - mp = (struct mtu_discovery *)&dp->icmp_void; + mp = &dp->icmp_mtu_discovery; mtu = EXTRACT_16BITS(&mp->nexthopmtu); if (mtu) { (void)snprintf(buf, sizeof(buf), --- print-icmp6.c +++ print-icmp6.c @@ -1194,7 +1194,7 @@ printf("seg=%u,", rr6->rr_segnum); printf("maxdelay=%u", rr6->rr_maxdelay); if (rr6->rr_reserved) - printf("rsvd=0x%x", EXTRACT_16BITS(&rr6->rr_reserved)); + printf("rsvd=0x%x", EXTRACT_16BITS(&rr6->rr_reserved16[0])); /*[*/ printf("]"); #undef F --- print-timed.c +++ print-timed.c @@ -86,8 +86,8 @@ fputs(" [|timed]", stdout); return; } - sec = EXTRACT_32BITS(&tsp->tsp_time.tv_sec); - usec = EXTRACT_32BITS(&tsp->tsp_time.tv_usec); + sec = EXTRACT_32BITS(&tsp->tsp_time.tv_sec32[0]); + usec = EXTRACT_32BITS(&tsp->tsp_time.tv_usec32[0]); if (usec < 0) /* corrupt, skip the rest of the packet */ return; --- timed.h +++ timed.h @@ -49,7 +49,16 @@ u_int8_t tsp_vers; u_int16_t tsp_seq; union { - struct timeval tspu_time; + struct { + union { + int tv_sec32[2]; + long tv_sec; + }; + union { + int tv_usec32[2]; + long tv_usec; + }; + } tspu_time; int8_t tspu_hopcnt; } tsp_u; int8_t tsp_name[256];