From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Fri, 12 Jun 2020 12:04:09 -0400 Subject: [PATCH] net: ping: reset stored IP once the command finishes In-Reply-To: <20200325134200.18959-1-m.szyprowski@samsung.com> References: <20200325134200.18959-1-m.szyprowski@samsung.com> Message-ID: <20200612160409.GA7713@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wed, Mar 25, 2020 at 02:42:00PM +0100, Marek Szyprowski wrote: > Reset stored ping IP address before leaving the netloop to ensure that > the subsequent calls to the netloop, especially for the other protocols, > won't be interrupted by the received ICMP_ECHO_REPLY packet. > > Signed-off-by: Marek Szyprowski > --- > net/ping.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/net/ping.c b/net/ping.c > index 633c942..d912e3d 100644 > --- a/net/ping.c > +++ b/net/ping.c > @@ -63,6 +63,7 @@ static int ping_send(void) > static void ping_timeout_handler(void) > { > eth_halt(); > + net_ping_ip.s_addr = 0; > net_set_state(NETLOOP_FAIL); /* we did not get the reply */ > } > > @@ -84,8 +85,10 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) > switch (icmph->type) { > case ICMP_ECHO_REPLY: > src_ip = net_read_ip((void *)&ip->ip_src); > - if (src_ip.s_addr == net_ping_ip.s_addr) > + if (src_ip.s_addr == net_ping_ip.s_addr) { > + net_ping_ip.s_addr = 0; > net_set_state(NETLOOP_SUCCESS); > + } > return; > case ICMP_ECHO_REQUEST: > eth_hdr_size = net_update_ether(et, et->et_src, PROT_IP); This breaks a number of tests in test/dm/eth.c. Can you please adjust the tests as well to not rely on the behavior you're fixing? Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: