summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-07-28 15:00:59 +0200
committerDaniel Mack <daniel@zonque.org>2015-08-25 14:26:01 +0200
commita7e5da6e33de9ad9b5bc594fdc74e3e4098a5751 (patch)
tree207471516b4d097da6a84784a4512f1701b84c6f
parent9c56a6f3e2b1fc193cf49f622b57f7ee17766cac (diff)
sd-network: make LLMNR specific config parser generic
Rename the enum, the lookup functions and the parser for LLMNRSupport so the type can be reused for mDNS.
-rw-r--r--src/network/networkd-link.c2
-rw-r--r--src/network/networkd-network-gperf.gperf2
-rw-r--r--src/network/networkd-network.c30
-rw-r--r--src/network/networkd.h28
4 files changed, 31 insertions, 31 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 91b9cdf30d..cc9dc393c6 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -2378,7 +2378,7 @@ int link_save(Link *link) {
yes_no(link->network->wildcard_domain));
fprintf(f, "LLMNR=%s\n",
- llmnr_support_to_string(link->network->llmnr));
+ resolve_support_to_string(link->network->llmnr));
}
if (!hashmap_isempty(link->bound_to_links)) {
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 8735b39581..7ac7ef1ea3 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -45,7 +45,7 @@ Network.Address, config_parse_address, 0
Network.Gateway, config_parse_gateway, 0, 0
Network.Domains, config_parse_domains, 0, offsetof(Network, domains)
Network.DNS, config_parse_strv, 0, offsetof(Network, dns)
-Network.LLMNR, config_parse_llmnr, 0, offsetof(Network, llmnr)
+Network.LLMNR, config_parse_resolve, 0, offsetof(Network, llmnr)
Network.NTP, config_parse_strv, 0, offsetof(Network, ntp)
Network.IPForward, config_parse_address_family_boolean_with_kernel,0, offsetof(Network, ip_forward)
Network.IPMasquerade, config_parse_bool, 0, offsetof(Network, ip_masquerade)
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 3f7e77da3e..6587ea994c 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -111,7 +111,7 @@ static int network_load_one(Manager *manager, const char *filename) {
network->allow_port_to_be_root = true;
network->unicast_flood = true;
- network->llmnr = LLMNR_SUPPORT_YES;
+ network->llmnr = RESOLVE_SUPPORT_YES;
network->link_local = ADDRESS_FAMILY_IPV6;
@@ -632,15 +632,15 @@ static const char* const dhcp_client_identifier_table[_DHCP_CLIENT_ID_MAX] = {
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(dhcp_client_identifier, DCHPClientIdentifier);
DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_client_identifier, dhcp_client_identifier, DCHPClientIdentifier, "Failed to parse client identifier type");
-static const char* const llmnr_support_table[_LLMNR_SUPPORT_MAX] = {
- [LLMNR_SUPPORT_NO] = "no",
- [LLMNR_SUPPORT_YES] = "yes",
- [LLMNR_SUPPORT_RESOLVE] = "resolve",
+static const char* const resolve_support_table[_RESOLVE_SUPPORT_MAX] = {
+ [RESOLVE_SUPPORT_NO] = "no",
+ [RESOLVE_SUPPORT_YES] = "yes",
+ [RESOLVE_SUPPORT_RESOLVE] = "resolve",
};
-DEFINE_STRING_TABLE_LOOKUP(llmnr_support, LLMNRSupport);
+DEFINE_STRING_TABLE_LOOKUP(resolve_support, ResolveSupport);
-int config_parse_llmnr(
+int config_parse_resolve(
const char* unit,
const char *filename,
unsigned line,
@@ -652,32 +652,32 @@ int config_parse_llmnr(
void *data,
void *userdata) {
- LLMNRSupport *llmnr = data;
+ ResolveSupport *resolve = data;
int k;
assert(filename);
assert(lvalue);
assert(rvalue);
- assert(llmnr);
+ assert(resolve);
/* Our enum shall be a superset of booleans, hence first try
* to parse as boolean, and then as enum */
k = parse_boolean(rvalue);
if (k > 0)
- *llmnr = LLMNR_SUPPORT_YES;
+ *resolve = RESOLVE_SUPPORT_YES;
else if (k == 0)
- *llmnr = LLMNR_SUPPORT_NO;
+ *resolve = RESOLVE_SUPPORT_NO;
else {
- LLMNRSupport s;
+ ResolveSupport s;
- s = llmnr_support_from_string(rvalue);
+ s = resolve_support_from_string(rvalue);
if (s < 0){
- log_syntax(unit, LOG_ERR, filename, line, -s, "Failed to parse LLMNR option, ignoring: %s", rvalue);
+ log_syntax(unit, LOG_ERR, filename, line, -s, "Failed to parse %s option, ignoring: %s", lvalue, rvalue);
return 0;
}
- *llmnr = s;
+ *resolve = s;
}
return 0;
diff --git a/src/network/networkd.h b/src/network/networkd.h
index a285a4b08f..5340922bf1 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -64,13 +64,13 @@ typedef enum AddressFamilyBoolean {
_ADDRESS_FAMILY_BOOLEAN_INVALID = -1,
} AddressFamilyBoolean;
-typedef enum LLMNRSupport {
- LLMNR_SUPPORT_NO,
- LLMNR_SUPPORT_YES,
- LLMNR_SUPPORT_RESOLVE,
- _LLMNR_SUPPORT_MAX,
- _LLMNR_SUPPORT_INVALID = -1,
-} LLMNRSupport;
+typedef enum ResolveSupport {
+ RESOLVE_SUPPORT_NO,
+ RESOLVE_SUPPORT_YES,
+ RESOLVE_SUPPORT_RESOLVE,
+ _RESOLVE_SUPPORT_MAX,
+ _RESOLVE_SUPPORT_INVALID = -1,
+} ResolveSupport;
typedef enum LinkOperationalState {
LINK_OPERSTATE_OFF,
@@ -178,7 +178,7 @@ struct Network {
bool wildcard_domain;
char **domains, **dns, **ntp, **bind_carrier;
- LLMNRSupport llmnr;
+ ResolveSupport llmnr;
LIST_FIELDS(Network, networks);
};
@@ -421,14 +421,14 @@ int config_parse_ipv6token(const char *unit, const char *filename, unsigned line
const char *section, unsigned section_line, const char *lvalue,
int ltype, const char *rvalue, void *data, void *userdata);
-/* LLMNR support */
+/* Resolve protocols support */
-const char* llmnr_support_to_string(LLMNRSupport i) _const_;
-LLMNRSupport llmnr_support_from_string(const char *s) _pure_;
+const char* resolve_support_to_string(ResolveSupport i) _const_;
+ResolveSupport resolve_support_from_string(const char *s) _pure_;
-int config_parse_llmnr(const char *unit, const char *filename, unsigned line,
- const char *section, unsigned section_line, const char *lvalue,
- int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_resolve(const char *unit, const char *filename, unsigned line,
+ const char *section, unsigned section_line, const char *lvalue,
+ int ltype, const char *rvalue, void *data, void *userdata);
/* Address Pool */