Skip to contentSkip to conversation

net: ping: reset stored IP address

PATCH New Marek Szyprowski 2 participants 2 messages Jun 15, 2020 – Aug 5, 2020 1 message not in the archive Networking

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20200615091626eucas1p201c5de6731143c7928b74f61ce549f1e@eucas1p2.samsung.com

#1 lore raw

PATCH v2 1/1 net: ping: reset stored IP address

Reset the stored ping IP address before entering a netloop with different protocol to ensure that it won't be interrupted by the received correct ICMP_ECHO_REPLY packet.

---
v2:
- Moved the net_ping_ip reset to the beginning of the net_loop() if the protocol is not equal to PING. This is required, because the netretry feature of the network framework relies on the fact that the internal state of the commands is preserved between net_loop() calls.

v1: https://patchwork.ozlabs.org/project/uboot/patch/20200325134200.18959-1-m.szyprowski at samsung.com/
- Initial version

---
 net/net.c | 4 ++++
 1 file changed, 4 insertions(+)
net/net.c +4 -0
index 37932919d04..72b445774f9 100644
@@ -409,6 +409,10 @@ int net_loop(enum proto_t protocol)
 	int ret = -EINVAL;
 	enum net_loop_state prev_net_state = net_state;
 
+#if defined(CONFIG_CMD_PING)
+	if (protocol != PING)
+		net_ping_ip.s_addr = 0;
+#endif
 	net_restarted = 0;
 	net_dev_exists = 0;
 	net_try_count = 1;
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 1/1 net: ping: reset stored IP address

Quoted 5 lines · Marek Szyprowski

Reset the stored ping IP address before entering a netloop with different protocol to ensure that it won't be interrupted by the received correct ICMP_ECHO_REPLY packet.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200805/2f3c8973/attachment.sig>