From: Yu Watanabe Date: Tue, 1 Feb 2022 23:25:38 +0000 (+0900) Subject: network: tunnel: reduce indentation in config_parse_encap_limit() X-Git-Tag: v251-rc1~357^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a07e07cd9c781a078b89a987cdced499507b0f72;p=thirdparty%2Fsystemd.git network: tunnel: reduce indentation in config_parse_encap_limit() --- diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf index d03a4e57846..a993e258679 100644 --- a/src/network/netdev/netdev-gperf.gperf +++ b/src/network/netdev/netdev-gperf.gperf @@ -79,7 +79,7 @@ Tunnel.DiscoverPathMTU, config_parse_bool, Tunnel.Mode, config_parse_ip6tnl_mode, 0, offsetof(Tunnel, ip6tnl_mode) Tunnel.IPv6FlowLabel, config_parse_ipv6_flowlabel, 0, 0 Tunnel.CopyDSCP, config_parse_bool, 0, offsetof(Tunnel, copy_dscp) -Tunnel.EncapsulationLimit, config_parse_encap_limit, 0, offsetof(Tunnel, encap_limit) +Tunnel.EncapsulationLimit, config_parse_encap_limit, 0, 0 Tunnel.Independent, config_parse_bool, 0, offsetof(Tunnel, independent) Tunnel.AssignToLoopback, config_parse_bool, 0, offsetof(Tunnel, assign_to_loopback) Tunnel.AllowLocalRemote, config_parse_tristate, 0, offsetof(Tunnel, allow_localremote) diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c index 8eb633549f9..a70121efdac 100644 --- a/src/network/netdev/tunnel.c +++ b/src/network/netdev/tunnel.c @@ -885,31 +885,33 @@ int config_parse_encap_limit( void *data, void *userdata) { - Tunnel *t = userdata; - int k = 0; - int r; + Tunnel *t = ASSERT_PTR(userdata); + int k, r; assert(filename); - assert(lvalue); assert(rvalue); - if (streq(rvalue, "none")) + if (streq(rvalue, "none")) { t->flags |= IP6_TNL_F_IGN_ENCAP_LIMIT; - else { - r = safe_atoi(rvalue, &k); - if (r < 0) { - log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse Tunnel Encapsulation Limit option, ignoring: %s", rvalue); - return 0; - } + t->encap_limit = 0; + return 0; + } - if (k > 255 || k < 0) - 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; - } + r = safe_atoi(rvalue, &k); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to parse Tunnel Encapsulation Limit option, ignoring assignment: %s", rvalue); + return 0; + } + + if (k > 255 || k < 0) { + log_syntax(unit, LOG_WARNING, filename, line, 0, + "Invalid Tunnel Encapsulation value, ignoring assignment: %d", k); + return 0; } + t->encap_limit = k; + t->flags &= ~IP6_TNL_F_IGN_ENCAP_LIMIT; return 0; }