From: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
To: netdev@vger.kernel.org
Subject: [PATCH] ipconfig: stop ip-config if disabled method directed
Date: Wed, 10 Apr 2013 16:23:54 +0900 [thread overview]
Message-ID: <5165138A.7070006@renesas.com> (raw)
Hi,
Looks insignificant, but a misusage of kernel level auto configuration
results in an invalid ipv4 address set.
That is a kind of corner case, but I think it is be better sanitizing
the input a bit more for our simple in_aton().
--
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=n
Command line: ip=dhcp
result in false ip address 62.0.0.0 set.
If directed autoconf method is not compiled into the kernel,
ip-config should be terminated.
Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
---
net/ipv4/ipconfig.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index bf6c5cf..6401aac 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1586,6 +1586,16 @@ static int __init ip_auto_config_setup(char *addrs)
if (ic_proto_name(addrs))
return 1;
+ /* This mean the kernel is not configured to have the method. */
+ if (strcmp(addrs, "dhcp") == 0 ||
+ strcmp(addrs, "bootp") == 0 ||
+ strcmp(addrs, "rarp") == 0 ||
+ strcmp(addrs, "both") == 0) {
+ pr_warn("IP-Config: autoconf [%s] not compiled in\n", addrs);
+ ic_enable = 0;
+ return 1;
+ }
+
/* If no static IP is given, turn off autoconfig and bail. */
if (*addrs == 0 ||
strcmp(addrs, "off") == 0 ||
--
1.8.1.5
next reply other threads:[~2013-04-10 7:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 7:23 Takashi Yoshii [this message]
2013-04-11 3:19 ` [PATCH] ipconfig: stop ip-config if disabled method directed David Miller
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=5165138A.7070006@renesas.com \
--to=takashi.yoshii.zj@renesas.com \
--cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.