chiark / gitweb /
networkd: split out vlan and macvlan handling
[elogind.git] / src / network / networkd-link.c
index a523a3e9b2d7f47f16785e9ef8b3a46d7d671fd0..660efedc61b0d0dd515b1ab1cae219e735cde7d8 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <netinet/ether.h>
 #include <linux/if.h>
+#include <unistd.h>
 
 #include "networkd.h"
 #include "libudev-private.h"
@@ -1992,6 +1993,7 @@ static int link_configure(Link *link) {
                         if (r < 0)
                                 return r;
                 }
+
                 if (link->network->dhcp_routes) {
                         r = sd_dhcp_client_set_request_option(link->dhcp_client, DHCP_OPTION_STATIC_ROUTE);
                         if (r < 0)
@@ -2000,6 +2002,18 @@ static int link_configure(Link *link) {
                         if (r < 0)
                                 return r;
                 }
+
+                if (link->network->dhcp_sendhost) {
+                        _cleanup_free_ char *hostname = gethostname_malloc();
+                        if (!hostname)
+                                return -ENOMEM;
+
+                        if (!is_localhost(hostname)) {
+                                r = sd_dhcp_client_set_hostname(link->dhcp_client, hostname);
+                                if (r < 0)
+                                        return r;
+                        }
+                }
         }
 
         if (link->network->dhcp_server) {