From c302f5bc078aee97276d3011dfc5bded2fcbba39 Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Fri, 24 Oct 2003 20:37:05 +0000 Subject: [PATCH] remove the ip6r0_addr and ip6r0_slmap members from ip6_rthdr0{} according to rfc2292bis. Obtained from: KAME --- sys/netinet/ip6.h | 5 ++--- sys/netinet6/ip6_output.c | 10 ++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/netinet/ip6.h b/sys/netinet/ip6.h index ae66264625bb..8a54231e0879 100644 --- a/sys/netinet/ip6.h +++ b/sys/netinet/ip6.h @@ -181,9 +181,8 @@ struct ip6_rthdr0 { u_int8_t ip6r0_len; /* length in units of 8 octets */ u_int8_t ip6r0_type; /* always zero */ u_int8_t ip6r0_segleft; /* segments left */ - u_int8_t ip6r0_reserved; /* reserved field */ - u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */ - struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */ + u_int32_t ip6r0_reserved; /* reserved field */ + /* followed by up to 127 struct in6_addr */ } __attribute__((__packed__)); /* Fragment header */ diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index b4859ece0600..0e20f6c001b8 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -478,17 +478,19 @@ skip_ipsec2:; (struct ip6_rthdr *)(mtod(exthdrs.ip6e_rthdr, struct ip6_rthdr *)); struct ip6_rthdr0 *rh0; + struct in6_addr *addrs; finaldst = ip6->ip6_dst; switch (rh->ip6r_type) { case IPV6_RTHDR_TYPE_0: rh0 = (struct ip6_rthdr0 *)rh; - ip6->ip6_dst = rh0->ip6r0_addr[0]; - bcopy((caddr_t)&rh0->ip6r0_addr[1], - (caddr_t)&rh0->ip6r0_addr[0], + addrs = (struct in6_addr *)(rh + 1); + + ip6->ip6_dst = *addrs; + bcopy((caddr_t)(addrs + 1), (caddr_t)addrs, sizeof(struct in6_addr)*(rh0->ip6r0_segleft - 1) ); - rh0->ip6r0_addr[rh0->ip6r0_segleft - 1] = finaldst; + *(addrs + rh0->ip6r0_segleft - 1) = finaldst; break; default: /* is it possible? */ error = EINVAL;