Skip to content

Commit da97542

Browse files
jukkarcarlescufi
authored andcommitted
net: dhcpv6: Do not wait forever when allocating net_pkt
As the allocation is run in system workqueue context, it can cause problems if waiting forever when allocating net_pkt. Fixes #77935 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 254e757 commit da97542

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subsys/net/lib/dhcpv6/dhcpv6.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ LOG_MODULE_REGISTER(net_dhcpv6, CONFIG_NET_DHCPV6_LOG_LEVEL);
2121
#include "net_private.h"
2222
#include "udp_internal.h"
2323

24+
#define PKT_WAIT_TIME K_MSEC(100)
25+
2426
/* Maximum number of options client can request. */
2527
#define DHCPV6_MAX_OPTION_REQUEST 2
2628

@@ -582,7 +584,7 @@ static struct net_pkt *dhcpv6_create_message(struct net_if *iface,
582584
msg_size = dhcpv6_calculate_message_size(options);
583585

584586
pkt = net_pkt_alloc_with_buffer(iface, msg_size, AF_INET6,
585-
IPPROTO_UDP, K_FOREVER);
587+
IPPROTO_UDP, PKT_WAIT_TIME);
586588
if (pkt == NULL) {
587589
return NULL;
588590
}

0 commit comments

Comments
 (0)