From edb85f0d8d0a84f27308a3728f3fde3c52b9dce2 Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Mon, 14 Jul 2014 13:34:18 +0530 Subject: networkd: dhcp add vendor class indentifier option 60 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Vendor Class Identifier be used by DHCP clients to identify their vendor type and configuration. When using this option, vendors can define their own specific identifier values, such as to convey a particular hardware or operating system configuration or other identifying information. Vendor-specified DHCP options—features that let administrators assign separate options to clients with similar configuration requirements. For example, if DHCP-aware clients for example we want to separate different gateway and option for different set of people (dev/test/hr/finance) in a org or devices for example web/database servers or let's say in a embedded device etc and require a different default gateway or DNS server than the rest of clients. --- src/network/networkd-link.c | 7 +++++++ src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.c | 1 + src/network/networkd.h | 2 ++ 4 files changed, 11 insertions(+) (limited to 'src/network') diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 5f6c22a611..9e057ce0ff 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2023,6 +2023,13 @@ static int link_configure(Link *link) { return r; } } + + if (link->network->dhcp_vendor_class_identifier) { + r = sd_dhcp_client_set_vendor_class_identifier(link->dhcp_client, + link->network->dhcp_vendor_class_identifier); + if (r < 0) + return r; + } } if (link->network->dhcp_server) { diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 50cb0f8be9..5c1c013373 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -51,6 +51,7 @@ DHCP.UseDomainName, config_parse_bool, 0, DHCP.UseRoutes, config_parse_bool, 0, offsetof(Network, dhcp_routes) DHCP.SendHostname, config_parse_bool, 0, offsetof(Network, dhcp_sendhost) DHCP.CriticalConnection, config_parse_bool, 0, offsetof(Network, dhcp_critical) +DHCP.VendorClassIdentifier, config_parse_string, 0, offsetof(Network, dhcp_vendor_class_identifier) /* backwards compatibility: do not add new entries to this section */ DHCPv4.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_dns) DHCPv4.UseMTU, config_parse_bool, 0, offsetof(Network, dhcp_mtu) diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 9f6de18538..c108ad2358 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -166,6 +166,7 @@ void network_free(Network *network) { free(network->match_name); free(network->description); + free(network->dhcp_vendor_class_identifier); while ((address = network->ntp)) { LIST_REMOVE(addresses, network->ntp, address); diff --git a/src/network/networkd.h b/src/network/networkd.h index aca3b8dd24..0f0ecd5c43 100644 --- a/src/network/networkd.h +++ b/src/network/networkd.h @@ -175,6 +175,8 @@ struct Network { char *match_driver; char *match_type; char *match_name; + char *dhcp_vendor_class_identifier; + Condition *match_host; Condition *match_virt; Condition *match_kernel; -- cgit v1.2.3-54-g00ecf