packet->ifindex has random values if recvmsg() does not update msg_control
packet->ifindex has random values if recvmsg() does not update msg_control

packet is allocated on the stack in coap_read_session(), and so is
uninitialized when processed by coap_network_read().  If there is not an
appropriate cmsg entry in mhdr.msg_control when returning from recvmsg()
packet->ifindex (nor for that matter packet->dst) does not get updated.

src/coap_io.c:

Preset mhdr.msg_control initial cmsghdr with invalid information and an
oversize length so that underlying recvmsg() implementations (e.g. minimal
IoT implementations) that do not update mhdr.msg_control's data, or do not
update it with the destination IP of the packet are correctly handled.

authmillenon/libcoap,authmillenon/libcoap,authmillenon/libcoap