fix strict aliasing errors
This commit is contained in:
parent
88aa3de48b
commit
7e0b977fcd
@ -307,8 +307,9 @@ int capwap_recvfrom(int sock, void* buffer, int* size, union sockaddr_capwap* fr
|
||||
for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg != NULL; cmsg = CMSG_NXTHDR(&msgh, cmsg)) {
|
||||
#ifdef IP_PKTINFO
|
||||
if ((cmsg->cmsg_level == SOL_IP) && (cmsg->cmsg_type == IP_PKTINFO)) {
|
||||
struct in_pktinfo *pi = (struct in_pktinfo *)CMSG_DATA(cmsg);
|
||||
toaddr->sin.sin_family = AF_INET;
|
||||
memcpy(&toaddr->sin.sin_addr, &((struct in_pktinfo*)CMSG_DATA(cmsg))->ipi_addr, sizeof(struct in_addr));
|
||||
memcpy(&toaddr->sin.sin_addr, &pi->ipi_addr, sizeof(struct in_addr));
|
||||
break;
|
||||
}
|
||||
#elif defined IP_RECVDSTADDR
|
||||
@ -319,8 +320,9 @@ int capwap_recvfrom(int sock, void* buffer, int* size, union sockaddr_capwap* fr
|
||||
}
|
||||
#endif
|
||||
if ((cmsg->cmsg_level == IPPROTO_IPV6) && ((cmsg->cmsg_type == IPV6_PKTINFO) || (cmsg->cmsg_type == IPV6_RECVPKTINFO))) {
|
||||
struct in6_pktinfo *pi6 = (struct in6_pktinfo*) CMSG_DATA(cmsg);
|
||||
toaddr->sin6.sin6_family = AF_INET6;
|
||||
memcpy(&toaddr->sin6.sin6_addr, &((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_addr, sizeof(struct in6_addr));
|
||||
memcpy(&toaddr->sin6.sin6_addr, &pi6->ipi6_addr, sizeof(struct in6_addr));
|
||||
|
||||
/* Check if IPv4 is mapped into IPv6 */
|
||||
if (fromaddr->ss.ss_family == AF_INET) {
|
||||
|
@ -446,6 +446,7 @@ static struct capwap_packet_txmng* capwap_packet_txmng_create(struct capwap_head
|
||||
|
||||
/* */
|
||||
struct capwap_packet_txmng* capwap_packet_txmng_create_ctrl_message(struct capwap_header_data* data, unsigned long type, unsigned char seq, unsigned short mtu) {
|
||||
struct capwap_header* header;
|
||||
unsigned short length;
|
||||
struct capwap_packet_txmng* txmngpacket;
|
||||
struct capwap_fragment_packet_item* fragmentpacket;
|
||||
@ -453,7 +454,8 @@ struct capwap_packet_txmng* capwap_packet_txmng_create_ctrl_message(struct capwa
|
||||
ASSERT(data != NULL);
|
||||
ASSERT(mtu > 0);
|
||||
|
||||
length = GET_HLEN_HEADER((struct capwap_header*)data->headerbuffer) * 4;
|
||||
header = (struct capwap_header *)data->headerbuffer;
|
||||
length = GET_HLEN_HEADER(header) * 4;
|
||||
|
||||
/* Check MTU */
|
||||
if ((mtu > 0) && (mtu < (length + sizeof(struct capwap_control_message)))) {
|
||||
|
Loading…
Reference in New Issue
Block a user