summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-30 04:57:03 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-12-02 06:13:47 +0100
commitd2b42d63c4cf63ef8dbb38db05d76ae3321d07af (patch)
tree828efcf8ba2b1ec92628a29bca6feca27ed09463 /src
parentnetwork: make IPProtocol= also accept IP protocol number (diff)
downloadsystemd-d2b42d63c4cf63ef8dbb38db05d76ae3321d07af.tar.xz
systemd-d2b42d63c4cf63ef8dbb38db05d76ae3321d07af.zip
core,run: make SocketProtocol= accept protocol name in upper case an protocol number
Diffstat (limited to 'src')
-rw-r--r--src/core/load-fragment.c9
-rw-r--r--src/shared/bus-unit-util.c4
2 files changed, 5 insertions, 8 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index e3e9b4e531..d1988190c2 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -57,13 +57,10 @@
#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");
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index a50b9f416e..625bebbe35 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -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",