瀏覽代碼

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.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Marek Szyprowski 3 年之前
父節點
當前提交
def7a5c00f
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      net/net.c

+ 4 - 0
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;