*** diff
set message length to the correct value for the IP_RECVDSTADDR case
|
|
|
2799 | 2799 | mesg.msg_name = &to->dest.addr.sa; |
2800 | 2800 | mesg.msg_namelen = sizeof (struct sockaddr_in); |
2801 | 2801 | mesg.msg_control = &opi; |
2802 | | mesg.msg_controllen = sizeof (struct openvpn_in4_pktinfo); |
2803 | 2802 | mesg.msg_flags = 0; |
2804 | 2803 | cmsg = CMSG_FIRSTHDR (&mesg); |
2805 | | cmsg->cmsg_len = sizeof (struct openvpn_in4_pktinfo); |
2806 | 2804 | #ifdef HAVE_IN_PKTINFO |
| 2805 | mesg.msg_controllen = sizeof (struct openvpn_in4_pktinfo); |
| 2806 | cmsg->cmsg_len = sizeof (struct openvpn_in4_pktinfo); |
2807 | 2807 | cmsg->cmsg_level = SOL_IP; |
2808 | 2808 | cmsg->cmsg_type = IP_PKTINFO; |
2809 | 2809 | { |
… |
… |
|
2814 | 2814 | pkti->ipi_addr.s_addr = 0; |
2815 | 2815 | } |
2816 | 2816 | #elif defined(IP_RECVDSTADDR) |
| 2817 | mesg.msg_controllen = CMSG_SPACE(sizeof (struct in_addr)); |
| 2818 | cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr)); |
2817 | 2819 | cmsg->cmsg_level = IPPROTO_IP; |
2818 | 2820 | cmsg->cmsg_type = IP_RECVDSTADDR; |
2819 | 2821 | *(struct in_addr *) CMSG_DATA (cmsg) = to->pi.in4; |