/* SPDX-License-Identifier: LGPL-2.1+ */
-/***
- This file is part of systemd.
-
- Copyright 2013 Tom Gundersen <teg@jklm.no>
-***/
#include <ctype.h>
#include <net/if.h>
if (r != 0)
return r;
- return y->line - x->line;
+ if (x->line < y->line)
+ return -1;
+ if (x->line > y->line)
+ return 1;
+
+ return 0;
}
const struct hash_ops network_config_hash_ops = {
network->llmnr = RESOLVE_SUPPORT_YES;
network->mdns = RESOLVE_SUPPORT_NO;
network->dnssec_mode = _DNSSEC_MODE_INVALID;
+ network->dns_over_tls_mode = _DNS_OVER_TLS_MODE_INVALID;
network->link_local = ADDRESS_FAMILY_IPV6;
"BridgeFDB\0"
"BridgeVLAN\0"
"IPv6PrefixDelegation\0"
- "IPv6Prefix\0",
+ "IPv6Prefix\0"
+ "CAN\0",
config_item_perf_lookup, network_network_gperf_lookup,
CONFIG_PARSE_WARN, network);
if (r < 0)
void *data,
void *userdata) {
- char **hostname = data, *hn = NULL;
+ _cleanup_free_ char *hn = NULL;
+ char **hostname = data;
int r;
assert(filename);
if (!hostname_is_valid(hn, false)) {
log_syntax(unit, LOG_ERR, filename, line, 0, "Hostname is not valid, ignoring assignment: %s", rvalue);
- free(hn);
return 0;
}
- free(*hostname);
- *hostname = hostname_cleanup(hn);
- return 0;
+ r = dns_name_is_valid(hn);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to check validity of hostname '%s', ignoring assignment: %m", rvalue);
+ return 0;
+ }
+ if (r == 0) {
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Hostname is not a valid DNS domain name, ignoring assignment: %s", rvalue);
+ return 0;
+ }
+
+ return free_and_replace(*hostname, hn);
}
int config_parse_timezone(