diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-04 18:41:18 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-04 18:41:18 +0100 |
commit | 12ca080a1ca8dfd0aeac54485451b906a7e61b16 (patch) | |
tree | abb273fb03a73bc9c20d05f9128bdfd9bfe55e55 /libbb | |
parent | 98a4c7cf3d799ab953cb77e8b34597c73e3e7335 (diff) | |
download | busybox-w32-12ca080a1ca8dfd0aeac54485451b906a7e61b16.tar.gz busybox-w32-12ca080a1ca8dfd0aeac54485451b906a7e61b16.tar.bz2 busybox-w32-12ca080a1ca8dfd0aeac54485451b906a7e61b16.zip |
*: eliminate more aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/udp_io.c | 12 |
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, | |||
152 | if (cmsgptr->cmsg_level == IPPROTO_IP | 152 | if (cmsgptr->cmsg_level == IPPROTO_IP |
153 | && cmsgptr->cmsg_type == IP_PKTINFO | 153 | && cmsgptr->cmsg_type == IP_PKTINFO |
154 | ) { | 154 | ) { |
155 | # define pktinfo(cmsgptr) ( (struct in_pktinfo*)(CMSG_DATA(cmsgptr)) ) | 155 | const int IPI_ADDR_OFF = offsetof(struct in_pktinfo, ipi_addr); |
156 | to->sa_family = AF_INET; | 156 | to->sa_family = AF_INET; |
157 | /*# define pktinfo(cmsgptr) ( (struct in_pktinfo*)(CMSG_DATA(cmsgptr)) )*/ | ||
157 | /*to4->sin_addr = pktinfo(cmsgptr)->ipi_addr; - may be unaligned */ | 158 | /*to4->sin_addr = pktinfo(cmsgptr)->ipi_addr; - may be unaligned */ |
158 | memcpy(&to4->sin_addr, &pktinfo(cmsgptr)->ipi_addr, sizeof(to4->sin_addr)); | 159 | memcpy(&to4->sin_addr, (char*)(CMSG_DATA(cmsgptr)) + IPI_ADDR_OFF, sizeof(to4->sin_addr)); |
159 | /*to4->sin_port = 123; - this data is not supplied by kernel */ | 160 | /*to4->sin_port = 123; - this data is not supplied by kernel */ |
160 | # undef pktinfo | ||
161 | break; | 161 | break; |
162 | } | 162 | } |
163 | # if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO) | 163 | # if ENABLE_FEATURE_IPV6 && defined(IPV6_PKTINFO) |
164 | if (cmsgptr->cmsg_level == IPPROTO_IPV6 | 164 | if (cmsgptr->cmsg_level == IPPROTO_IPV6 |
165 | && cmsgptr->cmsg_type == IPV6_PKTINFO | 165 | && cmsgptr->cmsg_type == IPV6_PKTINFO |
166 | ) { | 166 | ) { |
167 | # define pktinfo(cmsgptr) ( (struct in6_pktinfo*)(CMSG_DATA(cmsgptr)) ) | 167 | const int IPI6_ADDR_OFF = offsetof(struct in6_pktinfo, ipi6_addr); |
168 | to->sa_family = AF_INET6; | 168 | to->sa_family = AF_INET6; |
169 | /*# define pktinfo(cmsgptr) ( (struct in6_pktinfo*)(CMSG_DATA(cmsgptr)) )*/ | ||
169 | /*to6->sin6_addr = pktinfo(cmsgptr)->ipi6_addr; - may be unaligned */ | 170 | /*to6->sin6_addr = pktinfo(cmsgptr)->ipi6_addr; - may be unaligned */ |
170 | memcpy(&to6->sin6_addr, &pktinfo(cmsgptr)->ipi6_addr, sizeof(to6->sin6_addr)); | 171 | memcpy(&to6->sin6_addr, (char*)(CMSG_DATA(cmsgptr)) + IPI6_ADDR_OFF, sizeof(to6->sin6_addr)); |
171 | /*to6->sin6_port = 123; */ | 172 | /*to6->sin6_port = 123; */ |
172 | # undef pktinfo | ||
173 | break; | 173 | break; |
174 | } | 174 | } |
175 | # endif | 175 | # endif |