Skip to content

Commit 4f644d8

Browse files
Cristib05jhedberg
authored andcommitted
net: socket: Fix recvmsg() pktinfo support.
Fix an issue where IPV6_RECVPKTINFO was used instead of IPV6_PKTINFO when insert_pktinfo was called. Signed-off-by: Cristian Bulacu <[email protected]>
1 parent 6c826ef commit 4f644d8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

include/zephyr/net/socket.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,9 @@ struct ipv6_mreq {
10921092
*/
10931093
#define IPV6_RECVPKTINFO 49
10941094

1095+
/** Option which returns an in6_pktinfo structure in ancillary data */
1096+
#define IPV6_PKTINFO 50
1097+
10951098
/** Pass an IPV6_RECVHOPLIMIT ancillary message that contains information
10961099
* about the hop limit of the incoming packet. See RFC 3542.
10971100
*/

subsys/net/lib/sockets/sockets_inet.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ static int add_pktinfo(struct net_context *ctx,
10501050
net_ipv6_addr_copy_raw((uint8_t *)&info.ipi6_addr, ipv6_hdr->dst);
10511051
info.ipi6_ifindex = ctx->iface;
10521052

1053-
ret = insert_pktinfo(msg, IPPROTO_IPV6, IPV6_RECVPKTINFO,
1053+
ret = insert_pktinfo(msg, IPPROTO_IPV6, IPV6_PKTINFO,
10541054
&info, sizeof(info));
10551055

10561056
goto out;

0 commit comments

Comments
 (0)