mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
network: add several assertions in conf parsers
This commit is contained in:
parent
f0c09831bd
commit
5aafd5b190
@ -110,7 +110,7 @@ Network.LLMNR, config_parse_resolve_support,
|
||||
Network.MulticastDNS, config_parse_resolve_support, 0, offsetof(Network, mdns)
|
||||
Network.DNSOverTLS, config_parse_dns_over_tls_mode, 0, offsetof(Network, dns_over_tls_mode)
|
||||
Network.DNSSEC, config_parse_dnssec_mode, 0, offsetof(Network, dnssec_mode)
|
||||
Network.DNSSECNegativeTrustAnchors, config_parse_dnssec_negative_trust_anchors, 0, 0
|
||||
Network.DNSSECNegativeTrustAnchors, config_parse_dnssec_negative_trust_anchors, 0, offsetof(Network, dnssec_negative_trust_anchors)
|
||||
Network.NTP, config_parse_ntp, 0, offsetof(Network, ntp)
|
||||
Network.IPForward, config_parse_address_family_with_kernel, 0, offsetof(Network, ip_forward)
|
||||
Network.IPMasquerade, config_parse_ip_masquerade, 0, offsetof(Network, ip_masquerade)
|
||||
|
@ -753,12 +753,13 @@ int config_parse_domains(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
Network *n = data;
|
||||
Network *n = userdata;
|
||||
int r;
|
||||
|
||||
assert(n);
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(n);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
n->search_domains = ordered_set_free(n->search_domains);
|
||||
@ -837,6 +838,7 @@ int config_parse_hostname(
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(hostname);
|
||||
|
||||
r = config_parse_string(unit, filename, line, section, section_line, lvalue, ltype, rvalue, &hn, userdata);
|
||||
if (r < 0)
|
||||
@ -882,6 +884,7 @@ int config_parse_timezone(
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(datap);
|
||||
|
||||
r = config_parse_string(unit, filename, line, section, section_line, lvalue, ltype, rvalue, &tz, userdata);
|
||||
if (r < 0)
|
||||
@ -914,6 +917,7 @@ int config_parse_dns(
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(n);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
for (unsigned i = 0; i < n->n_dns; i++)
|
||||
@ -970,15 +974,16 @@ int config_parse_dnssec_negative_trust_anchors(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
Network *n = data;
|
||||
Set **nta = data;
|
||||
int r;
|
||||
|
||||
assert(n);
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(nta);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
n->dnssec_negative_trust_anchors = set_free_free(n->dnssec_negative_trust_anchors);
|
||||
*nta = set_free_free(*nta);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1003,7 +1008,7 @@ int config_parse_dnssec_negative_trust_anchors(
|
||||
continue;
|
||||
}
|
||||
|
||||
r = set_ensure_consume(&n->dnssec_negative_trust_anchors, &dns_name_hash_ops, TAKE_PTR(w));
|
||||
r = set_ensure_consume(nta, &dns_name_hash_ops, TAKE_PTR(w));
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
}
|
||||
@ -1024,9 +1029,10 @@ int config_parse_ntp(
|
||||
char ***l = data;
|
||||
int r;
|
||||
|
||||
assert(l);
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(l);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*l = strv_free(*l);
|
||||
@ -1079,11 +1085,16 @@ int config_parse_required_for_online(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
Network *network = data;
|
||||
Network *network = userdata;
|
||||
LinkOperationalStateRange range;
|
||||
bool required = true;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(network);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
network->required_for_online = true;
|
||||
network->required_operstate_for_online = LINK_OPERSTATE_RANGE_DEFAULT;
|
||||
|
Loading…
Reference in New Issue
Block a user