mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH] net: make routing work after dhcp command
Date: Mon, 15 Oct 2018 12:26:11 +0300	[thread overview]
Message-ID: <20181015092611.7223-1-antonynpavlov@gmail.com> (raw)

At the moment only ifup stuff turns netif up.
After the commit f0624a701513 ('net: Do not route traffic
to interfaces that are not up') the dhcp command
keeps netif->ifup == false and network subsystem
can't route packets.

How to repropduce the problem on qemu-malta_defconfig:

    qemu-system-mips -nodefaults -M malta -m 256 \
                     -nographic -serial stdio -monitor null \
                     -bios barebox-flash-image \
                     -net user -net nic,model=rtl8139

    ...

    barebox:/ dhcp
    eth0: 100Mbps full duplex link detected
    eth0: DHCP client bound to address 10.0.2.15
    barebox:/ ping 10.0.2.2
    ping failed: No route to host

However if ifup command is used for network interface
configuration then there is no network problem, e.g.

    barebox:/ ifup eth0
    eth0: 100Mbps full duplex link detected
    eth0: DHCP client bound to address 10.0.2.15
    barebox:/ ping 10.0.2.2
    host 10.0.2.2 is alive

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
CC: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 net/dhcp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/dhcp.c b/net/dhcp.c
index 984d32a93e..427d80a5a8 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -615,6 +615,9 @@ int dhcp(struct eth_device *edev, const struct dhcp_req_param *param)
 
 	dhcp_result_free(res);
 
+	if (!ret)
+		edev->ifup = true;
+
 	return ret;
 }
 
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2018-10-15  9:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15  9:26 Antony Pavlov [this message]
2018-10-15 14:48 ` Andrey Smirnov
2018-10-16  6:52   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181015092611.7223-1-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox