mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: make routing work after dhcp command
@ 2018-10-15  9:26 Antony Pavlov
  2018-10-15 14:48 ` Andrey Smirnov
  0 siblings, 1 reply; 3+ messages in thread
From: Antony Pavlov @ 2018-10-15  9:26 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: make routing work after dhcp command
  2018-10-15  9:26 [PATCH] net: make routing work after dhcp command Antony Pavlov
@ 2018-10-15 14:48 ` Andrey Smirnov
  2018-10-16  6:52   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Smirnov @ 2018-10-15 14:48 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: Barebox List

On Mon, Oct 15, 2018 at 2:26 AM Antony Pavlov <antonynpavlov@gmail.com> wrote:
>
> 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.
>

I am not really trying to make any objections to this patch, however I
can't seem to find any documented mention that just calling "dhcp" is
sufficient to bring network up in barebox.
Documentation/user/networking.rst explicitly tells one to use "ifup"
for both static and dynamic IP configurations. That being said just
calling "dhcp" used to work, so this is definitely a regression and it
might make sense to apply this fix.

Thanks,
Andrey Smirnov

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: make routing work after dhcp command
  2018-10-15 14:48 ` Andrey Smirnov
@ 2018-10-16  6:52   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2018-10-16  6:52 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: Barebox List

On Mon, Oct 15, 2018 at 07:48:37AM -0700, Andrey Smirnov wrote:
> On Mon, Oct 15, 2018 at 2:26 AM Antony Pavlov <antonynpavlov@gmail.com> wrote:
> >
> > 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.
> >
> 
> I am not really trying to make any objections to this patch, however I
> can't seem to find any documented mention that just calling "dhcp" is
> sufficient to bring network up in barebox.
> Documentation/user/networking.rst explicitly tells one to use "ifup"
> for both static and dynamic IP configurations. That being said just
> calling "dhcp" used to work, so this is definitely a regression and it
> might make sense to apply this fix.

Yes, it used to work and it should continue to work, so applied this
one.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-16  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15  9:26 [PATCH] net: make routing work after dhcp command Antony Pavlov
2018-10-15 14:48 ` Andrey Smirnov
2018-10-16  6:52   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox