]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core,run: make SocketProtocol= accept protocol name in upper case an protocol number 10992/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 30 Nov 2018 03:57:03 +0000 (04:57 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 2 Dec 2018 05:13:47 +0000 (06:13 +0100)
src/core/load-fragment.c
src/shared/bus-unit-util.c

index e3e9b4e53148837a8917b31891a62d296d3942cb..d1988190c2ad56db75fea6294e8cdd64785efcbb 100644 (file)
 #include "user-util.h"
 #include "web-util.h"
 
-static int socket_protocol_from_string(const char *s) {
+static int parse_socket_protocol(const char *s) {
         int r;
 
-        if (isempty(s))
-                return IPPROTO_IP;
-
-        r = ip_protocol_from_name(s);
+        r = parse_ip_protocol(s);
         if (r < 0)
                 return r;
         if (!IN_SET(r, IPPROTO_UDPLITE, IPPROTO_SCTP))
@@ -72,7 +69,7 @@ static int socket_protocol_from_string(const char *s) {
         return r;
 }
 
-DEFINE_CONFIG_PARSE(config_parse_socket_protocol, socket_protocol_from_string, "Failed to parse socket protocol");
+DEFINE_CONFIG_PARSE(config_parse_socket_protocol, parse_socket_protocol, "Failed to parse socket protocol");
 DEFINE_CONFIG_PARSE(config_parse_exec_secure_bits, secure_bits_from_string, "Failed to parse secure bits");
 DEFINE_CONFIG_PARSE_ENUM(config_parse_collect_mode, collect_mode, CollectMode, "Failed to parse garbage collection mode");
 DEFINE_CONFIG_PARSE_ENUM(config_parse_device_policy, cgroup_device_policy, CGroupDevicePolicy, "Failed to parse device policy");
index a50b9f416ed517ad2cbbf206aa99a30afe4502fa..625bebbe35890ebb214efc0fb78f4f44f8bdcf59 100644 (file)
@@ -103,7 +103,7 @@ DEFINE_BUS_APPEND_PARSE("i", parse_errno);
 DEFINE_BUS_APPEND_PARSE("i", sched_policy_from_string);
 DEFINE_BUS_APPEND_PARSE("i", secure_bits_from_string);
 DEFINE_BUS_APPEND_PARSE("i", signal_from_string);
-DEFINE_BUS_APPEND_PARSE("i", ip_protocol_from_name);
+DEFINE_BUS_APPEND_PARSE("i", parse_ip_protocol);
 DEFINE_BUS_APPEND_PARSE_PTR("i", int32_t, int, ioprio_parse_priority);
 DEFINE_BUS_APPEND_PARSE_PTR("i", int32_t, int, parse_nice);
 DEFINE_BUS_APPEND_PARSE_PTR("i", int32_t, int, safe_atoi);
@@ -1466,7 +1466,7 @@ static int bus_append_socket_property(sd_bus_message *m, const char *field, cons
 
         if (streq(field, "SocketProtocol"))
 
-                return bus_append_ip_protocol_from_name(m, field, eq);
+                return bus_append_parse_ip_protocol(m, field, eq);
 
         if (STR_IN_SET(field,
                        "ListenStream", "ListenDatagram", "ListenSequentialPacket", "ListenNetlink",