diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-16 07:48:08 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-07-16 17:40:09 +0200 |
commit | d96edb2c6e7014e93e6713c79a698c91463c8929 (patch) | |
tree | b54277e70a405ece6700db3c3199d6db04cca0aa | |
parent | Merge pull request #16485 from bluca/nspawn_os_release_mounts (diff) | |
download | systemd-d96edb2c6e7014e93e6713c79a698c91463c8929.tar.xz systemd-d96edb2c6e7014e93e6713c79a698c91463c8929.zip |
network: downgrade log level in conf parsers
55 files changed, 864 insertions, 754 deletions
diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c index 4d61c217b1..b5cf162704 100644 --- a/src/network/netdev/bond.c +++ b/src/network/netdev/bond.c @@ -320,13 +320,15 @@ int config_parse_arp_ip_target_address( return 0; } - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *n = NULL; union in_addr_union ip; - r = extract_first_word(&rvalue, &n, NULL, 0); + r = extract_first_word(&p, &n, NULL, 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Bond ARP IP target address, ignoring assignment: %s", rvalue); return 0; @@ -336,7 +338,7 @@ int config_parse_arp_ip_target_address( r = in_addr_from_string(AF_INET, n, &ip); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Bond ARP IP target address is invalid, ignoring assignment: %s", n); continue; } @@ -357,7 +359,7 @@ int config_parse_arp_ip_target_address( log_syntax(unit, LOG_WARNING, filename, line, r, "Bond ARP IP target address is duplicated, ignoring assignment: %s", n); if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store bond ARP IP target address '%s', ignoring assignment: %m", n); } } @@ -384,13 +386,13 @@ int config_parse_ad_actor_sys_prio( r = safe_atou16(rvalue, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse actor system priority '%s', ignoring: %m", rvalue); return 0; } if (v == 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse actor system priority '%s'. Range is [1,65535], ignoring.", rvalue); return 0; @@ -423,13 +425,13 @@ int config_parse_ad_user_port_key( r = safe_atou16(rvalue, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse user port key '%s', ignoring: %m", rvalue); return 0; } if (v > 1023) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse user port key '%s'. Range is [0…1023], ignoring.", rvalue); return 0; } @@ -461,13 +463,13 @@ int config_parse_ad_actor_system( r = ether_addr_from_string(rvalue, &n); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Not a valid MAC address %s. Ignoring assignment: %m", rvalue); return 0; } if (ether_addr_is_null(&n) || (n.ether_addr_octet[0] & 0x01)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Not a valid MAC address %s, can not be null or multicast. Ignoring assignment.", rvalue); return 0; diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c index ef5a9bb694..70240661e8 100644 --- a/src/network/netdev/bridge.c +++ b/src/network/netdev/bridge.c @@ -326,13 +326,13 @@ int config_parse_bridge_igmp_version( r = safe_atou8(rvalue, &u); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse bridge's multicast IGMP version number '%s', ignoring assignment: %m", rvalue); return 0; } if (!IN_SET(u, 2, 3)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid bridge's multicast IGMP version number '%s', ignoring assignment.", rvalue); return 0; } diff --git a/src/network/netdev/fou-tunnel.c b/src/network/netdev/fou-tunnel.c index bc0dc185d3..832cf57dea 100644 --- a/src/network/netdev/fou-tunnel.c +++ b/src/network/netdev/fou-tunnel.c @@ -167,14 +167,14 @@ int config_parse_ip_protocol( else { r = safe_atou(rvalue, &protocol); if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse IP protocol '%s' for FooOverUDP tunnel, " "ignoring assignment: %m", rvalue); return 0; } if (protocol > UINT8_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "IP protocol '%s' for FooOverUDP tunnel out of range, " "ignoring assignment: %m", rvalue); return 0; @@ -212,7 +212,7 @@ int config_parse_fou_tunnel_address( r = in_addr_from_string_auto(rvalue, f, addr); if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "FooOverUDP tunnel '%s' address is invalid, ignoring assignment: %s", lvalue, rvalue); diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c index b960840a54..b4f865a538 100644 --- a/src/network/netdev/geneve.c +++ b/src/network/netdev/geneve.c @@ -185,12 +185,12 @@ int config_parse_geneve_vni(const char *unit, r = safe_atou32(rvalue, &f); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse Geneve VNI '%s'.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Geneve VNI '%s'.", rvalue); return 0; } if (f > GENEVE_VID_MAX){ - log_syntax(unit, LOG_ERR, filename, line, r, "Geneve VNI out is of range '%s'.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Geneve VNI out is of range '%s'.", rvalue); return 0; } @@ -220,13 +220,13 @@ int config_parse_geneve_address(const char *unit, r = in_addr_from_string_auto(rvalue, &f, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "geneve '%s' address is invalid, ignoring assignment: %s", lvalue, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "geneve '%s' address is invalid, ignoring assignment: %s", lvalue, rvalue); return 0; } r = in_addr_is_multicast(f, &buffer); if (r > 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "geneve invalid multicast '%s' address, ignoring assignment: %s", lvalue, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "geneve invalid multicast '%s' address, ignoring assignment: %s", lvalue, rvalue); return 0; } @@ -257,12 +257,12 @@ int config_parse_geneve_flow_label(const char *unit, r = safe_atou32(rvalue, &f); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse Geneve flow label '%s'.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Geneve flow label '%s'.", rvalue); return 0; } if (f & ~GENEVE_FLOW_LABEL_MAX_MASK) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Geneve flow label '%s' not valid. Flow label range should be [0-1048575].", rvalue); return 0; } @@ -296,13 +296,13 @@ int config_parse_geneve_ttl(const char *unit, else { r = safe_atou(rvalue, &f); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Geneve TTL '%s', ignoring assignment: %m", rvalue); return 0; } if (f > 255) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid Geneve TTL '%s'. TTL must be <= 255. Ignoring assignment.", rvalue); return 0; } diff --git a/src/network/netdev/l2tp-tunnel.c b/src/network/netdev/l2tp-tunnel.c index 91788c3681..0d670cb2a5 100644 --- a/src/network/netdev/l2tp-tunnel.c +++ b/src/network/netdev/l2tp-tunnel.c @@ -459,7 +459,7 @@ int config_parse_l2tp_tunnel_address( else r = in_addr_from_string(t->family, rvalue, addr); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid L2TP Tunnel address specified in %s='%s', ignoring assignment: %m", lvalue, rvalue); return 0; } @@ -489,13 +489,13 @@ int config_parse_l2tp_tunnel_id( r = safe_atou32(rvalue, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse L2TP tunnel id. Ignoring assignment: %s", rvalue); return 0; } if (k == 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid L2TP tunnel id. Ignoring assignment: %s", rvalue); return 0; } @@ -530,17 +530,17 @@ int config_parse_l2tp_session_id( r = l2tp_session_new_static(t, filename, section_line, &session); if (r < 0) - return r; + return log_oom(); r = safe_atou32(rvalue, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse L2TP session id. Ignoring assignment: %s", rvalue); return 0; } if (k == 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid L2TP session id. Ignoring assignment: %s", rvalue); return 0; } @@ -579,11 +579,11 @@ int config_parse_l2tp_session_l2spec( r = l2tp_session_new_static(t, filename, section_line, &session); if (r < 0) - return r; + return log_oom(); spec = l2tp_l2spec_type_from_string(rvalue); if (spec < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse layer2 specific header type. Ignoring assignment: %s", rvalue); return 0; } @@ -618,10 +618,10 @@ int config_parse_l2tp_session_name( r = l2tp_session_new_static(t, filename, section_line, &session); if (r < 0) - return r; + return log_oom(); if (!ifname_valid(rvalue)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse L2TP tunnel session name. Ignoring assignment: %s", rvalue); return 0; } diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c index 8f7559e9ae..57d8f567b9 100644 --- a/src/network/netdev/macsec.c +++ b/src/network/netdev/macsec.c @@ -577,7 +577,7 @@ int config_parse_macsec_port( else if (streq(section, "MACsecReceiveChannel")) { r = macsec_receive_channel_new_static(s, filename, section_line, &c); if (r < 0) - return r; + return log_oom(); dest = &c->sci.port; } else { @@ -585,14 +585,14 @@ int config_parse_macsec_port( r = macsec_receive_association_new_static(s, filename, section_line, &b); if (r < 0) - return r; + return log_oom(); dest = &b->sci.port; } r = parse_ip_port(rvalue, &port); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse port '%s' for secure channel identifier. Ignoring assignment: %m", rvalue); return 0; @@ -634,11 +634,11 @@ int config_parse_macsec_hw_address( else r = macsec_receive_association_new_static(s, filename, section_line, &b); if (r < 0) - return r; + return log_oom(); r = ether_addr_from_string(rvalue, b ? &b->sci.mac : &c->sci.mac); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse MAC address for secure channel identifier. " "Ignoring assignment: %s", rvalue); return 0; @@ -679,18 +679,18 @@ int config_parse_macsec_packet_number( else r = macsec_receive_association_new_static(s, filename, section_line, &b); if (r < 0) - return r; + return log_oom(); dest = a ? &a->sa.packet_number : &b->sa.packet_number; r = safe_atou32(rvalue, &val); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse packet number. Ignoring assignment: %s", rvalue); return 0; } if (streq(section, "MACsecTransmitAssociation") && val == 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid packet number. Ignoring assignment: %s", rvalue); return 0; } @@ -735,19 +735,19 @@ int config_parse_macsec_key( else r = macsec_receive_association_new_static(s, filename, section_line, &b); if (r < 0) - return r; + return log_oom(); dest = a ? &a->sa : &b->sa; r = unhexmem_full(rvalue, strlen(rvalue), true, &p, &l); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse key. Ignoring assignment: %m"); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse key. Ignoring assignment: %m"); return 0; } if (l != 16) { /* See DEFAULT_SAK_LEN in drivers/net/macsec.c */ - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid key length (%zu). Ignoring assignment", l); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid key length (%zu). Ignoring assignment", l); return 0; } @@ -791,7 +791,7 @@ int config_parse_macsec_key_file( else r = macsec_receive_association_new_static(s, filename, section_line, &b); if (r < 0) - return r; + return log_oom(); dest = a ? &a->sa.key_file : &b->sa.key_file; @@ -845,15 +845,15 @@ int config_parse_macsec_key_id( else r = macsec_receive_association_new_static(s, filename, section_line, &b); if (r < 0) - return r; + return log_oom(); r = unhexmem(rvalue, strlen(rvalue), &p, &l); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse KeyId \"%s\": %m", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse KeyId \"%s\": %m", rvalue); return 0; } if (l > MACSEC_KEYID_LEN) - return log_syntax(unit, LOG_ERR, filename, line, 0, + return log_syntax(unit, LOG_WARNING, filename, line, 0, "Specified KeyId is larger then the allowed maximum (%zu > %u), ignoring: %s", l, MACSEC_KEYID_LEN, rvalue); @@ -896,7 +896,7 @@ int config_parse_macsec_sa_activate( else r = macsec_receive_association_new_static(s, filename, section_line, &b); if (r < 0) - return r; + return log_oom(); dest = a ? &a->sa.activate : &b->sa.activate; @@ -905,7 +905,7 @@ int config_parse_macsec_sa_activate( else { r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse activation mode of %s security association. " "Ignoring assignment: %s", streq(section, "MACsecTransmitAssociation") ? "transmit" : "receive", @@ -945,18 +945,20 @@ int config_parse_macsec_use_for_encoding( r = macsec_transmit_association_new_static(s, filename, section_line, &a); if (r < 0) - return r; + return log_oom(); - if (isempty(rvalue)) - r = -1; - else { - r = parse_boolean(rvalue); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to parse %s= setting. Ignoring assignment: %s", - lvalue, rvalue); - return 0; - } + if (isempty(rvalue)) { + a->sa.use_for_encoding = -1; + TAKE_PTR(a); + return 0; + } + + r = parse_boolean(rvalue); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to parse %s= setting. Ignoring assignment: %s", + lvalue, rvalue); + return 0; } a->sa.use_for_encoding = r; diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c index 350485d561..446a580e2c 100644 --- a/src/network/netdev/netdev.c +++ b/src/network/netdev/netdev.c @@ -137,12 +137,12 @@ int config_parse_netdev_kind( k = netdev_kind_from_string(rvalue); if (k < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse netdev kind, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse netdev kind, ignoring assignment: %s", rvalue); return 0; } if (*kind != _NETDEV_KIND_INVALID && *kind != k) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Specified netdev kind is different from the previous value '%s', ignoring assignment: %s", netdev_kind_to_string(*kind), rvalue); return 0; diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c index 72b33ed9e5..852aa423b6 100644 --- a/src/network/netdev/tunnel.c +++ b/src/network/netdev/tunnel.c @@ -541,13 +541,13 @@ int config_parse_tunnel_address(const char *unit, r = in_addr_from_string_auto(rvalue, &f, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Tunnel address \"%s\" invalid, ignoring assignment: %m", rvalue); return 0; } if (t->family != AF_UNSPEC && t->family != f) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Tunnel addresses incompatible, ignoring assignment: %s", rvalue); return 0; } @@ -581,7 +581,7 @@ int config_parse_tunnel_key(const char *unit, if (r < 0) { r = safe_atou32(rvalue, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse tunnel key ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse tunnel key ignoring assignment: %s", rvalue); return 0; } } else @@ -626,7 +626,7 @@ int config_parse_ipv6_flowlabel(const char* unit, return r; if (k > 0xFFFFF) - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse IPv6 flowlabel option, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse IPv6 flowlabel option, ignoring: %s", rvalue); else { *ipv6_flowlabel = htobe32(k) & IP6_FLOWINFO_FLOWLABEL; t->flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL; @@ -659,12 +659,12 @@ int config_parse_encap_limit(const char* unit, else { r = safe_atoi(rvalue, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse Tunnel Encapsulation Limit option, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Tunnel Encapsulation Limit option, ignoring: %s", rvalue); return 0; } if (k > 255 || k < 0) - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid Tunnel Encapsulation value, ignoring: %d", k); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid Tunnel Encapsulation value, ignoring: %d", k); else { t->encap_limit = k; t->flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT; @@ -696,11 +696,11 @@ int config_parse_6rd_prefix(const char* unit, r = in_addr_prefix_from_string(rvalue, AF_INET6, &p, &l); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse 6rd prefix \"%s\", ignoring: %m", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 6rd prefix \"%s\", ignoring: %m", rvalue); return 0; } if (l == 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "6rd prefix length of \"%s\" must be greater than zero, ignoring", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "6rd prefix length of \"%s\" must be greater than zero, ignoring", rvalue); return 0; } diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c index 8dfcdb4215..373ff789aa 100644 --- a/src/network/netdev/vxlan.c +++ b/src/network/netdev/vxlan.c @@ -196,7 +196,7 @@ int config_parse_vxlan_address(const char *unit, r = in_addr_from_string_auto(rvalue, &f, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "vxlan '%s' address is invalid, ignoring assignment: %s", lvalue, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "vxlan '%s' address is invalid, ignoring assignment: %s", lvalue, rvalue); return 0; } @@ -204,14 +204,14 @@ int config_parse_vxlan_address(const char *unit, if (streq(lvalue, "Group")) { if (r <= 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "vxlan %s invalid multicast address, ignoring assignment: %s", lvalue, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "vxlan %s invalid multicast address, ignoring assignment: %s", lvalue, rvalue); return 0; } v->group_family = f; } else { if (r > 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "vxlan %s cannot be a multicast address, ignoring assignment: %s", lvalue, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "vxlan %s cannot be a multicast address, ignoring assignment: %s", lvalue, rvalue); return 0; } @@ -247,7 +247,7 @@ int config_parse_port_range(const char *unit, r = parse_ip_port_range(rvalue, &low, &high); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse VXLAN port range '%s'. Port should be greater than 0 and less than 65535.", rvalue); return 0; } @@ -279,12 +279,12 @@ int config_parse_flow_label(const char *unit, r = safe_atou(rvalue, &f); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse VXLAN flow label '%s'.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse VXLAN flow label '%s'.", rvalue); return 0; } if (f & ~VXLAN_FLOW_LABEL_MAX_MASK) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "VXLAN flow label '%s' not valid. Flow label range should be [0-1048575].", rvalue); return 0; } @@ -318,13 +318,13 @@ int config_parse_vxlan_ttl(const char *unit, else { r = safe_atou(rvalue, &f); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse VXLAN TTL '%s', ignoring assignment: %m", rvalue); return 0; } if (f > 255) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid VXLAN TTL '%s'. TTL must be <= 255. Ignoring assignment.", rvalue); return 0; } diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c index bff778179c..b6af9925b7 100644 --- a/src/network/netdev/wireguard.c +++ b/src/network/netdev/wireguard.c @@ -459,7 +459,7 @@ int config_parse_wireguard_listen_port( r = parse_ip_port(rvalue, s); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid port specification, ignoring assignment: %s", rvalue); return 0; } @@ -494,10 +494,10 @@ static int wireguard_decode_key_and_warn( r = unbase64mem_full(rvalue, strlen(rvalue), true, &key, &len); if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, + return log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to decode wireguard key provided by %s=, ignoring assignment: %m", lvalue); if (len != WG_KEY_LEN) - return log_syntax(unit, LOG_ERR, filename, line, 0, + return log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL), "Wireguard key provided by %s= has invalid length (%zu bytes), ignoring assignment.", lvalue, len); @@ -583,9 +583,10 @@ int config_parse_wireguard_preshared_key( r = wireguard_peer_new_static(w, filename, section_line, &peer); if (r < 0) - return r; + return log_oom(); - return wireguard_decode_key_and_warn(rvalue, peer->preshared_key, unit, filename, line, lvalue); + (void) wireguard_decode_key_and_warn(rvalue, peer->preshared_key, unit, filename, line, lvalue); + return 0; } int config_parse_wireguard_preshared_key_file( @@ -611,7 +612,7 @@ int config_parse_wireguard_preshared_key_file( r = wireguard_peer_new_static(w, filename, section_line, &peer); if (r < 0) - return r; + return log_oom(); if (isempty(rvalue)) { peer->preshared_key_file = mfree(peer->preshared_key_file); @@ -653,11 +654,11 @@ int config_parse_wireguard_public_key( r = wireguard_peer_new_static(w, filename, section_line, &peer); if (r < 0) - return r; + return log_oom(); r = wireguard_decode_key_and_warn(rvalue, peer->public_key, unit, filename, line, lvalue); if (r < 0) - return r; + return 0; TAKE_PTR(peer); return 0; @@ -690,25 +691,25 @@ int config_parse_wireguard_allowed_ips( r = wireguard_peer_new_static(w, filename, section_line, &peer); if (r < 0) - return r; + return log_oom(); - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *word = NULL; - r = extract_first_word(&rvalue, &word, "," WHITESPACE, 0); + r = extract_first_word(&p, &word, "," WHITESPACE, 0); if (r == 0) break; if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to split allowed ips \"%s\" option: %m", rvalue); break; } r = in_addr_prefix_from_string_auto(word, &family, &addr, &prefixlen); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Network address is invalid, ignoring assignment: %s", word); continue; } @@ -758,7 +759,7 @@ int config_parse_wireguard_endpoint( begin = &rvalue[1]; end = strchr(rvalue, ']'); if (!end) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Unable to find matching brace of endpoint, ignoring assignment: %s", rvalue); return 0; @@ -766,7 +767,7 @@ int config_parse_wireguard_endpoint( len = end - begin; ++end; if (*end != ':' || !*(end + 1)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Unable to find port of endpoint, ignoring assignment: %s", rvalue); return 0; @@ -776,7 +777,7 @@ int config_parse_wireguard_endpoint( begin = rvalue; end = strrchr(rvalue, ':'); if (!end || !*(end + 1)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Unable to find port of endpoint, ignoring assignment: %s", rvalue); return 0; @@ -787,7 +788,7 @@ int config_parse_wireguard_endpoint( r = wireguard_peer_new_static(w, filename, section_line, &peer); if (r < 0) - return r; + return log_oom(); r = free_and_strndup(&peer->endpoint_host, begin, len); if (r < 0) @@ -830,14 +831,14 @@ int config_parse_wireguard_keepalive( r = wireguard_peer_new_static(w, filename, section_line, &peer); if (r < 0) - return r; + return log_oom(); if (streq(rvalue, "off")) keepalive = 0; else { r = safe_atou16(rvalue, &keepalive); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse \"%s\" as keepalive interval (range 0–65535), ignoring assignment: %m", rvalue); return 0; diff --git a/src/network/networkd-address-label.c b/src/network/networkd-address-label.c index 32b79dd154..0d53aa9042 100644 --- a/src/network/networkd-address-label.c +++ b/src/network/networkd-address-label.c @@ -173,11 +173,11 @@ int config_parse_address_label_prefix(const char *unit, r = address_label_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = in_addr_prefix_from_string(rvalue, AF_INET6, &n->in_addr, &n->prefixlen); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Address label is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Address label is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -211,16 +211,16 @@ int config_parse_address_label( r = address_label_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = safe_atou32(rvalue, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse address label, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse address label, ignoring: %s", rvalue); return 0; } if (k == 0xffffffffUL) { - log_syntax(unit, LOG_ERR, filename, line, r, "Address label is invalid, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Address label is invalid, ignoring: %s", rvalue); return 0; } diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index aeadb7b01b..6f1ee3b534 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -790,18 +790,23 @@ int config_parse_broadcast( assert(data); r = address_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate new address, ignoring assignment: %m"); + return 0; + } if (n->family == AF_INET6) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Broadcast is not valid for IPv6 addresses, ignoring assignment: %s", rvalue); return 0; } r = in_addr_from_string(AF_INET, rvalue, (union in_addr_union*) &n->broadcast); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Broadcast is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -841,14 +846,18 @@ int config_parse_address(const char *unit, r = address_new_static(network, NULL, 0, &n); } else r = address_new_static(network, filename, section_line, &n); - - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate new address, ignoring assignment: %m"); + return 0; + } /* Address=address/prefixlen */ r = in_addr_prefix_from_string_auto_internal(rvalue, PREFIXLEN_REFUSE, &f, &buffer, &prefixlen); if (r == -ENOANO) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "An address '%s' is specified without prefix length. " "The behavior of parsing addresses without prefix length will be changed in the future release. " "Please specify prefix length explicitly.", rvalue); @@ -856,12 +865,12 @@ int config_parse_address(const char *unit, r = in_addr_prefix_from_string_auto_internal(rvalue, PREFIXLEN_LEGACY, &f, &buffer, &prefixlen); } if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Invalid address '%s', ignoring assignment: %m", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid address '%s', ignoring assignment: %m", rvalue); return 0; } if (n->family != AF_UNSPEC && f != n->family) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Address is incompatible, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Address is incompatible, ignoring assignment: %s", rvalue); return 0; } @@ -871,7 +880,7 @@ int config_parse_address(const char *unit, * let's limit the prefix length to 64 or larger. See RFC4193. */ if ((f == AF_INET && prefixlen < 8) || (f == AF_INET6 && prefixlen < 64)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Null address with invalid prefixlen='%u', ignoring assignment: %s", prefixlen, rvalue); return 0; @@ -917,11 +926,16 @@ int config_parse_label( assert(data); r = address_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate new address, ignoring assignment: %m"); + return 0; + } if (!address_label_valid(rvalue)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Interface label is too long or invalid, ignoring assignment: %s", rvalue); return 0; } @@ -956,8 +970,13 @@ int config_parse_lifetime(const char *unit, assert(data); r = address_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate new address, ignoring assignment: %m"); + return 0; + } /* We accept only "forever", "infinity", empty, or "0". */ if (STR_IN_SET(rvalue, "forever", "infinity", "")) @@ -965,7 +984,7 @@ int config_parse_lifetime(const char *unit, else if (streq(rvalue, "0")) k = 0; else { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid PreferredLifetime= value, ignoring: %s", rvalue); return 0; } @@ -997,12 +1016,17 @@ int config_parse_address_flags(const char *unit, assert(data); r = address_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate new address, ignoring assignment: %m"); + return 0; + } r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring: %s", lvalue, rvalue); return 0; } @@ -1045,8 +1069,13 @@ int config_parse_address_scope(const char *unit, assert(data); r = address_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate new address, ignoring assignment: %m"); + return 0; + } if (streq(rvalue, "host")) n->scope = RT_SCOPE_HOST; @@ -1057,7 +1086,7 @@ int config_parse_address_scope(const char *unit, else { r = safe_atou8(rvalue , &n->scope); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse address scope \"%s\", ignoring assignment: %m", rvalue); return 0; } @@ -1091,8 +1120,13 @@ int config_parse_duplicate_address_detection( assert(data); r = address_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate new address, ignoring assignment: %m"); + return 0; + } r = parse_boolean(rvalue); if (r >= 0) { @@ -1107,7 +1141,7 @@ int config_parse_duplicate_address_detection( a = duplicate_address_detection_address_family_from_string(rvalue); if (a < 0) { - log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EINVAL), + log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL), "Failed to parse %s=, ignoring: %s", lvalue, rvalue); return 0; } diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c index 41f09287f2..3fc252d211 100644 --- a/src/network/networkd-brvlan.c +++ b/src/network/networkd-brvlan.c @@ -241,7 +241,7 @@ int config_parse_brvlan_vlan(const char *unit, const char *filename, r = parse_vid_range(rvalue, &vid, &vid_end); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse VLAN, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse VLAN, ignoring: %s", rvalue); return 0; } @@ -269,7 +269,7 @@ int config_parse_brvlan_untagged(const char *unit, const char *filename, r = parse_vid_range(rvalue, &vid, &vid_end); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Could not parse VLAN: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse VLAN: %s", rvalue); return 0; } diff --git a/src/network/networkd-can.c b/src/network/networkd-can.c index fdd99a3a18..e5504f7738 100644 --- a/src/network/networkd-can.c +++ b/src/network/networkd-can.c @@ -35,14 +35,14 @@ int config_parse_can_bitrate( r = parse_size(rvalue, 1000, &sz); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse can bitrate '%s', ignoring: %m", rvalue); return 0; } /* Linux uses __u32 for bitrates, so the value should not exceed that. */ if (sz <= 0 || sz > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Bit rate out of permitted range 1...4294967295"); return 0; } diff --git a/src/network/networkd-conf.c b/src/network/networkd-conf.c index 30625117e4..233ef9f4f6 100644 --- a/src/network/networkd-conf.c +++ b/src/network/networkd-conf.c @@ -144,26 +144,29 @@ int config_parse_duid_rawdata( assert(ret); /* RawData contains DUID in format "NN:NN:NN..." */ - for (;;) { + for (const char *p = rvalue;;) { int n1, n2, len, r; uint32_t byte; _cleanup_free_ char *cbyte = NULL; - r = extract_first_word(&rvalue, &cbyte, ":", 0); + r = extract_first_word(&p, &cbyte, ":", 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to read DUID, ignoring assignment: %s.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to read DUID, ignoring assignment: %s.", rvalue); return 0; } if (r == 0) break; + if (count >= MAX_DUID_LEN) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Max DUID length exceeded, ignoring assignment: %s.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Max DUID length exceeded, ignoring assignment: %s.", rvalue); return 0; } len = strlen(cbyte); if (!IN_SET(len, 1, 2)) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid length - DUID byte: %s, ignoring assignment: %s.", cbyte, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid length - DUID byte: %s, ignoring assignment: %s.", cbyte, rvalue); return 0; } n1 = unhexchar(cbyte[0]); @@ -173,7 +176,7 @@ int config_parse_duid_rawdata( n2 = 0; if (n1 < 0 || n2 < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid DUID byte: %s. Ignoring assignment: %s.", cbyte, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid DUID byte: %s. Ignoring assignment: %s.", cbyte, rvalue); return 0; } diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 5b1acde297..ecf9bcea85 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -48,7 +48,7 @@ int config_parse_dhcp( else if (streq(rvalue, "both")) s = ADDRESS_FAMILY_YES; else { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse DHCP option, ignoring: %s", rvalue); return 0; } @@ -85,7 +85,7 @@ int config_parse_dhcp_route_metric( r = safe_atou32(rvalue, &metric); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RouteMetric=%s, ignoring assignment: %m", rvalue); return 0; } @@ -128,7 +128,7 @@ int config_parse_dhcp_use_dns( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse UseDNS=%s, ignoring assignment: %m", rvalue); return 0; } @@ -171,7 +171,7 @@ int config_parse_dhcp_use_ntp( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse UseNTP=%s, ignoring assignment: %m", rvalue); return 0; } @@ -215,7 +215,7 @@ int config_parse_section_route_table( r = safe_atou32(rvalue, &rt); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RouteTable=%s, ignoring assignment: %m", rvalue); return 0; } @@ -252,7 +252,7 @@ int config_parse_iaid(const char *unit, r = safe_atou32(rvalue, &iaid); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Unable to read IAID, ignoring assignment: %s", rvalue); return 0; } @@ -287,29 +287,29 @@ int config_parse_dhcp_user_class( return 0; } - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL; - r = extract_first_word(&rvalue, &w, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE); + r = extract_first_word(&p, &w, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to split user classes option, ignoring: %s", rvalue); - break; + return 0; } if (r == 0) - break; + return 0; if (ltype == AF_INET) { if (strlen(w) > UINT8_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "%s length is not in the range 1-255, ignoring.", w); continue; } } else { if (strlen(w) > UINT16_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "%s length is not in the range 1-65535, ignoring.", w); continue; } @@ -321,8 +321,6 @@ int config_parse_dhcp_user_class( w = NULL; } - - return 0; } int config_parse_dhcp_vendor_class( @@ -348,22 +346,22 @@ int config_parse_dhcp_vendor_class( return 0; } - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL; - r = extract_first_word(&rvalue, &w, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE); + r = extract_first_word(&p, &w, NULL, EXTRACT_CUNESCAPE|EXTRACT_UNQUOTE); if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to split vendor classes option, ignoring: %s", rvalue); - break; + return 0; } if (r == 0) - break; + return 0; if (strlen(w) > UINT8_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "%s length is not in the range 1-255, ignoring.", w); continue; } @@ -374,8 +372,6 @@ int config_parse_dhcp_vendor_class( w = NULL; } - - return 0; } int config_parse_dhcp_send_option( @@ -420,14 +416,14 @@ int config_parse_dhcp_send_option( if (r == -ENOMEM) return log_oom(); if (r <= 0 || isempty(p)) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid DHCP option, ignoring assignment: %s", rvalue); return 0; } r = safe_atou32(word, &enterprise_identifier); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCPv6 enterprise identifier data, ignoring assignment: %s", p); return 0; } @@ -438,7 +434,7 @@ int config_parse_dhcp_send_option( if (r == -ENOMEM) return log_oom(); if (r <= 0 || isempty(p)) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid DHCP option, ignoring assignment: %s", rvalue); return 0; } @@ -446,24 +442,24 @@ int config_parse_dhcp_send_option( if (ltype == AF_INET6) { r = safe_atou16(word, &u16); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid DHCP option, ignoring assignment: %s", rvalue); return 0; } if (u16 < 1 || u16 >= UINT16_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid DHCP option, valid range is 1-65535, ignoring assignment: %s", rvalue); return 0; } } else { r = safe_atou8(word, &u8); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid DHCP option, ignoring assignment: %s", rvalue); return 0; } if (u8 < 1 || u8 >= UINT8_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid DHCP option, valid range is 1-254, ignoring assignment: %s", rvalue); return 0; } @@ -474,14 +470,14 @@ int config_parse_dhcp_send_option( if (r == -ENOMEM) return log_oom(); if (r <= 0 || isempty(p)) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid DHCP option, ignoring assignment: %s", rvalue); return 0; } type = dhcp_option_data_type_from_string(word); if (type < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid DHCP option data type, ignoring assignment: %s", p); return 0; } @@ -490,7 +486,7 @@ int config_parse_dhcp_send_option( case DHCP_OPTION_DATA_UINT8:{ r = safe_atou8(p, &uint8_data); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP uint8 data, ignoring assignment: %s", p); return 0; } @@ -502,7 +498,7 @@ int config_parse_dhcp_send_option( case DHCP_OPTION_DATA_UINT16:{ r = safe_atou16(p, &uint16_data); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP uint16 data, ignoring assignment: %s", p); return 0; } @@ -514,7 +510,7 @@ int config_parse_dhcp_send_option( case DHCP_OPTION_DATA_UINT32: { r = safe_atou32(p, &uint32_data); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP uint32 data, ignoring assignment: %s", p); return 0; } @@ -527,7 +523,7 @@ int config_parse_dhcp_send_option( case DHCP_OPTION_DATA_IPV4ADDRESS: { r = in_addr_from_string(AF_INET, p, &addr); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP ipv4address data, ignoring assignment: %s", p); return 0; } @@ -539,7 +535,7 @@ int config_parse_dhcp_send_option( case DHCP_OPTION_DATA_IPV6ADDRESS: { r = in_addr_from_string(AF_INET6, p, &addr); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP ipv6address data, ignoring assignment: %s", p); return 0; } @@ -551,7 +547,7 @@ int config_parse_dhcp_send_option( case DHCP_OPTION_DATA_STRING: sz = cunescape(p, UNESCAPE_ACCEPT_NUL, &q); if (sz < 0) { - log_syntax(unit, LOG_ERR, filename, line, sz, + log_syntax(unit, LOG_WARNING, filename, line, sz, "Failed to decode DHCP option data, ignoring assignment: %s", p); } @@ -564,7 +560,7 @@ int config_parse_dhcp_send_option( if (ltype == AF_INET6) { r = sd_dhcp6_option_new(u16, udata, sz, enterprise_identifier, &opt6); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store DHCP option '%s', ignoring assignment: %m", rvalue); return 0; } @@ -577,7 +573,7 @@ int config_parse_dhcp_send_option( old6 = ordered_hashmap_get(*options, UINT_TO_PTR(u16)); r = ordered_hashmap_replace(*options, UINT_TO_PTR(u16), opt6); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store DHCP option '%s', ignoring assignment: %m", rvalue); return 0; } @@ -585,7 +581,7 @@ int config_parse_dhcp_send_option( } else { r = sd_dhcp_option_new(u8, udata, sz, &opt4); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store DHCP option '%s', ignoring assignment: %m", rvalue); return 0; } @@ -598,7 +594,7 @@ int config_parse_dhcp_send_option( old4 = ordered_hashmap_get(*options, UINT_TO_PTR(u8)); r = ordered_hashmap_replace(*options, UINT_TO_PTR(u8), opt4); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store DHCP option '%s', ignoring assignment: %m", rvalue); return 0; } @@ -642,8 +638,10 @@ int config_parse_dhcp_request_options( uint32_t i; r = extract_first_word(&p, &n, NULL, 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP request option, ignoring assignment: %s", rvalue); return 0; @@ -653,13 +651,13 @@ int config_parse_dhcp_request_options( r = safe_atou32(n, &i); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "DHCP request option is invalid, ignoring assignment: %s", n); continue; } if (i < 1 || i >= UINT8_MAX) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, 0, "DHCP request option is invalid, valid range is 1-254, ignoring assignment: %s", n); continue; } @@ -667,11 +665,9 @@ int config_parse_dhcp_request_options( r = set_ensure_put(ltype == AF_INET ? &network->dhcp_request_options : &network->dhcp6_request_options, NULL, UINT32_TO_PTR(i)); if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store DHCP request option '%s', ignoring assignment: %m", n); } - - return 0; } DEFINE_CONFIG_PARSE_ENUM(config_parse_dhcp_use_domains, dhcp_use_domains, DHCPUseDomains, diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c index 6f25c9fc96..265d9dbc79 100644 --- a/src/network/networkd-dhcp-server.c +++ b/src/network/networkd-dhcp-server.c @@ -373,7 +373,7 @@ int config_parse_dhcp_server_emit( if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract word, ignoring: %s", rvalue); return 0; } @@ -382,7 +382,7 @@ int config_parse_dhcp_server_emit( r = in_addr_from_string(AF_INET, w, &a); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s= address '%s', ignoring: %m", lvalue, w); continue; } diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index b7a8c628fb..e076965ee6 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -1700,13 +1700,13 @@ int config_parse_dhcp_max_attempts( r = safe_atou64(rvalue, &a); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP maximum attempts, ignoring: %s", rvalue); return 0; } if (a == 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "%s= must be positive integer or 'infinity', ignoring: %s", lvalue, rvalue); return 0; } @@ -1749,8 +1749,10 @@ int config_parse_dhcp_acl_ip_address( union in_addr_union ip; r = extract_first_word(&p, &n, NULL, 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCP '%s=' IP address, ignoring assignment: %s", lvalue, rvalue); return 0; @@ -1760,18 +1762,16 @@ int config_parse_dhcp_acl_ip_address( r = in_addr_from_string(AF_INET, n, &ip); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "DHCP '%s=' IP address is invalid, ignoring assignment: %s", lvalue, n); continue; } r = set_ensure_put(acl, NULL, UINT32_TO_PTR(ip.in.s_addr)); if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store DHCP '%s=' IP address '%s', ignoring assignment: %m", lvalue, n); } - - return 0; } int config_parse_dhcp_ip_service_type( @@ -1828,13 +1828,13 @@ int config_parse_dhcp_mud_url( r = cunescape(rvalue, 0, &unescaped); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to Failed to unescape MUD URL, ignoring: %s", rvalue); return 0; } if (!http_url_is_valid(unescaped) || strlen(unescaped) > 255) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse MUD URL '%s', ignoring: %m", rvalue); return 0; @@ -1871,7 +1871,7 @@ int config_parse_dhcp_fallback_lease_lifetime(const char *unit, if (STR_IN_SET(rvalue, "forever", "infinity")) k = CACHE_INFO_INFINITY_LIFE_TIME; else { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid LeaseLifetime= value, ignoring: %s", rvalue); return 0; } diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 81cc1726cb..1f78e24110 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -1161,12 +1161,12 @@ int config_parse_dhcp6_pd_hint( r = in_addr_prefix_from_string(rvalue, AF_INET6, (union in_addr_union *) &network->dhcp6_pd_address, &network->dhcp6_pd_length); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse PrefixDelegationHint=%s, ignoring assignment", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse PrefixDelegationHint=%s, ignoring assignment", rvalue); return 0; } if (network->dhcp6_pd_length < 1 || network->dhcp6_pd_length > 128) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid prefix length='%d', ignoring assignment", network->dhcp6_pd_length); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid prefix length='%d', ignoring assignment", network->dhcp6_pd_length); network->dhcp6_pd_length = 0; return 0; } @@ -1201,13 +1201,13 @@ int config_parse_dhcp6_mud_url( r = cunescape(rvalue, 0, &unescaped); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to Failed to unescape MUD URL, ignoring: %s", rvalue); return 0; } if (!http_url_is_valid(unescaped) || strlen(unescaped) > UINT8_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse MUD URL '%s', ignoring: %m", rvalue); return 0; @@ -1243,13 +1243,13 @@ int config_parse_dhcp6_delegated_prefix_token( r = in_addr_from_string(AF_INET6, rvalue, &network->dhcp6_delegation_prefix_token); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DHCPv6 %s, ignoring: %s", lvalue, rvalue); return 0; } if (in_addr_is_null(AF_INET6, &network->dhcp6_delegation_prefix_token)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "DHCPv6 %s cannot be the ANY address, ignoring: %s", lvalue, rvalue); return 0; } diff --git a/src/network/networkd-fdb.c b/src/network/networkd-fdb.c index df18682245..833d13cf00 100644 --- a/src/network/networkd-fdb.c +++ b/src/network/networkd-fdb.c @@ -218,7 +218,7 @@ int config_parse_fdb_hwaddr( r = ether_addr_from_string(rvalue, &fdb_entry->mac_addr); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Not a valid MAC address, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Not a valid MAC address, ignoring assignment: %s", rvalue); return 0; } @@ -293,7 +293,7 @@ int config_parse_fdb_destination( r = in_addr_from_string_auto(rvalue, &fdb_entry->family, &fdb_entry->destination_addr); if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, + return log_syntax(unit, LOG_WARNING, filename, line, r, "FDB destination IP address is invalid, ignoring assignment: %s", rvalue); @@ -331,14 +331,14 @@ int config_parse_fdb_vxlan_vni( r = safe_atou32(rvalue, &vni); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse VXLAN Network Identifier (VNI), ignoring assignment: %s", rvalue); return 0; } if (vni > VXLAN_VID_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "FDB invalid VXLAN Network Identifier (VNI), ignoring assignment: %s", rvalue); return 0; @@ -379,7 +379,7 @@ int config_parse_fdb_ntf_flags( f = fdb_ntf_flags_from_string(rvalue); if (f < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL), "FDB failed to parse AssociatedWith=, ignoring assignment: %s", rvalue); return 0; diff --git a/src/network/networkd-ipv4ll.c b/src/network/networkd-ipv4ll.c index 8dac99fed8..aaca215e56 100644 --- a/src/network/networkd-ipv4ll.c +++ b/src/network/networkd-ipv4ll.c @@ -208,7 +208,7 @@ int config_parse_ipv4ll( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=%s, ignoring assignment. " "Note that the setting %s= is deprecated, please use LinkLocalAddressing= instead.", lvalue, rvalue, lvalue); diff --git a/src/network/networkd-ipv6-proxy-ndp.c b/src/network/networkd-ipv6-proxy-ndp.c index b207866c75..7051ba9dac 100644 --- a/src/network/networkd-ipv6-proxy-ndp.c +++ b/src/network/networkd-ipv6-proxy-ndp.c @@ -113,17 +113,18 @@ int config_parse_ipv6_proxy_ndp_address( r = ipv6_proxy_ndp_address_new_static(network, &ipv6_proxy_ndp_address); if (r < 0) - return r; + return log_oom(); r = in_addr_from_string(AF_INET6, rvalue, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse IPv6 proxy NDP address, ignoring: %s", + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to parse IPv6 proxy NDP address, ignoring: %s", rvalue); return 0; } if (in_addr_is_null(AF_INET6, &buffer)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "IPv6 proxy NDP address cannot be the ANY address, ignoring: %s", rvalue); return 0; } diff --git a/src/network/networkd-lldp-tx.c b/src/network/networkd-lldp-tx.c index f2d4e6f2bb..9e0b447524 100644 --- a/src/network/networkd-lldp-tx.c +++ b/src/network/networkd-lldp-tx.c @@ -447,7 +447,7 @@ int config_parse_lldp_emit( else { r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse LLDP emission setting, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse LLDP emission setting, ignoring: %s", rvalue); return 0; } @@ -479,13 +479,13 @@ int config_parse_lldp_mud( r = cunescape(rvalue, 0, &unescaped); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to Failed to unescape LLDP MUD URL, ignoring: %s", rvalue); return 0; } if (!http_url_is_valid(unescaped) || strlen(unescaped) > 255) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse LLDP MUD URL '%s', ignoring: %m", rvalue); return 0; diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 62392d37b6..bbc6d9825f 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -969,8 +969,10 @@ int config_parse_ndisc_deny_listed_prefix( union in_addr_union ip; r = extract_first_word(&p, &n, NULL, 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse NDISC deny-listed prefix, ignoring assignment: %s", rvalue); return 0; @@ -980,7 +982,7 @@ int config_parse_ndisc_deny_listed_prefix( r = in_addr_from_string(AF_INET6, n, &ip); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "NDISC deny-listed prefix is invalid, ignoring assignment: %s", n); continue; } @@ -996,8 +998,6 @@ int config_parse_ndisc_deny_listed_prefix( if (r < 0) return log_oom(); } - - return 0; } int config_parse_address_generation_type( @@ -1043,13 +1043,13 @@ int config_parse_address_generation_type( r = in_addr_from_string(AF_INET6, p, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse IPv6 %s, ignoring: %s", lvalue, rvalue); return 0; } if (in_addr_is_null(AF_INET6, &buffer)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "IPv6 %s cannot be the ANY address, ignoring: %s", lvalue, rvalue); return 0; } @@ -1062,7 +1062,7 @@ int config_parse_address_generation_type( r = ordered_hashmap_put(network->ipv6_tokens, &token->prefix, token); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store IPv6 token '%s'", rvalue); return 0; } diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c index 6d91f70511..1c90113856 100644 --- a/src/network/networkd-neighbor.c +++ b/src/network/networkd-neighbor.c @@ -399,11 +399,12 @@ int config_parse_neighbor_address( r = neighbor_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = in_addr_from_string_auto(rvalue, &n->family, &n->in_addr); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Neighbor Address is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, + "Neighbor Address is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -436,7 +437,7 @@ int config_parse_neighbor_lladdr( r = neighbor_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = ether_addr_from_string(rvalue, &n->lladdr.mac); if (r >= 0) @@ -444,7 +445,7 @@ int config_parse_neighbor_lladdr( else { r = in_addr_from_string_auto(rvalue, &family, &n->lladdr.ip); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Neighbor LinkLayerAddress= is invalid, ignoring assignment: %s", rvalue); return 0; @@ -481,11 +482,11 @@ int config_parse_neighbor_hwaddr( r = neighbor_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = ether_addr_from_string(rvalue, &n->lladdr.mac); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Neighbor MACAddress= is invalid, ignoring assignment: %s", rvalue); return 0; } diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 6b471c51e9..57086cba72 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -156,16 +156,16 @@ Route.Scope, config_parse_route_scope, Route.PreferredSource, config_parse_preferred_src, 0, 0 Route.Table, config_parse_route_table, 0, 0 Route.MTUBytes, config_parse_route_mtu, AF_UNSPEC, 0 -Route.GatewayOnLink, config_parse_gateway_onlink, 0, 0 -Route.GatewayOnlink, config_parse_gateway_onlink, 0, 0 +Route.GatewayOnLink, config_parse_route_boolean, 0, 0 +Route.GatewayOnlink, config_parse_route_boolean, 0, 0 Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0 Route.Protocol, config_parse_route_protocol, 0, 0 Route.Type, config_parse_route_type, 0, 0 Route.InitialCongestionWindow, config_parse_tcp_window, 0, 0 Route.InitialAdvertisedReceiveWindow, config_parse_tcp_window, 0, 0 -Route.QuickAck, config_parse_quickack, 0, 0 -Route.FastOpenNoCookie, config_parse_fast_open_no_cookie, 0, 0 -Route.TTLPropagate, config_parse_route_ttl_propagate, 0, 0 +Route.QuickAck, config_parse_route_boolean, 0, 0 +Route.FastOpenNoCookie, config_parse_route_boolean, 0, 0 +Route.TTLPropagate, config_parse_route_boolean, 0, 0 Route.MultiPathRoute, config_parse_multipath_route, 0, 0 NextHop.Id, config_parse_nexthop_id, 0, 0 NextHop.Gateway, config_parse_nexthop_gateway, 0, 0 diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index f7021f3edb..6a3920adab 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -902,7 +902,7 @@ int config_parse_stacked_netdev(const char *unit, NETDEV_KIND_XFRM)); if (!ifname_valid(rvalue)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid netdev name in %s=, ignoring assignment: %s", lvalue, rvalue); return 0; } @@ -917,7 +917,7 @@ int config_parse_stacked_netdev(const char *unit, r = hashmap_put(*h, name, INT_TO_PTR(kind)); if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Cannot add NetDev '%s' to network, ignoring assignment: %m", name); else if (r == 0) log_syntax(unit, LOG_DEBUG, filename, line, r, @@ -940,7 +940,6 @@ int config_parse_domains( void *data, void *userdata) { - const char *p; Network *n = data; int r; @@ -954,20 +953,21 @@ int config_parse_domains( return 0; } - p = rvalue; - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL, *normalized = NULL; const char *domain; bool is_route; r = extract_first_word(&p, &w, NULL, 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract search or route domain, ignoring: %s", rvalue); - break; + return 0; } if (r == 0) - break; + return 0; is_route = w[0] == '~'; domain = is_route ? w + 1 : w; @@ -981,7 +981,7 @@ int config_parse_domains( } else { r = dns_name_normalize(domain, 0, &normalized); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "'%s' is not a valid domain name, ignoring.", domain); continue; } @@ -989,7 +989,7 @@ int config_parse_domains( domain = normalized; if (is_localhost(domain)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "'localhost' domain may not be configured as search or route domain, ignoring assignment: %s", domain); continue; @@ -999,14 +999,12 @@ int config_parse_domains( OrderedSet **set = is_route ? &n->route_domains : &n->search_domains; r = ordered_set_ensure_allocated(set, &string_hash_ops); if (r < 0) - return r; + return log_oom(); r = ordered_set_put_strdup(*set, domain); if (r < 0) return log_oom(); } - - return 0; } int config_parse_ipv6token( @@ -1032,19 +1030,19 @@ int config_parse_ipv6token( r = in_addr_from_string(AF_INET6, rvalue, &buffer); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse IPv6 token, ignoring: %s", rvalue); return 0; } if (in_addr_is_null(AF_INET6, &buffer)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "IPv6 token cannot be the ANY address, ignoring: %s", rvalue); return 0; } if ((buffer.in6.s6_addr32[0] | buffer.in6.s6_addr32[1]) != 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "IPv6 token cannot be longer than 64 bits, ignoring: %s", rvalue); return 0; } @@ -1087,7 +1085,7 @@ int config_parse_ipv6_privacy_extensions( if (streq(rvalue, "kernel")) s = _IPV6_PRIVACY_EXTENSIONS_INVALID; else { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse IPv6 privacy extensions option, ignoring: %s", rvalue); return 0; } @@ -1123,19 +1121,19 @@ int config_parse_hostname( return r; if (!hostname_is_valid(hn, false)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Hostname is not valid, ignoring assignment: %s", rvalue); return 0; } r = dns_name_is_valid(hn); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, 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, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Hostname is not a valid DNS domain name, ignoring assignment: %s", rvalue); return 0; } @@ -1167,8 +1165,8 @@ int config_parse_timezone( if (r < 0) return r; - if (!timezone_is_valid(tz, LOG_ERR)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + if (!timezone_is_valid(tz, LOG_WARNING)) { + log_syntax(unit, LOG_WARNING, filename, line, 0, "Timezone is not valid, ignoring assignment: %s", rvalue); return 0; } @@ -1195,26 +1193,32 @@ int config_parse_dns( assert(lvalue); assert(rvalue); - for (;;) { + if (isempty(rvalue)) { + n->dns = mfree(n->dns); + n->n_dns = 0; + return 0; + } + + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL; union in_addr_union a; struct in_addr_data *m; int family; - r = extract_first_word(&rvalue, &w, NULL, 0); + r = extract_first_word(&p, &w, NULL, 0); if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue); - break; + return 0; } if (r == 0) - break; + return 0; r = in_addr_from_string_auto(w, &family, &a); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse dns server address, ignoring: %s", w); continue; } @@ -1230,8 +1234,6 @@ int config_parse_dns( n->dns = m; } - - return 0; } int config_parse_dnssec_negative_trust_anchors( @@ -1246,7 +1248,6 @@ int config_parse_dnssec_negative_trust_anchors( void *data, void *userdata) { - const char *p = rvalue; Network *n = data; int r; @@ -1259,21 +1260,23 @@ int config_parse_dnssec_negative_trust_anchors( return 0; } - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL; r = extract_first_word(&p, &w, NULL, 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract negative trust anchor domain, ignoring: %s", rvalue); - break; + return 0; } if (r == 0) - break; + return 0; r = dns_name_is_valid(w); if (r <= 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "%s is not a valid domain name, ignoring.", w); continue; } @@ -1282,8 +1285,6 @@ int config_parse_dnssec_negative_trust_anchors( if (r < 0) return log_oom(); } - - return 0; } int config_parse_ntp( @@ -1310,23 +1311,23 @@ int config_parse_ntp( return 0; } - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL; - r = extract_first_word(&rvalue, &w, NULL, 0); + r = extract_first_word(&p, &w, NULL, 0); if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract NTP server name, ignoring: %s", rvalue); - break; + return 0; } if (r == 0) - break; + return 0; r = dns_name_is_valid_or_address(w); if (r <= 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "%s is not a valid domain name or IP address, ignoring.", w); continue; } @@ -1335,15 +1336,13 @@ int config_parse_ntp( log_syntax(unit, LOG_WARNING, filename, line, 0, "More than %u NTP servers specified, ignoring \"%s\" and any subsequent entries.", MAX_NTP_SERVERS, w); - break; + return 0; } r = strv_consume(l, TAKE_PTR(w)); if (r < 0) return log_oom(); } - - return 0; } int config_parse_required_for_online( @@ -1373,7 +1372,7 @@ int config_parse_required_for_online( if (r < 0) { r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s= setting, ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c index 5d91d791d1..6d89be1a25 100644 --- a/src/network/networkd-nexthop.c +++ b/src/network/networkd-nexthop.c @@ -414,11 +414,11 @@ int config_parse_nexthop_id( r = nexthop_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = safe_atou32(rvalue, &n->id); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse nexthop id \"%s\", ignoring assignment: %m", rvalue); return 0; } @@ -451,11 +451,11 @@ int config_parse_nexthop_gateway( r = nexthop_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = in_addr_from_string_auto(rvalue, &n->family, &n->gw); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid %s='%s', ignoring assignment: %m", lvalue, rvalue); return 0; } diff --git a/src/network/networkd-radv.c b/src/network/networkd-radv.c index d52aadecfa..f4dc9a993c 100644 --- a/src/network/networkd-radv.c +++ b/src/network/networkd-radv.c @@ -211,11 +211,11 @@ int config_parse_prefix(const char *unit, r = prefix_new_static(network, filename, section_line, &p); if (r < 0) - return r; + return log_oom(); r = in_addr_prefix_from_string(rvalue, AF_INET6, &in6addr, &prefixlen); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Prefix is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Prefix is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -251,11 +251,11 @@ int config_parse_prefix_flags(const char *unit, r = prefix_new_static(network, filename, section_line, &p); if (r < 0) - return r; + return log_oom(); r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse address flag, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse address flag, ignoring: %s", rvalue); return 0; } @@ -296,11 +296,11 @@ int config_parse_prefix_lifetime(const char *unit, r = prefix_new_static(network, filename, section_line, &p); if (r < 0) - return r; + return log_oom(); r = parse_sec(rvalue, &usec); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Lifetime is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Lifetime is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -343,11 +343,11 @@ int config_parse_prefix_assign( r = prefix_new_static(network, filename, section_line, &p); if (r < 0) - return r; + return log_oom(); r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue); return 0; @@ -384,11 +384,11 @@ int config_parse_route_prefix(const char *unit, r = route_prefix_new_static(network, filename, section_line, &p); if (r < 0) - return r; + return log_oom(); r = in_addr_prefix_from_string(rvalue, AF_INET6, &in6addr, &prefixlen); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Route prefix is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Route prefix is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -425,11 +425,11 @@ int config_parse_route_prefix_lifetime(const char *unit, r = route_prefix_new_static(network, filename, section_line, &p); if (r < 0) - return r; + return log_oom(); r = parse_sec(rvalue, &usec); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Route lifetime is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -716,14 +716,13 @@ int config_parse_radv_dns( void *userdata) { Network *n = data; - const char *p = rvalue; int r; assert(filename); assert(lvalue); assert(rvalue); - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL; union in_addr_union a; @@ -731,25 +730,25 @@ int config_parse_radv_dns( if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract word, ignoring: %s", rvalue); return 0; } if (r == 0) - break; + return 0; if (streq(w, "_link_local")) a = IN_ADDR_NULL; else { r = in_addr_from_string(AF_INET6, w, &a); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse DNS server address, ignoring: %s", w); continue; } if (in_addr_is_null(AF_INET6, &a)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "DNS server address is null, ignoring: %s", w); continue; } @@ -763,8 +762,6 @@ int config_parse_radv_dns( m[n->n_router_dns++] = a.in6; n->router_dns = m; } - - return 0; } int config_parse_radv_search_domains( @@ -780,30 +777,29 @@ int config_parse_radv_search_domains( void *userdata) { Network *n = data; - const char *p = rvalue; int r; assert(filename); assert(lvalue); assert(rvalue); - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *w = NULL, *idna = NULL; r = extract_first_word(&p, &w, NULL, 0); if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract word, ignoring: %s", rvalue); return 0; } if (r == 0) - break; + return 0; r = dns_name_apply_idna(w, &idna); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to apply IDNA to domain name '%s', ignoring: %m", w); continue; } else if (r == 0) @@ -812,14 +808,12 @@ int config_parse_radv_search_domains( r = ordered_set_ensure_allocated(&n->router_search_domains, &string_hash_ops); if (r < 0) - return r; + return log_oom(); r = ordered_set_consume(n->router_search_domains, TAKE_PTR(idna)); if (r < 0) - return r; + return log_oom(); } - - return 0; } static const char * const radv_prefix_delegation_table[_RADV_PREFIX_DELEGATION_MAX] = { @@ -857,7 +851,8 @@ int config_parse_router_prefix_delegation( d = radv_prefix_delegation_from_string(rvalue); if (d < 0) { - log_syntax(unit, LOG_ERR, filename, line, -EINVAL, "Invalid router prefix delegation '%s', ignoring assignment.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL), + "Invalid router prefix delegation '%s', ignoring assignment.", rvalue); return 0; } @@ -891,7 +886,8 @@ int config_parse_router_preference(const char *unit, else if (streq(rvalue, "low")) network->router_preference = SD_NDISC_PREFERENCE_LOW; else - log_syntax(unit, LOG_ERR, filename, line, -EINVAL, "Router preference '%s' is invalid, ignoring assignment: %m", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Invalid router preference, ignoring assignment: %s", rvalue); return 0; } @@ -922,7 +918,7 @@ int config_parse_router_prefix_subnet_id(const char *unit, r = safe_atoux64(rvalue, &t); if (r < 0 || t > INT64_MAX) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Subnet id '%s' is invalid, ignoring assignment.", rvalue); return 0; diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index c93bf9feac..62a9b8b9b3 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -15,6 +15,7 @@ #include "socket-netlink.h" #include "string-table.h" #include "string-util.h" +#include "strv.h" #include "strxcpyx.h" #include "sysctl-util.h" #include "vrf.h" @@ -991,12 +992,22 @@ int config_parse_gateway( /* we are not in an Route section, so treat * this as the special '0' section */ r = route_new_static(network, NULL, 0, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } } else { r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } if (streq(rvalue, "_dhcp")) { n->gateway_from_dhcp = true; @@ -1010,7 +1021,7 @@ int config_parse_gateway( else r = in_addr_from_string(n->family, rvalue, &n->gw); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid %s='%s', ignoring assignment: %m", lvalue, rvalue); return 0; } @@ -1042,15 +1053,20 @@ int config_parse_preferred_src( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } if (n->family == AF_UNSPEC) r = in_addr_from_string_auto(rvalue, &n->family, &n->prefsrc); else r = in_addr_from_string(n->family, rvalue, &n->prefsrc); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, + log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Invalid %s='%s', ignoring assignment: %m", lvalue, rvalue); return 0; } @@ -1084,8 +1100,13 @@ int config_parse_destination( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } if (streq(lvalue, "Destination")) { buffer = &n->dst; @@ -1101,7 +1122,7 @@ int config_parse_destination( else r = in_addr_prefix_from_string(rvalue, n->family, buffer, prefixlen); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, EINVAL, + log_syntax(unit, LOG_WARNING, filename, line, EINVAL, "Invalid %s='%s', ignoring assignment: %m", lvalue, rvalue); return 0; } @@ -1133,12 +1154,17 @@ int config_parse_route_priority( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } r = safe_atou32(rvalue, &n->priority); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse route priority \"%s\", ignoring assignment: %m", rvalue); return 0; } @@ -1170,12 +1196,17 @@ int config_parse_route_scope( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } r = route_scope_from_string(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Unknown route scope: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown route scope: %s", rvalue); return 0; } @@ -1208,8 +1239,13 @@ int config_parse_route_table( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } r = route_table_from_string(rvalue); if (r >= 0) @@ -1217,7 +1253,7 @@ int config_parse_route_table( else { r = safe_atou32(rvalue, &n->table); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse route table number \"%s\", ignoring assignment: %m", rvalue); return 0; } @@ -1228,7 +1264,7 @@ int config_parse_route_table( return 0; } -int config_parse_gateway_onlink( +int config_parse_route_boolean( const char *unit, const char *filename, unsigned line, @@ -1251,17 +1287,31 @@ int config_parse_gateway_onlink( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse %s=\"%s\", ignoring assignment: %m", lvalue, rvalue); return 0; } - n->gateway_onlink = r; + if (STR_IN_SET(lvalue, "GatewayOnLink", "GatewayOnlink")) + n->gateway_onlink = r; + else if (streq(lvalue, "QuickAck")) + n->quickack = r; + else if (streq(lvalue, "FastOpenNoCookie")) + n->fast_open_no_cookie = r; + else if (streq(lvalue, "TTLPropagate")) + n->ttl_propagate = r; + else + assert_not_reached("Invalid lvalue"); TAKE_PTR(n); return 0; @@ -1284,8 +1334,13 @@ int config_parse_ipv6_route_preference( int r; r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } if (streq(rvalue, "low")) n->pref = ICMPV6_ROUTER_PREF_LOW; @@ -1294,7 +1349,7 @@ int config_parse_ipv6_route_preference( else if (streq(rvalue, "high")) n->pref = ICMPV6_ROUTER_PREF_HIGH; else { - log_syntax(unit, LOG_ERR, filename, line, 0, "Unknown route preference: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Unknown route preference: %s", rvalue); return 0; } @@ -1319,8 +1374,13 @@ int config_parse_route_protocol( int r; r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } r = route_protocol_from_string(rvalue); if (r >= 0) @@ -1328,7 +1388,7 @@ int config_parse_route_protocol( else { r = safe_atou8(rvalue , &n->protocol); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse route protocol \"%s\", ignoring assignment: %m", rvalue); return 0; } @@ -1355,12 +1415,17 @@ int config_parse_route_type( int t, r; r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } t = route_type_from_string(rvalue); if (t < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Could not parse route type \"%s\", ignoring assignment: %m", rvalue); return 0; } @@ -1395,17 +1460,22 @@ int config_parse_tcp_window( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } r = parse_size(rvalue, 1024, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Could not parse TCP %s \"%s\", ignoring assignment: %m", lvalue, rvalue); return 0; } if (k > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Specified TCP %s \"%s\" is too large, ignoring assignment: %m", lvalue, rvalue); return 0; } @@ -1421,82 +1491,6 @@ int config_parse_tcp_window( return 0; } -int config_parse_quickack( - 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) { - - _cleanup_(route_free_or_set_invalidp) Route *n = NULL; - Network *network = userdata; - int k, r; - - assert(filename); - assert(section); - assert(lvalue); - assert(rvalue); - assert(data); - - r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; - - k = parse_boolean(rvalue); - if (k < 0) { - log_syntax(unit, LOG_ERR, filename, line, k, - "Failed to parse TCP quickack, ignoring: %s", rvalue); - return 0; - } - - n->quickack = !!k; - TAKE_PTR(n); - return 0; -} - -int config_parse_fast_open_no_cookie( - 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) { - - _cleanup_(route_free_or_set_invalidp) Route *n = NULL; - Network *network = userdata; - int k, r; - - assert(filename); - assert(section); - assert(lvalue); - assert(rvalue); - assert(data); - - r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; - - k = parse_boolean(rvalue); - if (k < 0) { - log_syntax(unit, LOG_ERR, filename, line, k, - "Failed to parse TCP fastopen no cookie, ignoring: %s", rvalue); - return 0; - } - - n->fast_open_no_cookie = k; - TAKE_PTR(n); - return 0; -} - int config_parse_route_mtu( const char *unit, const char *filename, @@ -1520,8 +1514,13 @@ int config_parse_route_mtu( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } r = config_parse_mtu(unit, filename, line, section, section_line, lvalue, ltype, rvalue, &n->mtu, userdata); if (r < 0) @@ -1531,45 +1530,6 @@ int config_parse_route_mtu( return 0; } -int config_parse_route_ttl_propagate( - 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) { - - Network *network = userdata; - _cleanup_(route_free_or_set_invalidp) Route *n = NULL; - int r, k; - - assert(filename); - assert(section); - assert(lvalue); - assert(rvalue); - assert(data); - - r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; - - k = parse_boolean(rvalue); - if (k < 0) { - log_syntax(unit, LOG_ERR, filename, line, k, - "Failed to parse TTLPropagate= value, ignoring: %s", rvalue); - return 0; - } - - n->ttl_propagate = k; - - TAKE_PTR(n); - return 0; -} - int config_parse_multipath_route( const char *unit, const char *filename, @@ -1597,8 +1557,13 @@ int config_parse_multipath_route( assert(data); r = route_new_static(network, filename, section_line, &n); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to allocate route, ignoring assignment: %m"); + return 0; + } if (isempty(rvalue)) { n->multipath_routes = ordered_set_free_free(n->multipath_routes); @@ -1614,7 +1579,7 @@ int config_parse_multipath_route( if (r == -ENOMEM) return log_oom(); if (r <= 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid multipath route option, ignoring assignment: %s", rvalue); return 0; } @@ -1631,7 +1596,7 @@ int config_parse_multipath_route( r = in_addr_from_string_auto(ip, &family, &a); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid multipath route gateway '%s', ignoring assignment: %m", rvalue); return 0; } @@ -1641,7 +1606,7 @@ int config_parse_multipath_route( if (dev) { r = resolve_interface(NULL, dev); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid interface name or index, ignoring assignment: %s", dev); return 0; } @@ -1651,12 +1616,12 @@ int config_parse_multipath_route( if (!isempty(p)) { r = safe_atou32(p, &m->weight); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid multipath route weight, ignoring assignment: %s", p); return 0; } if (m->weight == 0 || m->weight > 256) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid multipath route weight, ignoring assignment: %s", p); return 0; } @@ -1668,7 +1633,7 @@ int config_parse_multipath_route( r = ordered_set_put(n->multipath_routes, m); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to store multipath route, ignoring assignment: %m"); return 0; } diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h index 067c65f2f7..e926ccd7a4 100644 --- a/src/network/networkd-route.h +++ b/src/network/networkd-route.h @@ -100,13 +100,10 @@ CONFIG_PARSER_PROTOTYPE(config_parse_destination); CONFIG_PARSER_PROTOTYPE(config_parse_route_priority); CONFIG_PARSER_PROTOTYPE(config_parse_route_scope); CONFIG_PARSER_PROTOTYPE(config_parse_route_table); -CONFIG_PARSER_PROTOTYPE(config_parse_gateway_onlink); +CONFIG_PARSER_PROTOTYPE(config_parse_route_boolean); CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_route_preference); CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol); CONFIG_PARSER_PROTOTYPE(config_parse_route_type); CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window); -CONFIG_PARSER_PROTOTYPE(config_parse_quickack); -CONFIG_PARSER_PROTOTYPE(config_parse_fast_open_no_cookie); -CONFIG_PARSER_PROTOTYPE(config_parse_route_ttl_propagate); CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu); CONFIG_PARSER_PROTOTYPE(config_parse_multipath_route); diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index 035f006d35..9777e020ed 100644 --- a/src/network/networkd-routing-policy-rule.c +++ b/src/network/networkd-routing-policy-rule.c @@ -694,11 +694,11 @@ int config_parse_routing_policy_rule_tos( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = safe_atou8(rvalue, &n->tos); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse RPDB rule TOS, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule TOS, ignoring: %s", rvalue); return 0; } @@ -731,11 +731,11 @@ int config_parse_routing_policy_rule_priority( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = safe_atou32(rvalue, &n->priority); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse RPDB rule priority, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule priority, ignoring: %s", rvalue); return 0; } @@ -768,11 +768,11 @@ int config_parse_routing_policy_rule_table( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = safe_atou32(rvalue, &n->table); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse RPDB rule table, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule table, ignoring: %s", rvalue); return 0; } @@ -805,11 +805,11 @@ int config_parse_routing_policy_rule_fwmark_mask( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = parse_fwmark_fwmask(rvalue, &n->fwmark, &n->fwmask); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse RPDB rule firewall mark or mask, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule firewall mark or mask, ignoring: %s", rvalue); return 0; } @@ -844,7 +844,7 @@ int config_parse_routing_policy_rule_prefix( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); if (streq(lvalue, "To")) { buffer = &n->to; @@ -859,7 +859,7 @@ int config_parse_routing_policy_rule_prefix( else r = in_addr_prefix_from_string(rvalue, n->family, buffer, prefixlen); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "RPDB rule prefix is invalid, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "RPDB rule prefix is invalid, ignoring assignment: %s", rvalue); return 0; } @@ -892,10 +892,10 @@ int config_parse_routing_policy_rule_device( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); if (!ifname_valid(rvalue)) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse '%s' interface name, ignoring: %s", lvalue, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse '%s' interface name, ignoring: %s", lvalue, rvalue); return 0; } @@ -938,11 +938,11 @@ int config_parse_routing_policy_rule_port_range( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = parse_ip_port_range(rvalue, &low, &high); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse routing policy rule port range '%s'", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse routing policy rule port range '%s'", rvalue); return 0; } @@ -983,11 +983,11 @@ int config_parse_routing_policy_rule_ip_protocol( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = parse_ip_protocol(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse IP protocol '%s' for routing policy rule, ignoring: %m", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse IP protocol '%s' for routing policy rule, ignoring: %m", rvalue); return 0; } @@ -1022,11 +1022,11 @@ int config_parse_routing_policy_rule_invert( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse RPDB rule invert, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule invert, ignoring: %s", rvalue); return 0; } @@ -1062,11 +1062,11 @@ int config_parse_routing_policy_rule_family( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); a = routing_policy_rule_address_family_from_string(rvalue); if (a < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid address family '%s', ignoring.", rvalue); return 0; } @@ -1102,7 +1102,7 @@ int config_parse_routing_policy_rule_uid_range( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = get_user_creds(&rvalue, &start, NULL, NULL, NULL, 0); if (r >= 0) @@ -1110,7 +1110,7 @@ int config_parse_routing_policy_rule_uid_range( else { r = parse_uid_range(rvalue, &start, &end); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid uid or uid range '%s', ignoring: %m", rvalue); return 0; } @@ -1147,15 +1147,15 @@ int config_parse_routing_policy_rule_suppress_prefixlen( r = routing_policy_rule_new_static(network, filename, section_line, &n); if (r < 0) - return r; + return log_oom(); r = parse_ip_prefix_length(rvalue, &n->suppress_prefixlen); if (r == -ERANGE) { - log_syntax(unit, LOG_ERR, filename, line, r, "Prefix length outside of valid range 0-128, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Prefix length outside of valid range 0-128, ignoring: %s", rvalue); return 0; } if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse RPDB rule suppress_prefixlen, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse RPDB rule suppress_prefixlen, ignoring: %s", rvalue); return 0; } diff --git a/src/network/networkd-sriov.c b/src/network/networkd-sriov.c index 5ae751ed46..7d99707343 100644 --- a/src/network/networkd-sriov.c +++ b/src/network/networkd-sriov.c @@ -283,20 +283,20 @@ int config_parse_sr_iov_uint32( r = safe_atou32(rvalue, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse SR-IOV '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (streq(lvalue, "VLANId")) { if (k == 0 || k > 4095) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid SR-IOV VLANId: %d", k); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid SR-IOV VLANId: %d", k); return 0; } sr_iov->vlan = k; } else if (streq(lvalue, "VirtualFunction")) { if (k >= INT_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid SR-IOV virtual function: %d", k); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid SR-IOV virtual function: %d", k); return 0; } sr_iov->vf = k; @@ -339,7 +339,7 @@ int config_parse_sr_iov_vlan_proto( else if (streq(rvalue, "802.1ad")) sr_iov->vlan_proto = ETH_P_8021AD; else { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid SR-IOV '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } @@ -390,7 +390,7 @@ int config_parse_sr_iov_link_state( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse SR-IOV '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } @@ -441,7 +441,7 @@ int config_parse_sr_iov_boolean( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse '%s=', ignoring: %s", lvalue, rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring: %s", lvalue, rvalue); return 0; } @@ -491,7 +491,7 @@ int config_parse_sr_iov_mac( r = ether_addr_from_string(rvalue, &sr_iov->mac); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse SR-IOV '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c index bc76fc7a59..43507d8c63 100644 --- a/src/network/networkd-util.c +++ b/src/network/networkd-util.c @@ -86,7 +86,7 @@ int config_parse_address_family_with_kernel( if (streq(rvalue, "kernel")) s = ADDRESS_FAMILY_NO; else { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse IPForward= option, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse IPForward= option, ignoring: %s", rvalue); return 0; } } diff --git a/src/network/tc/cake.c b/src/network/tc/cake.c index 286c7e172f..1da1ec40c3 100644 --- a/src/network/tc/cake.c +++ b/src/network/tc/cake.c @@ -68,9 +68,11 @@ int config_parse_cake_bandwidth( r = qdisc_new_static(QDISC_KIND_CAKE, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } c = CAKE(qdisc); @@ -83,7 +85,7 @@ int config_parse_cake_bandwidth( r = parse_size(rvalue, 1000, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -121,9 +123,11 @@ int config_parse_cake_overhead( r = qdisc_new_static(QDISC_KIND_CAKE, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } c = CAKE(qdisc); @@ -135,13 +139,13 @@ int config_parse_cake_overhead( r = safe_atoi32(rvalue, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (v < -64 || v > 256) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/codel.c b/src/network/tc/codel.c index 65c724da75..cba6faf376 100644 --- a/src/network/tc/codel.c +++ b/src/network/tc/codel.c @@ -99,9 +99,11 @@ int config_parse_controlled_delay_u32( r = qdisc_new_static(QDISC_KIND_CODEL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } cd = CODEL(qdisc); @@ -114,7 +116,7 @@ int config_parse_controlled_delay_u32( r = safe_atou32(rvalue, &cd->packet_limit); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -151,9 +153,11 @@ int config_parse_controlled_delay_usec( r = qdisc_new_static(QDISC_KIND_CODEL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } cd = CODEL(qdisc); @@ -178,7 +182,7 @@ int config_parse_controlled_delay_usec( r = parse_sec(rvalue, p); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -214,9 +218,11 @@ int config_parse_controlled_delay_bool( r = qdisc_new_static(QDISC_KIND_CODEL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } cd = CODEL(qdisc); @@ -229,7 +235,7 @@ int config_parse_controlled_delay_bool( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/drr.c b/src/network/tc/drr.c index a671f32d99..9810a120d1 100644 --- a/src/network/tc/drr.c +++ b/src/network/tc/drr.c @@ -66,9 +66,13 @@ int config_parse_drr_size( assert(data); r = tclass_new_static(TCLASS_KIND_DRR, network, filename, section_line, &tclass); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to create traffic control class, ignoring assignment: %m"); + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } drr = TCLASS_TO_DRR(tclass); @@ -81,13 +85,13 @@ int config_parse_drr_size( r = parse_size(rvalue, 1024, &u); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (u > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } diff --git a/src/network/tc/ets.c b/src/network/tc/ets.c index 83e9d8bff3..ece1f369d5 100644 --- a/src/network/tc/ets.c +++ b/src/network/tc/ets.c @@ -101,9 +101,11 @@ int config_parse_ets_u8( r = qdisc_new_static(QDISC_KIND_ETS, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } ets = ETS(qdisc); if (streq(lvalue, "Bands")) @@ -122,13 +124,13 @@ int config_parse_ets_u8( r = safe_atou8(rvalue, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (v > TCQ_ETS_MAX_BANDS) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s='. The value must be <= %d, ignoring assignment: %s", lvalue, TCQ_ETS_MAX_BANDS, rvalue); return 0; @@ -165,9 +167,11 @@ int config_parse_ets_quanta( r = qdisc_new_static(QDISC_KIND_ETS, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } ets = ETS(qdisc); @@ -187,28 +191,28 @@ int config_parse_ets_quanta( if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract next value, ignoring: %m"); - continue; + break; } if (r == 0) break; r = parse_size(word, 1024, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, word); continue; } if (v == 0 || v > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, word); continue; } if (ets->n_quanta >= TCQ_ETS_MAX_BANDS) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Too many quanta in '%s=', ignoring assignment: %s", lvalue, word); continue; @@ -247,9 +251,11 @@ int config_parse_ets_prio( r = qdisc_new_static(QDISC_KIND_ETS, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } ets = ETS(qdisc); @@ -269,22 +275,22 @@ int config_parse_ets_prio( if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract next value, ignoring: %m"); - continue; + break; } if (r == 0) break; r = safe_atou8(word, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, word); continue; } if (ets->n_prio > TC_PRIO_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Too many priomap in '%s=', ignoring assignment: %s", lvalue, word); continue; diff --git a/src/network/tc/fifo.c b/src/network/tc/fifo.c index 1a608dd7c0..e955223a89 100644 --- a/src/network/tc/fifo.c +++ b/src/network/tc/fifo.c @@ -67,9 +67,11 @@ int config_parse_pfifo_size( r = qdisc_new_static(ltype, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } switch(qdisc->kind) { case QDISC_KIND_PFIFO: @@ -91,7 +93,7 @@ int config_parse_pfifo_size( r = safe_atou32(rvalue, &fifo->limit); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -127,9 +129,11 @@ int config_parse_bfifo_size( r = qdisc_new_static(QDISC_KIND_BFIFO, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fifo = BFIFO(qdisc); @@ -142,13 +146,13 @@ int config_parse_bfifo_size( r = parse_size(rvalue, 1024, &u); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (u > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } diff --git a/src/network/tc/fq-codel.c b/src/network/tc/fq-codel.c index 721112d317..17a2915143 100644 --- a/src/network/tc/fq-codel.c +++ b/src/network/tc/fq-codel.c @@ -120,9 +120,11 @@ int config_parse_fair_queueing_controlled_delay_u32( r = qdisc_new_static(QDISC_KIND_FQ_CODEL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fqcd = FQ_CODEL(qdisc); @@ -142,7 +144,7 @@ int config_parse_fair_queueing_controlled_delay_u32( r = safe_atou32(rvalue, p); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -179,9 +181,11 @@ int config_parse_fair_queueing_controlled_delay_usec( r = qdisc_new_static(QDISC_KIND_FQ_CODEL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fqcd = FQ_CODEL(qdisc); @@ -206,7 +210,7 @@ int config_parse_fair_queueing_controlled_delay_usec( r = parse_sec(rvalue, p); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -242,9 +246,11 @@ int config_parse_fair_queueing_controlled_delay_bool( r = qdisc_new_static(QDISC_KIND_FQ_CODEL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fqcd = FQ_CODEL(qdisc); @@ -257,7 +263,7 @@ int config_parse_fair_queueing_controlled_delay_bool( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -296,9 +302,11 @@ int config_parse_fair_queueing_controlled_delay_size( r = qdisc_new_static(QDISC_KIND_FQ_CODEL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fqcd = FQ_CODEL(qdisc); @@ -321,13 +329,13 @@ int config_parse_fair_queueing_controlled_delay_size( r = parse_size(rvalue, 1024, &sz); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (sz >= UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Specified '%s=' is too large, ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/fq.c b/src/network/tc/fq.c index f717dc790c..d3218203b9 100644 --- a/src/network/tc/fq.c +++ b/src/network/tc/fq.c @@ -128,9 +128,11 @@ int config_parse_fair_queueing_u32( r = qdisc_new_static(QDISC_KIND_FQ, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fq = FQ(qdisc); @@ -154,7 +156,7 @@ int config_parse_fair_queueing_u32( r = safe_atou32(rvalue, p); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -192,9 +194,11 @@ int config_parse_fair_queueing_size( r = qdisc_new_static(QDISC_KIND_FQ, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fq = FQ(qdisc); @@ -214,13 +218,13 @@ int config_parse_fair_queueing_size( r = parse_size(rvalue, 1024, &sz); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (sz > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Specified '%s=' is too large, ignoring assignment: %s", lvalue, rvalue); return 0; @@ -257,9 +261,11 @@ int config_parse_fair_queueing_bool( r = qdisc_new_static(QDISC_KIND_FQ, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fq = FQ(qdisc); @@ -272,7 +278,7 @@ int config_parse_fair_queueing_bool( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -310,9 +316,11 @@ int config_parse_fair_queueing_usec( r = qdisc_new_static(QDISC_KIND_FQ, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fq = FQ(qdisc); @@ -325,13 +333,13 @@ int config_parse_fair_queueing_usec( r = parse_sec(rvalue, &sec); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (sec > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Specified '%s=' is too large, ignoring assignment: %s", lvalue, rvalue); return 0; @@ -369,9 +377,11 @@ int config_parse_fair_queueing_max_rate( r = qdisc_new_static(QDISC_KIND_FQ, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } fq = FQ(qdisc); @@ -384,13 +394,13 @@ int config_parse_fair_queueing_max_rate( r = parse_size(rvalue, 1000, &sz); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (sz / 8 > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Specified '%s=' is too large, ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/gred.c b/src/network/tc/gred.c index cca32c30a7..5629ecd01a 100644 --- a/src/network/tc/gred.c +++ b/src/network/tc/gred.c @@ -93,9 +93,11 @@ int config_parse_generic_random_early_detection_u32( r = qdisc_new_static(QDISC_KIND_GRED, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } gred = GRED(qdisc); @@ -115,14 +117,14 @@ int config_parse_generic_random_early_detection_u32( r = safe_atou32(rvalue, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (v > MAX_DPs) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, rvalue); } @@ -157,9 +159,11 @@ int config_parse_generic_random_early_detection_bool( r = qdisc_new_static(QDISC_KIND_GRED, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } gred = GRED(qdisc); @@ -172,7 +176,7 @@ int config_parse_generic_random_early_detection_bool( r = parse_boolean(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/hhf.c b/src/network/tc/hhf.c index a9d0bdad2f..324a975aa8 100644 --- a/src/network/tc/hhf.c +++ b/src/network/tc/hhf.c @@ -63,9 +63,11 @@ int config_parse_heavy_hitter_filter_packet_limit( r = qdisc_new_static(QDISC_KIND_HHF, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } hhf = HHF(qdisc); @@ -78,7 +80,7 @@ int config_parse_heavy_hitter_filter_packet_limit( r = safe_atou32(rvalue, &hhf->packet_limit); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/htb.c b/src/network/tc/htb.c index 227d6233e7..65481a76bc 100644 --- a/src/network/tc/htb.c +++ b/src/network/tc/htb.c @@ -69,9 +69,11 @@ int config_parse_hierarchy_token_bucket_default_class( r = qdisc_new_static(QDISC_KIND_HTB, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } htb = HTB(qdisc); @@ -84,7 +86,7 @@ int config_parse_hierarchy_token_bucket_default_class( r = safe_atou32_full(rvalue, 16, &htb->default_class); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -120,9 +122,11 @@ int config_parse_hierarchy_token_bucket_u32( r = qdisc_new_static(QDISC_KIND_HTB, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } htb = HTB(qdisc); @@ -135,7 +139,7 @@ int config_parse_hierarchy_token_bucket_u32( r = safe_atou32(rvalue, &htb->rate_to_quantum); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -258,9 +262,13 @@ int config_parse_hierarchy_token_bucket_class_u32( assert(data); r = tclass_new_static(TCLASS_KIND_HTB, network, filename, section_line, &tclass); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to create traffic control class, ignoring assignment: %m"); + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } htb = TCLASS_TO_HTB(tclass); @@ -272,7 +280,7 @@ int config_parse_hierarchy_token_bucket_class_u32( r = safe_atou32(rvalue, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -308,9 +316,13 @@ int config_parse_hierarchy_token_bucket_class_size( assert(data); r = tclass_new_static(TCLASS_KIND_HTB, network, filename, section_line, &tclass); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to create traffic control class, ignoring assignment: %m"); + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } htb = TCLASS_TO_HTB(tclass); @@ -334,13 +346,13 @@ int config_parse_hierarchy_token_bucket_class_size( r = parse_size(rvalue, 1024, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if ((streq(lvalue, "OverheadBytes") && v > UINT16_MAX) || v > UINT32_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -388,9 +400,13 @@ int config_parse_hierarchy_token_bucket_class_rate( assert(data); r = tclass_new_static(TCLASS_KIND_HTB, network, filename, section_line, &tclass); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to create traffic control class, ignoring assignment: %m"); + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } htb = TCLASS_TO_HTB(tclass); if (streq(lvalue, "Rate")) @@ -409,7 +425,7 @@ int config_parse_hierarchy_token_bucket_class_rate( r = parse_size(rvalue, 1000, v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/netem.c b/src/network/tc/netem.c index 7d0add9e30..a94a9a369e 100644 --- a/src/network/tc/netem.c +++ b/src/network/tc/netem.c @@ -80,9 +80,11 @@ int config_parse_network_emulator_delay( r = qdisc_new_static(QDISC_KIND_NETEM, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } ne = NETEM(qdisc); @@ -98,7 +100,7 @@ int config_parse_network_emulator_delay( r = parse_sec(rvalue, &u); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -140,9 +142,11 @@ int config_parse_network_emulator_rate( r = qdisc_new_static(QDISC_KIND_NETEM, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } ne = NETEM(qdisc); @@ -158,7 +162,7 @@ int config_parse_network_emulator_rate( r = parse_tc_percent(rvalue, &rate); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -198,9 +202,11 @@ int config_parse_network_emulator_packet_limit( r = qdisc_new_static(QDISC_KIND_NETEM, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } ne = NETEM(qdisc); @@ -213,7 +219,7 @@ int config_parse_network_emulator_packet_limit( r = safe_atou(rvalue, &ne->limit); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/pie.c b/src/network/tc/pie.c index a0d21de8ba..eccbaa2cf5 100644 --- a/src/network/tc/pie.c +++ b/src/network/tc/pie.c @@ -62,9 +62,11 @@ int config_parse_pie_packet_limit( r = qdisc_new_static(QDISC_KIND_PIE, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } pie = PIE(qdisc); @@ -77,7 +79,7 @@ int config_parse_pie_packet_limit( r = safe_atou32(rvalue, &pie->packet_limit); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/qdisc.c b/src/network/tc/qdisc.c index c2b6c1de2f..e1262c1284 100644 --- a/src/network/tc/qdisc.c +++ b/src/network/tc/qdisc.c @@ -288,8 +288,13 @@ int config_parse_qdisc_parent( assert(data); r = qdisc_new_static(ltype, network, filename, section_line, &qdisc); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } if (streq(rvalue, "root")) { qdisc->parent = TC_H_ROOT; @@ -304,7 +309,7 @@ int config_parse_qdisc_parent( } else { r = parse_handle(rvalue, &qdisc->parent); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 'Parent=', ignoring assignment: %s", rvalue); return 0; @@ -346,8 +351,13 @@ int config_parse_qdisc_handle( assert(data); r = qdisc_new_static(ltype, network, filename, section_line, &qdisc); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } if (isempty(rvalue)) { qdisc->handle = TC_H_UNSPEC; @@ -357,7 +367,7 @@ int config_parse_qdisc_handle( r = safe_atou16_full(rvalue, 16, &n); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 'Handle=', ignoring assignment: %s", rvalue); return 0; diff --git a/src/network/tc/qfq.c b/src/network/tc/qfq.c index 52c17625bf..2104067f3b 100644 --- a/src/network/tc/qfq.c +++ b/src/network/tc/qfq.c @@ -73,9 +73,13 @@ int config_parse_quick_fair_queueing_weight( assert(data); r = tclass_new_static(TCLASS_KIND_QFQ, network, filename, section_line, &tclass); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to create traffic control class, ignoring assignment: %m"); + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } qfq = TCLASS_TO_QFQ(tclass); @@ -87,14 +91,14 @@ int config_parse_quick_fair_queueing_weight( r = safe_atou32(rvalue, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (v == 0 || v > QFQ_MAX_WEIGHT) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -130,9 +134,13 @@ int config_parse_quick_fair_queueing_max_packet( assert(data); r = tclass_new_static(TCLASS_KIND_QFQ, network, filename, section_line, &tclass); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "Failed to create traffic control class, ignoring assignment: %m"); + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } qfq = TCLASS_TO_QFQ(tclass); @@ -144,14 +152,14 @@ int config_parse_quick_fair_queueing_max_packet( r = parse_size(rvalue, 1024, &v); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (v < QFQ_MIN_MAX_PACKET || v > QFQ_MAX_MAX_PACKET) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Invalid '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/sfb.c b/src/network/tc/sfb.c index 9e954ff935..3692a50ed8 100644 --- a/src/network/tc/sfb.c +++ b/src/network/tc/sfb.c @@ -73,9 +73,11 @@ int config_parse_stochastic_fair_blue_u32( r = qdisc_new_static(QDISC_KIND_SFB, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } sfb = SFB(qdisc); @@ -88,7 +90,7 @@ int config_parse_stochastic_fair_blue_u32( r = safe_atou32(rvalue, &sfb->packet_limit); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/sfq.c b/src/network/tc/sfq.c index ee66409b94..d671281c46 100644 --- a/src/network/tc/sfq.c +++ b/src/network/tc/sfq.c @@ -56,9 +56,11 @@ int config_parse_stochastic_fairness_queueing_perturb_period( r = qdisc_new_static(QDISC_KIND_SFQ, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } sfq = SFQ(qdisc); @@ -71,7 +73,7 @@ int config_parse_stochastic_fairness_queueing_perturb_period( r = parse_sec(rvalue, &sfq->perturb_period); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/tbf.c b/src/network/tc/tbf.c index 2c730352d2..cb3c3bcc15 100644 --- a/src/network/tc/tbf.c +++ b/src/network/tc/tbf.c @@ -136,9 +136,11 @@ int config_parse_token_bucket_filter_size( r = qdisc_new_static(QDISC_KIND_TBF, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } tbf = TBF(qdisc); @@ -160,7 +162,7 @@ int config_parse_token_bucket_filter_size( r = parse_size(rvalue, 1024, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -208,9 +210,11 @@ int config_parse_token_bucket_filter_rate( r = qdisc_new_static(QDISC_KIND_TBF, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } tbf = TBF(qdisc); if (streq(lvalue, "Rate")) @@ -229,7 +233,7 @@ int config_parse_token_bucket_filter_rate( r = parse_size(rvalue, 1000, &k); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; @@ -268,9 +272,11 @@ int config_parse_token_bucket_filter_latency( r = qdisc_new_static(QDISC_KIND_TBF, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } tbf = TBF(qdisc); @@ -283,7 +289,7 @@ int config_parse_token_bucket_filter_latency( r = parse_sec(rvalue, &u); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; diff --git a/src/network/tc/tclass.c b/src/network/tc/tclass.c index a89e7757ad..9a39713b32 100644 --- a/src/network/tc/tclass.c +++ b/src/network/tc/tclass.c @@ -214,15 +214,20 @@ int config_parse_tclass_parent( assert(data); r = tclass_new_static(ltype, network, filename, section_line, &tclass); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } if (streq(rvalue, "root")) tclass->parent = TC_H_ROOT; else { r = parse_handle(rvalue, &tclass->parent); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 'Parent=', ignoring assignment: %s", rvalue); return 0; @@ -256,8 +261,13 @@ int config_parse_tclass_classid( assert(data); r = tclass_new_static(ltype, network, filename, section_line, &tclass); - if (r < 0) - return r; + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to create traffic control class, ignoring assignment: %m"); + return 0; + } if (isempty(rvalue)) { tclass->classid = TC_H_UNSPEC; @@ -267,7 +277,7 @@ int config_parse_tclass_classid( r = parse_handle(rvalue, &tclass->classid); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 'ClassId=', ignoring assignment: %s", rvalue); return 0; diff --git a/src/network/tc/teql.c b/src/network/tc/teql.c index aac9499616..bc64860a35 100644 --- a/src/network/tc/teql.c +++ b/src/network/tc/teql.c @@ -57,9 +57,11 @@ int config_parse_trivial_link_equalizer_id( r = qdisc_new_static(QDISC_KIND_TEQL, network, filename, section_line, &qdisc); if (r == -ENOMEM) return log_oom(); - if (r < 0) - return log_syntax(unit, LOG_ERR, filename, line, r, - "More than one kind of queueing discipline, ignoring assignment: %m"); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "More than one kind of queueing discipline, ignoring assignment: %m"); + return 0; + } teql = TEQL(qdisc); @@ -72,13 +74,13 @@ int config_parse_trivial_link_equalizer_id( r = safe_atou(rvalue, &id); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse '%s=', ignoring assignment: %s", lvalue, rvalue); return 0; } if (id > INT_MAX) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "'%s=' is too large, ignoring assignment: %s", lvalue, rvalue); } diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 0a59f19e2a..0fec79f3d7 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -548,7 +548,7 @@ int config_parse_iec_size(const char* unit, if (r >= 0 && (uint64_t) (size_t) v != v) r = -ERANGE; if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value '%s', ignoring: %m", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse size value '%s', ignoring: %m", rvalue); return 0; } @@ -577,10 +577,8 @@ int config_parse_si_uint64( assert(data); r = parse_size(rvalue, 1000, sz); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value '%s', ignoring: %m", rvalue); - return 0; - } + if (r < 0) + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse size value '%s', ignoring: %m", rvalue); return 0; } @@ -607,7 +605,7 @@ int config_parse_iec_uint64( r = parse_size(rvalue, 1024, bytes); if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse size value, ignoring: %s", rvalue); return 0; } @@ -634,7 +632,7 @@ int config_parse_bool(const char* unit, k = parse_boolean(rvalue); if (k < 0) { - log_syntax(unit, LOG_ERR, filename, line, k, + log_syntax(unit, fatal ? LOG_ERR : LOG_WARNING, filename, line, k, "Failed to parse boolean value%s: %s", fatal ? "" : ", ignoring", rvalue); return fatal ? -ENOEXEC : 0; @@ -664,10 +662,15 @@ int config_parse_id128( assert(rvalue); r = sd_id128_from_string(rvalue, &t); - if (r < 0) - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue); - else if (sd_id128_is_null(t)) - log_syntax(unit, LOG_ERR, filename, line, 0, "128bit ID/UUID is all 0, ignoring: %s", rvalue); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse 128bit ID/UUID, ignoring: %s", rvalue); + return 0; + } + + if (sd_id128_is_null(t)) { + log_syntax(unit, LOG_WARNING, filename, line, 0, "128bit ID/UUID is all 0, ignoring: %s", rvalue); + return 0; + } *result = t; return 0; @@ -698,7 +701,7 @@ int config_parse_tristate( k = parse_boolean(rvalue); if (k < 0) { - log_syntax(unit, LOG_ERR, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, k, "Failed to parse boolean value, ignoring: %s", rvalue); return 0; } @@ -793,25 +796,23 @@ int config_parse_strv( return 0; } - for (;;) { + for (const char *p = rvalue;;) { char *word = NULL; - r = extract_first_word(&rvalue, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE); + r = extract_first_word(&p, &word, NULL, EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE); if (r == 0) - break; + return 0; if (r == -ENOMEM) return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue); - break; + log_syntax(unit, LOG_WARNING, filename, line, r, "Invalid syntax, ignoring: %s", rvalue); + return 0; } r = strv_consume(sv, word); if (r < 0) return log_oom(); } - - return 0; } int config_parse_warn_compat( @@ -870,7 +871,7 @@ int config_parse_log_facility( x = log_facility_unshifted_from_string(rvalue); if (x < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse log facility, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse log facility, ignoring: %s", rvalue); return 0; } @@ -900,7 +901,7 @@ int config_parse_log_level( x = log_level_from_string(rvalue); if (x < 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse log level, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse log level, ignoring: %s", rvalue); return 0; } @@ -933,7 +934,7 @@ int config_parse_signal( r = signal_from_string(rvalue); if (r <= 0) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse signal name, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse signal name, ignoring: %s", rvalue); return 0; } @@ -965,7 +966,7 @@ int config_parse_personality( else { p = personality_from_string(rvalue); if (p == PERSONALITY_INVALID) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse personality, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse personality, ignoring: %s", rvalue); return 0; } } @@ -1000,7 +1001,7 @@ int config_parse_ifname( } if (!ifname_valid(rvalue)) { - log_syntax(unit, LOG_ERR, filename, line, 0, "Interface name is not valid or too long, ignoring assignment: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, 0, "Interface name is not valid or too long, ignoring assignment: %s", rvalue); return 0; } @@ -1025,7 +1026,6 @@ int config_parse_ifnames( _cleanup_strv_free_ char **names = NULL; char ***s = data; - const char *p; int r; assert(filename); @@ -1038,13 +1038,14 @@ int config_parse_ifnames( return 0; } - p = rvalue; - for (;;) { + for (const char *p = rvalue;;) { _cleanup_free_ char *word = NULL; r = extract_first_word(&p, &word, NULL, 0); + if (r == -ENOMEM) + return log_oom(); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to extract interface name, ignoring assignment: %s", rvalue); return 0; @@ -1053,7 +1054,7 @@ int config_parse_ifnames( break; if (!ifname_valid_full(word, ltype)) { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Interface name is not valid or too long, ignoring assignment: %s", word); continue; @@ -1099,7 +1100,7 @@ int config_parse_ip_port( r = parse_ip_port(rvalue, &port); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse port '%s'.", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse port '%s'.", rvalue); return 0; } @@ -1128,14 +1129,14 @@ int config_parse_mtu( r = parse_mtu(ltype, rvalue, mtu); if (r == -ERANGE) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Maximum transfer unit (MTU) value out of range. Permitted range is %" PRIu32 "…%" PRIu32 ", ignoring: %s", (uint32_t) (ltype == AF_INET6 ? IPV6_MIN_MTU : IPV4_MIN_MTU), (uint32_t) UINT32_MAX, rvalue); return 0; } if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse MTU value '%s', ignoring: %m", rvalue); return 0; } @@ -1167,7 +1168,7 @@ int config_parse_rlimit( return 0; } if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse resource value, ignoring: %s", rvalue); + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse resource value, ignoring: %s", rvalue); return 0; } @@ -1203,7 +1204,7 @@ int config_parse_permille(const char* unit, r = parse_permille(rvalue); if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, + log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse permille value, ignoring: %s", rvalue); return 0; } @@ -1237,7 +1238,7 @@ int config_parse_vlanprotocol(const char* unit, else if (STR_IN_SET(rvalue, "802.1q", "802.1Q")) *vlan_protocol = ETH_P_8021Q; else { - log_syntax(unit, LOG_ERR, filename, line, 0, + log_syntax(unit, LOG_WARNING, filename, line, 0, "Failed to parse VLAN protocol value, ignoring: %s", rvalue); return 0; } diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h index 0eaff0c0e0..7c9f5531b0 100644 --- a/src/shared/conf-parser.h +++ b/src/shared/conf-parser.h @@ -165,7 +165,7 @@ typedef enum Disabled { \ r = parser(rvalue); \ if (r < 0) { \ - log_syntax(unit, LOG_ERR, filename, line, r, \ + log_syntax(unit, LOG_WARNING, filename, line, r, \ msg ", ignoring: %s", rvalue); \ return 0; \ } \ @@ -186,7 +186,7 @@ typedef enum Disabled { \ r = parser(rvalue, i); \ if (r < 0) \ - log_syntax(unit, LOG_ERR, filename, line, r, \ + log_syntax(unit, LOG_WARNING, filename, line, r, \ msg ", ignoring: %s", rvalue); \ \ return 0; \ @@ -203,7 +203,7 @@ typedef enum Disabled { \ x = name##_from_string(rvalue); \ if (x < 0) { \ - log_syntax(unit, LOG_ERR, filename, line, 0, \ + log_syntax(unit, LOG_WARNING, filename, line, 0, \ msg ", ignoring: %s", rvalue); \ return 0; \ } \ @@ -228,7 +228,7 @@ typedef enum Disabled { \ x = name##_from_string(rvalue); \ if (x < 0) { \ - log_syntax(unit, LOG_ERR, filename, line, 0, \ + log_syntax(unit, LOG_WARNING, filename, line, 0, \ msg ", ignoring: %s", rvalue); \ return 0; \ } \ @@ -261,10 +261,10 @@ typedef enum Disabled { \ en = strndup(word, l); \ if (!en) \ - return -ENOMEM; \ + return log_oom(); \ \ if ((x = name##_from_string(en)) < 0) { \ - log_syntax(unit, LOG_ERR, filename, line, 0, \ + log_syntax(unit, LOG_WARNING, filename, line, 0, \ msg ", ignoring: %s", en); \ continue; \ } \ @@ -287,7 +287,7 @@ typedef enum Disabled { if (new_xs) \ xs = new_xs; \ else \ - return -ENOMEM; \ + return log_oom(); \ \ *(xs + i) = invalid; \ } \ |