summaryrefslogtreecommitdiffhomepage
path: root/src/ubus.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-08-22 11:45:53 +0200
committerHans Dedecker <hans.dedecker@technicolor.com>2018-09-05 10:35:42 +0200
commit881f66b0c2526bff6a2a51b30d314c512df813b4 (patch)
tree234850b1775f67884468265dd15485881d69cdbb /src/ubus.c
parent3e17fd926ff0f8feae97ff7c86dd5ce282315490 (diff)
odhcpd: detect broken hostnames
Check hostnames contain valid characters as defined in RFC 952 and RFC 1123. Invalid hostnames in uci configured host entries will result into a refusal to create the static lease. In case a client received hostname contains an invalid character no <hostname> <IP address> entry will be added to the lease file. In such case the leaseinfo description in the lease file will still contain the hostname but preceded by the string broken\x20 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/ubus.c')
-rw-r--r--src/ubus.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ubus.c b/src/ubus.c
index 5be6bbe..1aec590 100644
--- a/src/ubus.c
+++ b/src/ubus.c
@@ -53,6 +53,9 @@ static int handle_dhcpv4_leases(struct ubus_context *ctx, _unused struct ubus_ob
if (c->flags & OAF_STATIC)
blobmsg_add_string(&b, NULL, "static");
+
+ if (c->flags & OAF_BROKEN_HOSTNAME)
+ blobmsg_add_string(&b, NULL, "broken-hostname");
blobmsg_close_array(&b, m);
buf = blobmsg_alloc_string_buffer(&b, "address", INET_ADDRSTRLEN);