diff options
Diffstat (limited to 'libhw')
-rw-r--r-- | libhw/common_include/libhw/generic/net.h | 5 | ||||
-rw-r--r-- | libhw/host_net.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libhw/common_include/libhw/generic/net.h b/libhw/common_include/libhw/generic/net.h index 8dedaea..e23dcda 100644 --- a/libhw/common_include/libhw/generic/net.h +++ b/libhw/common_include/libhw/generic/net.h @@ -106,6 +106,11 @@ struct net_packet_conn_vtable { ssize_t (*sendto )(implements_net_packet_conn *self, void *buf, size_t len, struct net_ip4_addr node, uint16_t port); + /** + * @return The full length of the message, which may be more + * than the given `len` (as if the Linux MSG_TRUNC flag were + * given). + */ ssize_t (*recvfrom)(implements_net_packet_conn *self, void *buf, size_t len, struct net_ip4_addr *ret_node, uint16_t *ret_port); diff --git a/libhw/host_net.c b/libhw/host_net.c index 27df2e2..75486aa 100644 --- a/libhw/host_net.c +++ b/libhw/host_net.c @@ -457,7 +457,8 @@ static void *hostnet_pthread_recvfrom(void *_args) { if (*(args->ret_size) < 0) goto end; - *(args->ret_size) = recvfrom(args->connfd, args->buf, args->count, 0, &addr.gen, &addr_size); + *(args->ret_size) = recvfrom(args->connfd, args->buf, args->count, + MSG_TRUNC, &addr.gen, &addr_size); if (*(args->ret_size) < 0) goto end; |