diff options
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/rthdr.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/libc/net/rthdr.c b/lib/libc/net/rthdr.c index ce2a33c..1f9d102 100644 --- a/lib/libc/net/rthdr.c +++ b/lib/libc/net/rthdr.c @@ -63,7 +63,9 @@ inet6_rthdr_init(bp, type) int type; { register struct cmsghdr *ch = (struct cmsghdr *)bp; - register struct ip6_rthdr *rthdr = (struct ip6_rthdr *)(ch + 1); + register struct ip6_rthdr *rthdr; + + rthdr = (struct ip6_rthdr *)CMSG_DATA(ch); ch->cmsg_level = IPPROTO_IPV6; ch->cmsg_type = IPV6_RTHDR; @@ -88,7 +90,9 @@ inet6_rthdr_add(cmsg, addr, flags) const struct in6_addr *addr; u_int flags; { - register struct ip6_rthdr *rthdr = (struct ip6_rthdr *)(cmsg + 1); + register struct ip6_rthdr *rthdr; + + rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); switch(rthdr->ip6r_type) { case IPV6_RTHDR_TYPE_0: @@ -135,7 +139,9 @@ inet6_rthdr_lasthop(cmsg, flags) struct cmsghdr *cmsg; unsigned int flags; { - register struct ip6_rthdr *rthdr = (struct ip6_rthdr *)(cmsg + 1); + register struct ip6_rthdr *rthdr; + + rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); switch(rthdr->ip6r_type) { case IPV6_RTHDR_TYPE_0: @@ -189,7 +195,9 @@ int inet6_rthdr_segments(cmsg) const struct cmsghdr *cmsg; { - register struct ip6_rthdr *rthdr = (struct ip6_rthdr *)(cmsg + 1); + register struct ip6_rthdr *rthdr; + + rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); switch(rthdr->ip6r_type) { case IPV6_RTHDR_TYPE_0: @@ -221,7 +229,9 @@ inet6_rthdr_getaddr(cmsg, index) struct cmsghdr *cmsg; int index; { - register struct ip6_rthdr *rthdr = (struct ip6_rthdr *)(cmsg + 1); + register struct ip6_rthdr *rthdr; + + rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); switch(rthdr->ip6r_type) { case IPV6_RTHDR_TYPE_0: @@ -260,7 +270,9 @@ inet6_rthdr_getflags(cmsg, index) const struct cmsghdr *cmsg; int index; { - register struct ip6_rthdr *rthdr = (struct ip6_rthdr *)(cmsg + 1); + register struct ip6_rthdr *rthdr; + + rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg); switch(rthdr->ip6r_type) { case IPV6_RTHDR_TYPE_0: |