Skip to content

Commit fbb5036

Browse files
committed
net: icmp: fix warn on allocating net_buf
net_buf_alloc_len will hard set timeout to 0 when it is in sys workq thread and print warning log. send_icmpv4_echo_request and send_icmpv6_echo_request are both allocating net_buf with timeout PKT_WAIT_TIME 1s. This will cause warning log in every icmp send and actual timeout is 0. So fix it by always setting it to 0. Signed-off-by: Fengming Ye <[email protected]>
1 parent c50777a commit fbb5036

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

subsys/net/ip/icmp.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ static sys_slist_t handlers = SYS_SLIST_STATIC_INIT(&handlers);
4848
static sys_slist_t offload_handlers = SYS_SLIST_STATIC_INIT(&offload_handlers);
4949
#endif
5050

51-
#define PKT_WAIT_TIME K_SECONDS(1)
52-
5351
int net_icmp_init_ctx(struct net_icmp_ctx *ctx, uint8_t type, uint8_t code,
5452
net_icmp_handler_t handler)
5553
{
@@ -140,7 +138,7 @@ static int send_icmpv4_echo_request(struct net_icmp_ctx *ctx,
140138
sizeof(struct net_icmpv4_echo_req)
141139
+ params->data_size,
142140
AF_INET, IPPROTO_ICMP,
143-
PKT_WAIT_TIME);
141+
K_NO_WAIT);
144142
if (!pkt) {
145143
return -ENOMEM;
146144
}
@@ -261,7 +259,7 @@ static int send_icmpv6_echo_request(struct net_icmp_ctx *ctx,
261259
sizeof(struct net_icmpv6_echo_req)
262260
+ params->data_size,
263261
AF_INET6, IPPROTO_ICMPV6,
264-
PKT_WAIT_TIME);
262+
K_NO_WAIT);
265263
if (!pkt) {
266264
return -ENOMEM;
267265
}

0 commit comments

Comments
 (0)