]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: ping: reset stored IP address
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 15 Jun 2020 09:15:57 +0000 (11:15 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 5 Aug 2020 03:30:02 +0000 (23:30 -0400)
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.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
net/net.c

index 1e7f633cb69c903f3d8d183f6aa13ef2fc686892..28d9eebf9dd35c0f652d333f4f919379e09b93ed 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -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;