From: <Oleg.Karfich@wago.com>
To: barebox@lists.infradead.org
Cc: Oleg.Karfich@wago.com
Subject: [PATCH 1/3] net: dhcp: use private extension 224 also in discover requests
Date: Fri, 31 Aug 2018 09:01:32 +0000 [thread overview]
Message-ID: <1535706079-10439-2-git-send-email-oleg.karfich@wago.com> (raw)
In-Reply-To: <1535706079-10439-1-git-send-email-oleg.karfich@wago.com>
Signed-off-by: Oleg Karfich <oleg.karfich@wago.com>
---
include/dhcp.h | 1 +
net/dhcp.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/dhcp.h b/include/dhcp.h
index 0977ff4..ce5ed61 100644
--- a/include/dhcp.h
+++ b/include/dhcp.h
@@ -18,6 +18,7 @@ struct dhcp_req_param {
char *client_id;
char *user_class;
char *client_uuid;
+ char *option224;
int retries;
};
diff --git a/net/dhcp.c b/net/dhcp.c
index d30551d..6394397 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -98,6 +98,7 @@ struct dhcp_receivce_opts {
#define DHCP_CLIENT_ID 61
#define DHCP_USER_CLASS 77
#define DHCP_CLIENT_UUID 97
+#define DHCP_OPTION224 224
static int dhcp_set_ip_options(int option, u8 *e, IPaddr_t ip)
{
@@ -212,6 +213,7 @@ static int dhcp_extended(u8 *e, int message_type, IPaddr_t ServerID,
e += dhcp_set_string_options(DHCP_CLIENT_ID, dhcp_param.client_id, e);
e += dhcp_set_string_options(DHCP_USER_CLASS, dhcp_param.user_class, e);
e += dhcp_set_string_options(DHCP_CLIENT_UUID, dhcp_param.client_uuid, e);
+ e += dhcp_set_string_options(DHCP_OPTION224, dhcp_param.option224, e);
*e++ = 55; /* Parameter Request List */
cnt = e++; /* Pointer to count of requested items */
@@ -446,6 +448,7 @@ static char *global_dhcp_bootfile;
static char *global_dhcp_oftree_file;
static char *global_dhcp_rootpath;
static char *global_dhcp_tftp_server_name;
+static char *global_dhcp_option224;
static void set_res(char **var, const char *res)
{
@@ -478,6 +481,8 @@ int dhcp_request(struct eth_device *edev, const struct dhcp_req_param *param,
dhcp_param.client_uuid = global_dhcp_client_uuid;
if (!dhcp_param.client_id)
dhcp_param.client_id = global_dhcp_client_id;
+ if (!dhcp_param.option224)
+ dhcp_param.option224 = global_dhcp_option224;
if (!dhcp_param.retries)
dhcp_param.retries = DHCP_DEFAULT_RETRY;
@@ -624,6 +629,7 @@ static int dhcp_global_init(void)
globalvar_add_simple_string("dhcp.user_class", &global_dhcp_user_class);
globalvar_add_simple_string("dhcp.oftree_file", &global_dhcp_oftree_file);
globalvar_add_simple_string("dhcp.tftp_server_name", &global_dhcp_tftp_server_name);
+ globalvar_add_simple_string("dhcp.option224", &global_dhcp_option224);
return 0;
}
@@ -639,3 +645,4 @@ BAREBOX_MAGICVAR_NAMED(global_dhcp_user_class, global.dhcp.user_class, "user cla
BAREBOX_MAGICVAR_NAMED(global_dhcp_tftp_server_name, global.dhcp.tftp_server_name, "TFTP server Name returned from DHCP request");
BAREBOX_MAGICVAR_NAMED(global_dhcp_oftree_file, global.dhcp.oftree_file, "OF tree returned from DHCP request (option 224)");
BAREBOX_MAGICVAR_NAMED(global_dhcp_retries, global.dhcp.retries, "retry limit");
+BAREBOX_MAGICVAR_NAMED(global_dhcp_option224, global.dhcp.option224, "private data to send to the DHCP server (option 224)");
--
2.7.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-08-31 9:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-31 9:01 [PATCH 0/3] extend dhcp functionality Oleg.Karfich
2018-08-31 9:01 ` [PATCH 2/3] commands: dhcp: add parameter for private data Oleg.Karfich
2018-08-31 9:01 ` Oleg.Karfich [this message]
2018-08-31 9:01 ` [PATCH 3/3] net: dhcp: add global variable for retries Oleg.Karfich
2018-09-04 6:12 ` Sascha Hauer
2018-09-04 7:02 ` Oleg.Karfich
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=1535706079-10439-2-git-send-email-oleg.karfich@wago.com \
--to=oleg.karfich@wago.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