mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-12 21:41:28 +00:00
IP_PKTINFO: set msg_controllen upon output
This fixes a bug where when writing IP_PKTINFO to msg_control, the msg_controllen field was not updated with the length written This bug is exposed by applications that provide a msg_control buffer large enough for multiple control messages. Then when calling CMSG_NXTHDR, it returned a next cmsg pointer even though was no additional message
This commit is contained in:
parent
5cd475d91b
commit
99e1f37b82
@ -1088,6 +1088,7 @@ lwip_recvfrom_udp_raw(struct lwip_sock *sock, int flags, struct msghdr *msg, u16
|
||||
chdr->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
|
||||
pkti->ipi_ifindex = buf->p->if_idx;
|
||||
inet_addr_from_ip4addr(&pkti->ipi_addr, ip_2_ip4(netbuf_destaddr(buf)));
|
||||
msg->msg_controllen = CMSG_SPACE(sizeof(struct in_pktinfo));
|
||||
wrote_msg = 1;
|
||||
} else {
|
||||
msg->msg_flags |= MSG_CTRUNC;
|
||||
|
Loading…
Reference in New Issue
Block a user