* [PATCH 1/2] ifup: remove deletion of ip env
@ 2016-06-14 6:55 Alexander Aring
2016-06-14 6:55 ` [PATCH 2/2] ifup: fix handling when ip env is not given Alexander Aring
2016-06-15 5:40 ` [PATCH 1/2] ifup: remove deletion of ip env Sascha Hauer
0 siblings, 2 replies; 4+ messages in thread
From: Alexander Aring @ 2016-06-14 6:55 UTC (permalink / raw)
To: barebox; +Cc: Alexander Aring
This patch removes the deletion of ip env and changes to the behaviour
that it use previous ip=$TYPE assignments if ip env is not part of network
env which will be sourced.
Example:
somewhere in shell: ip=dhcp
\- in case of ip=$TYPE in network env: overwrites the ip env
\- in case of NO ip=$TYPE in network env: use the ip="dhcp" from shell
Signed-off-by: Alexander Aring <aar@pengutronix.de>
---
Don't know if this patch breaks to much handling with previous env handling,
but I would except such handling.
Also don't know if the example is correct or I mixed something with
global/local envs.
Maybe apply patch 2/2 only.
net/ifup.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/ifup.c b/net/ifup.c
index f22afc9..17e1b2f 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -62,8 +62,6 @@ int ifup(const char *name, unsigned flags)
env_push_context();
- setenv("ip", "");
-
for (i = 0; i < ARRAY_SIZE(vars); i++)
setenv(vars[i], "");
--
2.8.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] ifup: fix handling when ip env is not given
2016-06-14 6:55 [PATCH 1/2] ifup: remove deletion of ip env Alexander Aring
@ 2016-06-14 6:55 ` Alexander Aring
2016-06-15 5:43 ` Sascha Hauer
2016-06-15 5:40 ` [PATCH 1/2] ifup: remove deletion of ip env Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Alexander Aring @ 2016-06-14 6:55 UTC (permalink / raw)
To: barebox; +Cc: Alexander Aring
This patch handles the ip env to "" if no ip env is given. Otherwise
we get a NULL pointer derefence.
Signed-off-by: Alexander Aring <aar@pengutronix.de>
---
net/ifup.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ifup.c b/net/ifup.c
index 17e1b2f..59df069 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -94,6 +94,9 @@ int ifup(const char *name, unsigned flags)
goto out;
ip = getenv("ip");
+ if (!ip)
+ ip = "";
+
if (!strcmp(ip, "dhcp")) {
ret = run_command("dhcp");
if (ret)
--
2.8.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ifup: fix handling when ip env is not given
2016-06-14 6:55 ` [PATCH 2/2] ifup: fix handling when ip env is not given Alexander Aring
@ 2016-06-15 5:43 ` Sascha Hauer
0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2016-06-15 5:43 UTC (permalink / raw)
To: Alexander Aring; +Cc: barebox
On Tue, Jun 14, 2016 at 08:55:06AM +0200, Alexander Aring wrote:
> This patch handles the ip env to "" if no ip env is given. Otherwise
> we get a NULL pointer derefence.
>
> Signed-off-by: Alexander Aring <aar@pengutronix.de>
> ---
> net/ifup.c | 3 +++
> 1 file changed, 3 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/net/ifup.c b/net/ifup.c
> index 17e1b2f..59df069 100644
> --- a/net/ifup.c
> +++ b/net/ifup.c
> @@ -94,6 +94,9 @@ int ifup(const char *name, unsigned flags)
> goto out;
>
> ip = getenv("ip");
> + if (!ip)
> + ip = "";
> +
> if (!strcmp(ip, "dhcp")) {
> ret = run_command("dhcp");
> if (ret)
> --
> 2.8.3
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
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] 4+ messages in thread
* Re: [PATCH 1/2] ifup: remove deletion of ip env
2016-06-14 6:55 [PATCH 1/2] ifup: remove deletion of ip env Alexander Aring
2016-06-14 6:55 ` [PATCH 2/2] ifup: fix handling when ip env is not given Alexander Aring
@ 2016-06-15 5:40 ` Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2016-06-15 5:40 UTC (permalink / raw)
To: Alexander Aring; +Cc: barebox
On Tue, Jun 14, 2016 at 08:55:05AM +0200, Alexander Aring wrote:
> This patch removes the deletion of ip env and changes to the behaviour
> that it use previous ip=$TYPE assignments if ip env is not part of network
> env which will be sourced.
>
> Example:
> somewhere in shell: ip=dhcp
> \- in case of ip=$TYPE in network env: overwrites the ip env
> \- in case of NO ip=$TYPE in network env: use the ip="dhcp" from shell
>
> Signed-off-by: Alexander Aring <aar@pengutronix.de>
> ---
> Don't know if this patch breaks to much handling with previous env handling,
> but I would except such handling.
>
> Also don't know if the example is correct or I mixed something with
> global/local envs.
>
> Maybe apply patch 2/2 only.
>
> net/ifup.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/net/ifup.c b/net/ifup.c
> index f22afc9..17e1b2f 100644
> --- a/net/ifup.c
> +++ b/net/ifup.c
> @@ -62,8 +62,6 @@ int ifup(const char *name, unsigned flags)
>
> env_push_context();
>
> - setenv("ip", "");
> -
Erm, no. It was intentional to *not* leak in previous settings of the ip
variable to make the behaviour deterministic and not dependent on
previous env settings.
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] 4+ messages in thread
end of thread, other threads:[~2016-06-15 5:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14 6:55 [PATCH 1/2] ifup: remove deletion of ip env Alexander Aring
2016-06-14 6:55 ` [PATCH 2/2] ifup: fix handling when ip env is not given Alexander Aring
2016-06-15 5:43 ` Sascha Hauer
2016-06-15 5:40 ` [PATCH 1/2] ifup: remove deletion of ip env Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox