diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2018-08-22 11:45:53 +0200 |
---|---|---|
committer | Hans Dedecker <hans.dedecker@technicolor.com> | 2018-09-05 10:35:42 +0200 |
commit | 881f66b0c2526bff6a2a51b30d314c512df813b4 (patch) | |
tree | 234850b1775f67884468265dd15485881d69cdbb /src/odhcpd.h | |
parent | 3e17fd926ff0f8feae97ff7c86dd5ce282315490 (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/odhcpd.h')
-rw-r--r-- | src/odhcpd.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/odhcpd.h b/src/odhcpd.h index 91fdcbf..ef94cfc 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -129,9 +129,10 @@ enum odhcpd_mode { enum odhcpd_assignment_flags { - OAF_TENTATIVE = (1 << 0), - OAF_BOUND = (1 << 1), - OAF_STATIC = (1 << 2), + OAF_TENTATIVE = (1 << 0), + OAF_BOUND = (1 << 1), + OAF_STATIC = (1 << 2), + OAF_BROKEN_HOSTNAME = (1 << 3), }; struct config { @@ -288,6 +289,7 @@ void odhcpd_bmemcpy(void *av, const void *bv, size_t bits); int odhcpd_netmask2bitlen(bool v6, void *mask); bool odhcpd_bitlen2netmask(bool v6, unsigned int bits, void *mask); +bool odhcpd_valid_hostname(const char *name); int config_parse_interface(void *data, size_t len, const char *iname, bool overwrite); |