diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.md | 30 | ||||
-rw-r--r-- | config.def.h | 2 | ||||
-rw-r--r-- | dyndhcpd.c | 15 | ||||
-rw-r--r-- | dyndhcpd.h | 2 | ||||
-rw-r--r-- | systemd/dyndhcpd@.service | 2 |
6 files changed, 39 insertions, 14 deletions
@@ -13,7 +13,7 @@ LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie # this is just a fallback in case you do not use git but downloaded # a release tarball... -VERSION := 0.1.6 +VERSION := 0.1.8 all: dyndhcpd README.html @@ -1,16 +1,24 @@ dyndhcpd ======== +[](https://github.com/eworm-de/dyndhcpd/stargazers) +[](https://github.com/eworm-de/dyndhcpd/network) +[](https://github.com/eworm-de/dyndhcpd/watchers) + start DHCP daemon that dynamically creates configuration based on assigned IP address +*Use at your own risk*, pay attention to +[license and warranty](#license-and-warranty), and +[disclaimer on external links](#disclaimer-on-external-links)! + Requirements ------------ To compile and run `dyndhcpd` you need: -* [ISC DHCPD](https://www.isc.org/software/dhcp) -* [markdown](https://daringfireball.net/projects/markdown/) (HTML documentation) +* [ISC DHCPD ↗️](https://www.isc.org/software/dhcp) +* [markdown ↗️](https://daringfireball.net/projects/markdown/) (HTML documentation) Build and install ----------------- @@ -47,6 +55,21 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [GNU General Public License](COPYING.md) for more details. +Disclaimer on external links +---------------------------- + +Our website contains links to the websites of third parties ("external +links"). As the content of these websites is not under our control, we +cannot assume any liability for such external content. In all cases, the +provider of information of the linked websites is liable for the content +and accuracy of the information provided. At the point in time when the +links were placed, no infringements of the law were recognisable to us. +As soon as an infringement of the law becomes known to us, we will +immediately remove the link in question. + +> 💡️ **Hint**: All external links are marked with an arrow pointing +> diagonally in an up-right (or north-east) direction (↗️). + ### Upstream URL: @@ -55,3 +78,6 @@ URL: Mirror: [eworm.de](https://git.eworm.de/cgit.cgi/dyndhcpd/) [GitLab.com](https://gitlab.com/eworm-de/dyndhcpd#dyndhcpd) + +--- +[⬆️ Go back to top](#top) diff --git a/config.def.h b/config.def.h index 3384037..7ebe467 100644 --- a/config.def.h +++ b/config.def.h @@ -1,5 +1,5 @@ /* - * (C) 2013-2021 by Christian Hesse <mail@eworm.de> + * (C) 2013-2025 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1,5 +1,5 @@ /* - * (C) 2013-2021 by Christian Hesse <mail@eworm.de> + * (C) 2013-2025 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ int replace(char ** config, size_t *length, const char ** tmp, if (strncmp(template, *tmp, templatelength) == 0) { *config = realloc(*config, *length + strlen(value) + 1); - *length += sprintf(*config + *length, value); + *length += sprintf(*config + *length, "%s", value); *tmp += templatelength; return 1; } @@ -57,8 +57,7 @@ int main(int argc, char ** argv) { char * interface = NULL; char hostname[HOST_NAME_MAX]; - const char * domainname; - struct hostent *hp; + char * domainname; char * template = NULL; FILE * templatefile; @@ -140,11 +139,11 @@ int main(int argc, char ** argv) { goto out; } - /* get the domainname */ - hp = gethostbyname(hostname); - if ((domainname = strchr(hp->h_name, '.')) != NULL) + /* get the domainname and strip it from hostname */ + if ((domainname = strchr(hostname, '.')) != NULL) { + *domainname = 0; domainname++; - else { + } else { fprintf(stderr, "Could not get domainname, using '" FALLBACKDOMAIN "'\n"); domainname = FALLBACKDOMAIN; } @@ -1,5 +1,5 @@ /* - * (C) 2013-2021 by Christian Hesse <mail@eworm.de> + * (C) 2013-2025 by Christian Hesse <mail@eworm.de> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/systemd/dyndhcpd@.service b/systemd/dyndhcpd@.service index 85dfc30..b271bd0 100644 --- a/systemd/dyndhcpd@.service +++ b/systemd/dyndhcpd@.service @@ -1,4 +1,4 @@ -# (C) 2013-2021 by Christian Hesse <mail@eworm.de> +# (C) 2013-2025 by Christian Hesse <mail@eworm.de> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by |