2 This file is part of systemd.
4 Copyright 2013 Tom Gundersen <teg@jklm.no>
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 #include "alloc-util.h"
24 #include "conf-files.h"
25 #include "conf-parser.h"
26 #include "dns-domain.h"
28 #include "hostname-util.h"
29 #include "network-internal.h"
30 #include "networkd-network.h"
32 #include "parse-util.h"
34 #include "stat-util.h"
35 #include "string-table.h"
36 #include "string-util.h"
39 static int network_load_one(Manager
*manager
, const char *filename
) {
40 _cleanup_network_free_ Network
*network
= NULL
;
41 _cleanup_fclose_
FILE *file
= NULL
;
43 const char *dropin_dirname
;
51 file
= fopen(filename
, "re");
59 if (null_or_empty_fd(fileno(file
))) {
60 log_debug("Skipping empty file: %s", filename
);
64 network
= new0(Network
, 1);
68 network
->manager
= manager
;
70 LIST_HEAD_INIT(network
->static_addresses
);
71 LIST_HEAD_INIT(network
->static_routes
);
72 LIST_HEAD_INIT(network
->static_fdb_entries
);
74 network
->stacked_netdevs
= hashmap_new(&string_hash_ops
);
75 if (!network
->stacked_netdevs
)
78 network
->addresses_by_section
= hashmap_new(NULL
);
79 if (!network
->addresses_by_section
)
82 network
->routes_by_section
= hashmap_new(NULL
);
83 if (!network
->routes_by_section
)
86 network
->fdb_entries_by_section
= hashmap_new(NULL
);
87 if (!network
->fdb_entries_by_section
)
90 network
->filename
= strdup(filename
);
91 if (!network
->filename
)
94 network
->name
= strdup(basename(filename
));
98 d
= strrchr(network
->name
, '.');
102 assert(streq(d
, ".network"));
106 network
->dhcp
= ADDRESS_FAMILY_NO
;
107 network
->dhcp_use_ntp
= true;
108 network
->dhcp_use_dns
= true;
109 network
->dhcp_use_hostname
= true;
110 network
->dhcp_use_routes
= true;
111 network
->dhcp_send_hostname
= true;
112 network
->dhcp_route_metric
= DHCP_ROUTE_METRIC
;
113 network
->dhcp_client_identifier
= DHCP_CLIENT_ID_DUID
;
114 network
->dhcp_route_table
= RT_TABLE_MAIN
;
116 network
->dhcp_server_emit_dns
= true;
117 network
->dhcp_server_emit_ntp
= true;
118 network
->dhcp_server_emit_router
= true;
119 network
->dhcp_server_emit_timezone
= true;
121 network
->use_bpdu
= true;
122 network
->allow_port_to_be_root
= true;
123 network
->unicast_flood
= true;
125 network
->lldp_mode
= LLDP_MODE_ROUTERS_ONLY
;
127 network
->llmnr
= RESOLVE_SUPPORT_YES
;
128 network
->mdns
= RESOLVE_SUPPORT_NO
;
129 network
->dnssec_mode
= _DNSSEC_MODE_INVALID
;
131 network
->link_local
= ADDRESS_FAMILY_IPV6
;
133 network
->ipv6_privacy_extensions
= IPV6_PRIVACY_EXTENSIONS_NO
;
134 network
->ipv6_accept_ra
= -1;
135 network
->ipv6_dad_transmits
= -1;
136 network
->ipv6_hop_limit
= -1;
137 network
->duid
.type
= _DUID_TYPE_INVALID
;
138 network
->proxy_arp
= -1;
140 network
->ipv6_accept_ra_use_dns
= true;
141 network
->ipv6_accept_ra_route_table
= RT_TABLE_MAIN
;
143 dropin_dirname
= strjoina(network
->name
, ".network.d");
145 r
= config_parse_many(filename
, network_dirs
, dropin_dirname
,
152 "DHCPv4\0" /* compat */
158 config_item_perf_lookup
, network_network_gperf_lookup
,
163 /* IPMasquerade=yes implies IPForward=yes */
164 if (network
->ip_masquerade
)
165 network
->ip_forward
|= ADDRESS_FAMILY_IPV4
;
167 LIST_PREPEND(networks
, manager
->networks
, network
);
169 r
= hashmap_ensure_allocated(&manager
->networks_by_name
, &string_hash_ops
);
173 r
= hashmap_put(manager
->networks_by_name
, network
->name
, network
);
177 LIST_FOREACH(routes
, route
, network
->static_routes
) {
178 if (!route
->family
) {
179 log_warning("Route section without Gateway field configured in %s. "
180 "Ignoring", filename
);
185 LIST_FOREACH(addresses
, address
, network
->static_addresses
) {
186 if (!address
->family
) {
187 log_warning("Address section without Address field configured in %s. "
188 "Ignoring", filename
);
198 int network_load(Manager
*manager
) {
200 _cleanup_strv_free_
char **files
= NULL
;
206 while ((network
= manager
->networks
))
207 network_free(network
);
209 r
= conf_files_list_strv(&files
, ".network", NULL
, network_dirs
);
211 return log_error_errno(r
, "Failed to enumerate network files: %m");
213 STRV_FOREACH_BACKWARDS(f
, files
) {
214 r
= network_load_one(manager
, *f
);
222 void network_free(Network
*network
) {
232 free(network
->filename
);
234 free(network
->match_mac
);
235 strv_free(network
->match_path
);
236 strv_free(network
->match_driver
);
237 strv_free(network
->match_type
);
238 strv_free(network
->match_name
);
240 free(network
->description
);
241 free(network
->dhcp_vendor_class_identifier
);
242 free(network
->dhcp_hostname
);
246 strv_free(network
->ntp
);
247 strv_free(network
->dns
);
248 strv_free(network
->search_domains
);
249 strv_free(network
->route_domains
);
250 strv_free(network
->bind_carrier
);
252 netdev_unref(network
->bridge
);
253 netdev_unref(network
->bond
);
254 netdev_unref(network
->vrf
);
256 HASHMAP_FOREACH(netdev
, network
->stacked_netdevs
, i
) {
257 hashmap_remove(network
->stacked_netdevs
, netdev
->ifname
);
258 netdev_unref(netdev
);
260 hashmap_free(network
->stacked_netdevs
);
262 while ((route
= network
->static_routes
))
265 while ((address
= network
->static_addresses
))
266 address_free(address
);
268 while ((fdb_entry
= network
->static_fdb_entries
))
269 fdb_entry_free(fdb_entry
);
271 hashmap_free(network
->addresses_by_section
);
272 hashmap_free(network
->routes_by_section
);
273 hashmap_free(network
->fdb_entries_by_section
);
275 if (network
->manager
) {
276 if (network
->manager
->networks
)
277 LIST_REMOVE(networks
, network
->manager
->networks
, network
);
279 if (network
->manager
->networks_by_name
)
280 hashmap_remove(network
->manager
->networks_by_name
, network
->name
);
285 condition_free_list(network
->match_host
);
286 condition_free_list(network
->match_virt
);
287 condition_free_list(network
->match_kernel
);
288 condition_free_list(network
->match_arch
);
290 free(network
->dhcp_server_timezone
);
291 free(network
->dhcp_server_dns
);
292 free(network
->dhcp_server_ntp
);
294 set_free_free(network
->dnssec_negative_trust_anchors
);
299 int network_get_by_name(Manager
*manager
, const char *name
, Network
**ret
) {
306 network
= hashmap_get(manager
->networks_by_name
, name
);
315 int network_get(Manager
*manager
, struct udev_device
*device
,
316 const char *ifname
, const struct ether_addr
*address
,
319 struct udev_device
*parent
;
320 const char *path
= NULL
, *parent_driver
= NULL
, *driver
= NULL
, *devtype
= NULL
;
326 path
= udev_device_get_property_value(device
, "ID_PATH");
328 parent
= udev_device_get_parent(device
);
330 parent_driver
= udev_device_get_driver(parent
);
332 driver
= udev_device_get_property_value(device
, "ID_NET_DRIVER");
334 devtype
= udev_device_get_devtype(device
);
337 LIST_FOREACH(networks
, network
, manager
->networks
) {
338 if (net_match_config(network
->match_mac
, network
->match_path
,
339 network
->match_driver
, network
->match_type
,
340 network
->match_name
, network
->match_host
,
341 network
->match_virt
, network
->match_kernel
,
343 address
, path
, parent_driver
, driver
,
345 if (network
->match_name
&& device
) {
347 uint8_t name_assign_type
= NET_NAME_UNKNOWN
;
349 attr
= udev_device_get_sysattr_value(device
, "name_assign_type");
351 (void) safe_atou8(attr
, &name_assign_type
);
353 if (name_assign_type
== NET_NAME_ENUM
)
354 log_warning("%s: found matching network '%s', based on potentially unpredictable ifname",
355 ifname
, network
->filename
);
357 log_debug("%s: found matching network '%s'", ifname
, network
->filename
);
359 log_debug("%s: found matching network '%s'", ifname
, network
->filename
);
371 int network_apply(Manager
*manager
, Network
*network
, Link
*link
) {
378 link
->network
= network
;
380 if (network
->ipv4ll_route
) {
383 r
= route_new_static(network
, 0, &route
);
387 r
= inet_pton(AF_INET
, "169.254.0.0", &route
->dst
.in
);
393 route
->family
= AF_INET
;
394 route
->dst_prefixlen
= 16;
395 route
->scope
= RT_SCOPE_LINK
;
396 route
->priority
= IPV4LL_ROUTE_METRIC
;
397 route
->protocol
= RTPROT_STATIC
;
400 if (!strv_isempty(network
->dns
) ||
401 !strv_isempty(network
->ntp
) ||
402 !strv_isempty(network
->search_domains
) ||
403 !strv_isempty(network
->route_domains
))
409 bool network_has_static_ipv6_addresses(Network
*network
) {
414 LIST_FOREACH(addresses
, address
, network
->static_addresses
) {
415 if (address
->family
== AF_INET6
)
422 int config_parse_netdev(const char *unit
,
423 const char *filename
,
426 unsigned section_line
,
432 Network
*network
= userdata
;
433 _cleanup_free_
char *kind_string
= NULL
;
444 kind_string
= strdup(lvalue
);
448 /* the keys are CamelCase versions of the kind */
449 for (p
= kind_string
; *p
; p
++)
452 kind
= netdev_kind_from_string(kind_string
);
453 if (kind
== _NETDEV_KIND_INVALID
) {
454 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Invalid NetDev kind: %s", lvalue
);
458 r
= netdev_get(network
->manager
, rvalue
, &netdev
);
460 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "%s could not be found, ignoring assignment: %s", lvalue
, rvalue
);
464 if (netdev
->kind
!= kind
) {
465 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "NetDev is not a %s, ignoring assignment: %s", lvalue
, rvalue
);
470 case NETDEV_KIND_BRIDGE
:
471 network
->bridge
= netdev
;
474 case NETDEV_KIND_BOND
:
475 network
->bond
= netdev
;
478 case NETDEV_KIND_VRF
:
479 network
->vrf
= netdev
;
482 case NETDEV_KIND_VLAN
:
483 case NETDEV_KIND_MACVLAN
:
484 case NETDEV_KIND_MACVTAP
:
485 case NETDEV_KIND_IPVLAN
:
486 case NETDEV_KIND_VXLAN
:
487 case NETDEV_KIND_VCAN
:
488 r
= hashmap_put(network
->stacked_netdevs
, netdev
->ifname
, netdev
);
490 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Can not add NetDev '%s' to network: %m", rvalue
);
496 assert_not_reached("Can not parse NetDev");
504 int config_parse_domains(
506 const char *filename
,
509 unsigned section_line
,
524 if (isempty(rvalue
)) {
525 n
->search_domains
= strv_free(n
->search_domains
);
526 n
->route_domains
= strv_free(n
->route_domains
);
532 _cleanup_free_
char *w
= NULL
, *normalized
= NULL
;
536 r
= extract_first_word(&p
, &w
, NULL
, 0);
538 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Failed to extract search or route domain, ignoring: %s", rvalue
);
544 is_route
= w
[0] == '~';
545 domain
= is_route
? w
+ 1 : w
;
547 if (dns_name_is_root(domain
) || streq(domain
, "*")) {
548 /* If the root domain appears as is, or the special token "*" is found, we'll consider this as
549 * routing domain, unconditionally. */
551 domain
= "."; /* make sure we don't allow empty strings, thus write the root domain as "." */
554 r
= dns_name_normalize(domain
, &normalized
);
556 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "'%s' is not a valid domain name, ignoring.", domain
);
562 if (is_localhost(domain
)) {
563 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "'localhost' domain names may not be configure as search or route domains, ignoring assignment: %s", domain
);
569 r
= strv_extend(&n
->route_domains
, domain
);
574 r
= strv_extend(&n
->search_domains
, domain
);
580 strv_uniq(n
->route_domains
);
581 strv_uniq(n
->search_domains
);
586 int config_parse_tunnel(const char *unit
,
587 const char *filename
,
590 unsigned section_line
,
596 Network
*network
= userdata
;
605 r
= netdev_get(network
->manager
, rvalue
, &netdev
);
607 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Tunnel is invalid, ignoring assignment: %s", rvalue
);
611 if (netdev
->kind
!= NETDEV_KIND_IPIP
&&
612 netdev
->kind
!= NETDEV_KIND_SIT
&&
613 netdev
->kind
!= NETDEV_KIND_GRE
&&
614 netdev
->kind
!= NETDEV_KIND_GRETAP
&&
615 netdev
->kind
!= NETDEV_KIND_IP6GRE
&&
616 netdev
->kind
!= NETDEV_KIND_IP6GRETAP
&&
617 netdev
->kind
!= NETDEV_KIND_VTI
&&
618 netdev
->kind
!= NETDEV_KIND_VTI6
&&
619 netdev
->kind
!= NETDEV_KIND_IP6TNL
621 log_syntax(unit
, LOG_ERR
, filename
, line
, 0,
622 "NetDev is not a tunnel, ignoring assignment: %s", rvalue
);
626 r
= hashmap_put(network
->stacked_netdevs
, netdev
->ifname
, netdev
);
628 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Cannot add VLAN '%s' to network, ignoring: %m", rvalue
);
637 int config_parse_ipv4ll(
639 const char *filename
,
642 unsigned section_line
,
649 AddressFamilyBoolean
*link_local
= data
;
656 /* Note that this is mostly like
657 * config_parse_address_family_boolean(), except that it
658 * applies only to IPv4 */
660 SET_FLAG(*link_local
, ADDRESS_FAMILY_IPV4
, parse_boolean(rvalue
));
665 int config_parse_dhcp(
667 const char *filename
,
670 unsigned section_line
,
677 AddressFamilyBoolean
*dhcp
= data
, s
;
684 /* Note that this is mostly like
685 * config_parse_address_family_boolean(), except that it
686 * understands some old names for the enum values */
688 s
= address_family_boolean_from_string(rvalue
);
691 /* Previously, we had a slightly different enum here,
692 * support its values for compatbility. */
694 if (streq(rvalue
, "none"))
695 s
= ADDRESS_FAMILY_NO
;
696 else if (streq(rvalue
, "v4"))
697 s
= ADDRESS_FAMILY_IPV4
;
698 else if (streq(rvalue
, "v6"))
699 s
= ADDRESS_FAMILY_IPV6
;
700 else if (streq(rvalue
, "both"))
701 s
= ADDRESS_FAMILY_YES
;
703 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Failed to parse DHCP option, ignoring: %s", rvalue
);
712 static const char* const dhcp_client_identifier_table
[_DHCP_CLIENT_ID_MAX
] = {
713 [DHCP_CLIENT_ID_MAC
] = "mac",
714 [DHCP_CLIENT_ID_DUID
] = "duid"
717 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_client_identifier
, DCHPClientIdentifier
);
718 DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_client_identifier
, dhcp_client_identifier
, DCHPClientIdentifier
, "Failed to parse client identifier type");
720 int config_parse_ipv6token(
722 const char *filename
,
725 unsigned section_line
,
732 union in_addr_union buffer
;
733 struct in6_addr
*token
= data
;
741 r
= in_addr_from_string(AF_INET6
, rvalue
, &buffer
);
743 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Failed to parse IPv6 token, ignoring: %s", rvalue
);
747 r
= in_addr_is_null(AF_INET6
, &buffer
);
749 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "IPv6 token can not be the ANY address, ignoring: %s", rvalue
);
753 if ((buffer
.in6
.s6_addr32
[0] | buffer
.in6
.s6_addr32
[1]) != 0) {
754 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "IPv6 token can not be longer than 64 bits, ignoring: %s", rvalue
);
763 static const char* const ipv6_privacy_extensions_table
[_IPV6_PRIVACY_EXTENSIONS_MAX
] = {
764 [IPV6_PRIVACY_EXTENSIONS_NO
] = "no",
765 [IPV6_PRIVACY_EXTENSIONS_PREFER_PUBLIC
] = "prefer-public",
766 [IPV6_PRIVACY_EXTENSIONS_YES
] = "yes",
769 DEFINE_STRING_TABLE_LOOKUP(ipv6_privacy_extensions
, IPv6PrivacyExtensions
);
771 int config_parse_ipv6_privacy_extensions(
773 const char *filename
,
776 unsigned section_line
,
783 IPv6PrivacyExtensions
*ipv6_privacy_extensions
= data
;
789 assert(ipv6_privacy_extensions
);
791 /* Our enum shall be a superset of booleans, hence first try
792 * to parse as boolean, and then as enum */
794 k
= parse_boolean(rvalue
);
796 *ipv6_privacy_extensions
= IPV6_PRIVACY_EXTENSIONS_YES
;
798 *ipv6_privacy_extensions
= IPV6_PRIVACY_EXTENSIONS_NO
;
800 IPv6PrivacyExtensions s
;
802 s
= ipv6_privacy_extensions_from_string(rvalue
);
805 if (streq(rvalue
, "kernel"))
806 s
= _IPV6_PRIVACY_EXTENSIONS_INVALID
;
808 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Failed to parse IPv6 privacy extensions option, ignoring: %s", rvalue
);
813 *ipv6_privacy_extensions
= s
;
819 int config_parse_hostname(
821 const char *filename
,
824 unsigned section_line
,
831 char **hostname
= data
, *hn
= NULL
;
838 r
= config_parse_string(unit
, filename
, line
, section
, section_line
, lvalue
, ltype
, rvalue
, &hn
, userdata
);
842 if (!hostname_is_valid(hn
, false)) {
843 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Hostname is not valid, ignoring assignment: %s", rvalue
);
849 *hostname
= hostname_cleanup(hn
);
853 int config_parse_timezone(
855 const char *filename
,
858 unsigned section_line
,
865 char **datap
= data
, *tz
= NULL
;
872 r
= config_parse_string(unit
, filename
, line
, section
, section_line
, lvalue
, ltype
, rvalue
, &tz
, userdata
);
876 if (!timezone_is_valid(tz
)) {
877 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Timezone is not valid, ignoring assignment: %s", rvalue
);
888 int config_parse_dhcp_server_dns(
890 const char *filename
,
893 unsigned section_line
,
901 const char *p
= rvalue
;
909 _cleanup_free_
char *w
= NULL
;
910 struct in_addr a
, *m
;
912 r
= extract_first_word(&p
, &w
, NULL
, 0);
914 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Failed to extract word, ignoring: %s", rvalue
);
921 if (inet_pton(AF_INET
, w
, &a
) <= 0) {
922 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Failed to parse DNS server address, ignoring: %s", w
);
926 m
= realloc(n
->dhcp_server_dns
, (n
->n_dhcp_server_dns
+ 1) * sizeof(struct in_addr
));
930 m
[n
->n_dhcp_server_dns
++] = a
;
931 n
->dhcp_server_dns
= m
;
935 int config_parse_dhcp_server_ntp(
937 const char *filename
,
940 unsigned section_line
,
948 const char *p
= rvalue
;
956 _cleanup_free_
char *w
= NULL
;
957 struct in_addr a
, *m
;
959 r
= extract_first_word(&p
, &w
, NULL
, 0);
961 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Failed to extract word, ignoring: %s", rvalue
);
968 if (inet_pton(AF_INET
, w
, &a
) <= 0) {
969 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Failed to parse NTP server address, ignoring: %s", w
);
973 m
= realloc(n
->dhcp_server_ntp
, (n
->n_dhcp_server_ntp
+ 1) * sizeof(struct in_addr
));
977 m
[n
->n_dhcp_server_ntp
++] = a
;
978 n
->dhcp_server_ntp
= m
;
982 int config_parse_dns(
984 const char *filename
,
987 unsigned section_line
,
994 Network
*n
= userdata
;
1002 _cleanup_free_
char *w
= NULL
;
1003 union in_addr_union a
;
1006 r
= extract_first_word(&rvalue
, &w
, NULL
, EXTRACT_QUOTES
|EXTRACT_RETAIN_ESCAPE
);
1012 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Invalid syntax, ignoring: %s", rvalue
);
1016 r
= in_addr_from_string_auto(w
, &family
, &a
);
1018 log_syntax(unit
, LOG_ERR
, filename
, line
, 0, "Failed to parse dns server address, ignoring: %s", w
);
1022 r
= strv_consume(&n
->dns
, w
);
1032 int config_parse_dnssec_negative_trust_anchors(
1034 const char *filename
,
1036 const char *section
,
1037 unsigned section_line
,
1044 const char *p
= rvalue
;
1052 if (isempty(rvalue
)) {
1053 n
->dnssec_negative_trust_anchors
= set_free_free(n
->dnssec_negative_trust_anchors
);
1058 _cleanup_free_
char *w
= NULL
;
1060 r
= extract_first_word(&p
, &w
, NULL
, 0);
1062 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "Failed to extract negative trust anchor domain, ignoring: %s", rvalue
);
1068 r
= dns_name_is_valid(w
);
1070 log_syntax(unit
, LOG_ERR
, filename
, line
, r
, "%s is not a valid domain name, ignoring.", w
);
1074 r
= set_ensure_allocated(&n
->dnssec_negative_trust_anchors
, &dns_name_hash_ops
);
1078 r
= set_put(n
->dnssec_negative_trust_anchors
, w
);
1088 int config_parse_dhcp_route_table(const char *unit
,
1089 const char *filename
,
1091 const char *section
,
1092 unsigned section_line
,
1106 r
= safe_atou32(rvalue
, &rt
);
1108 log_syntax(unit
, LOG_ERR
, filename
, line
, r
,
1109 "Unable to read RouteTable, ignoring assignment: %s", rvalue
);
1113 *((uint32_t *)data
) = rt
;
1118 DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_use_domains
, dhcp_use_domains
, DHCPUseDomains
, "Failed to parse DHCP use domains setting");
1120 static const char* const dhcp_use_domains_table
[_DHCP_USE_DOMAINS_MAX
] = {
1121 [DHCP_USE_DOMAINS_NO
] = "no",
1122 [DHCP_USE_DOMAINS_ROUTE
] = "route",
1123 [DHCP_USE_DOMAINS_YES
] = "yes",
1126 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(dhcp_use_domains
, DHCPUseDomains
, DHCP_USE_DOMAINS_YES
);
1128 DEFINE_CONFIG_PARSE_ENUM(config_parse_lldp_mode
, lldp_mode
, LLDPMode
, "Failed to parse LLDP= setting.");
1130 static const char* const lldp_mode_table
[_LLDP_MODE_MAX
] = {
1131 [LLDP_MODE_NO
] = "no",
1132 [LLDP_MODE_YES
] = "yes",
1133 [LLDP_MODE_ROUTERS_ONLY
] = "routers-only",
1136 DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN(lldp_mode
, LLDPMode
, LLDP_MODE_YES
);