aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-04 18:41:18 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-04 18:41:18 +0100
commit12ca080a1ca8dfd0aeac54485451b906a7e61b16 (patch)
treeabb273fb03a73bc9c20d05f9128bdfd9bfe55e55 /libbb
parent98a4c7cf3d799ab953cb77e8b34597c73e3e7335 (diff)
downloadbusybox-12ca080a1ca8dfd0aeac54485451b906a7e61b16.tar.gz
*: eliminate more aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/udp_io.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/udp_io.c b/libbb/udp_io.c
index d9375eac2..24237be99 100644
--- a/libbb/udp_io.c
+++ b/libbb/udp_io.c
@@ -152,24 +152,24 @@ recv_from_to(int fd, void *buf, size_t len, int flags,
if (cmsgptr->cmsg_level == IPPROTO_IP
&& cmsgptr->cmsg_type == IP_PKTINFO
) {
-# define pktinfo(cmsgptr) ( (struct in_pktinfo*)(CMSG_DATA(cmsgptr)) )
+ const int IPI_ADDR_OFF = offsetof(struct in_pktinfo, ipi_addr);
to->sa_family = AF_INET;
+ /*# define pktinfo(cmsgptr) ( (struct in_pktinfo*)(CMSG_DATA(cmsgptr)) )*/
/*to4->sin_addr = pktinfo(cmsgptr)->ipi_addr; - may be unaligned */
- memcpy(&to4->sin_addr, &pktinfo(cmsgptr)->ipi_addr, sizeof(to4->sin_addr));
+ memcpy(&to4->sin_addr, (char*)(CMSG_DATA(cmsgptr)) + IPI_ADDR_OFF, sizeof(to4->sin_addr));
/*to4->sin_port = 123; - this data is not supplied by kernel */
-# undef pktinfo
break;
}
# if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO)
if (cmsgptr->cmsg_level == IPPROTO_IPV6
&& cmsgptr->cmsg_type == IPV6_PKTINFO
) {
-# define pktinfo(cmsgptr) ( (struct in6_pktinfo*)(CMSG_DATA(cmsgptr)) )
+ const int IPI6_ADDR_OFF = offsetof(struct in6_pktinfo, ipi6_addr);
to->sa_family = AF_INET6;
+ /*# define pktinfo(cmsgptr) ( (struct in6_pktinfo*)(CMSG_DATA(cmsgptr)) )*/
/*to6->sin6_addr = pktinfo(cmsgptr)->ipi6_addr; - may be unaligned */
- memcpy(&to6->sin6_addr, &pktinfo(cmsgptr)->ipi6_addr, sizeof(to6->sin6_addr));
+ memcpy(&to6->sin6_addr, (char*)(CMSG_DATA(cmsgptr)) + IPI6_ADDR_OFF, sizeof(to6->sin6_addr));
/*to6->sin6_port = 123; */
-# undef pktinfo
break;
}
# endif