From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/6] dhcp: set global domainname and nameserver
Date: Sun, 15 Apr 2012 15:26:18 +0200 [thread overview]
Message-ID: <1334496380-4091-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1334496380-4091-1-git-send-email-s.hauer@pengutronix.de>
nameserver and domainname are now netdevice parameters. Use them.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
net/dhcp.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/net/dhcp.c b/net/dhcp.c
index 0116ba4..82ab100 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -104,12 +104,21 @@ static void gateway_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen
net_set_gateway(ip);
}
-static void env_ip_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
+static void nameserver_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
{
IPaddr_t ip;
ip = net_read_ip(popt);
- setenv_ip(opt->barebox_var_name, ip);
+ net_set_nameserver(ip);
+}
+
+static void domainname_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
+{
+ char str[256];
+
+ memcpy(str, popt, optlen);
+ str[optlen] = 0;
+ net_set_domainname(str);
}
static void env_str_handle(struct dhcp_opt *opt, unsigned char *popt, int optlen)
@@ -169,16 +178,14 @@ struct dhcp_opt dhcp_options[] = {
.handle = gateway_handle,
}, {
.option = 6,
- .handle = env_ip_handle,
- .barebox_var_name = "nameserver",
+ .handle = nameserver_handle,
}, {
.option = 12,
.handle = env_str_handle,
.barebox_var_name = "hostname",
}, {
.option = 15,
- .handle = env_str_handle,
- .barebox_var_name = "domainname",
+ .handle = domainname_handle,
}, {
.option = 17,
.handle = env_str_handle,
@@ -697,9 +704,7 @@ BAREBOX_CMD_START(dhcp)
BAREBOX_CMD_END
BAREBOX_MAGICVAR(bootfile, "bootfile returned from DHCP request");
-BAREBOX_MAGICVAR(nameserver, "Nameserver returned from DHCP request");
BAREBOX_MAGICVAR(hostname, "hostname returned from DHCP request");
-BAREBOX_MAGICVAR(domainname, "domainname returned from DHCP request");
BAREBOX_MAGICVAR(rootpath, "rootpath returned from DHCP request");
BAREBOX_MAGICVAR(dhcp_vendor_id, "vendor id to send to the DHCP server");
BAREBOX_MAGICVAR(dhcp_client_uuid, "cliend uuid to send to the DHCP server");
--
1.7.10
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-04-15 13:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-15 13:26 dns work Sascha Hauer
2012-04-15 13:26 ` [PATCH 1/6] net dns: remove debug code Sascha Hauer
2012-04-15 13:26 ` [PATCH 2/6] net: use static string in string_to_ip Sascha Hauer
2012-04-15 13:26 ` [PATCH 3/6] net: add nameserver and domainname to net devices Sascha Hauer
2012-04-15 13:20 ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15 13:43 ` Sascha Hauer
2012-04-15 13:29 ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15 13:26 ` Sascha Hauer [this message]
2012-04-15 13:26 ` [PATCH 5/6] dns: use global nameserver/domainname Sascha Hauer
2012-04-15 13:26 ` [PATCH 6/6] fs tftp: use resolv to resolv ip address 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=1334496380-4091-5-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--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