<para><replaceable>bind-rule</replaceable> := [<replaceable>address-family</replaceable><constant>:</constant>]<replaceable>ip-ports</replaceable></para>
- <para><replaceable>address-family</replaceable> := { <constant>IPv4</constant> | <constant>IPv6</constant> }</para>
+ <para><replaceable>address-family</replaceable> := { <constant>ipv4</constant> | <constant>ipv6</constant> }</para>
<para><replaceable>ip-ports</replaceable> := { <replaceable>ip-port</replaceable> | <replaceable>ip-port-range</replaceable> |
<constant>any</constant> }</para>
<para>Examples:<programlisting>…
# Allow binding IPv6 socket addresses with a port greater than or equal to 10000.
[Service]
-SocketBindAllow=IPv6:10000-65535
+SocketBindAllow=ipv6:10000-65535
SocketBindDeny=any
…
# Allow binding IPv4 and IPv6 socket addresses with 1234 and 4321 ports.
…
# Deny binding IPv6 socket addresses.
[Service]
-SocketBindDeny=IPv6:any
+SocketBindDeny=ipv6:any
…
# Deny binding IPv4 and IPv6 socket addresses.
[Service]
}
void cgroup_context_dump_socket_bind_item(const CGroupSocketBindItem *item, FILE *f) {
- const char *family = item->address_family == AF_INET ? "IPv4:" :
- item->address_family == AF_INET6 ? "IPv6:" : "";
+ const char *family =
+ item->address_family == AF_INET ? "ipv4:" :
+ item->address_family == AF_INET6 ? "ipv6:" : "";
if (item->nr_ports == 0)
fprintf(f, " %sany", family);
}
if (rvalue) {
- if (streq(word, "IPv4"))
+ if (streq(word, "ipv4"))
af = AF_INET;
- else if (streq(word, "IPv6"))
+ else if (streq(word, "ipv6"))
af = AF_INET6;
else {
log_syntax(unit, LOG_WARNING, filename, line, 0,
- "Only IPv4 and IPv6 protocols are supported, ignoring.");
+ "Only \"ipv4\" and \"ipv6\" protocols are supported, ignoring.");
return 0;
}
address_family = eq ? word : NULL;
if (address_family) {
- if (!STR_IN_SET(address_family, "IPv4", "IPv6"))
- return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "Only IPv4 and IPv6 protocols are supported");
-
- if (streq(address_family, "IPv4"))
+ if (streq(address_family, "ipv4"))
family = AF_INET;
- else
+ else if (streq(address_family, "ipv6"))
family = AF_INET6;
+ else
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Only \"ipv4\" and \"ipv6\" protocols are supported");
}
user_port = eq ? eq : word;
if (r < 0)
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(m, "(iqq)", &af, &nr_ports, &port_min)) > 0) {
- family = af == AF_INET ? "IPv4:" : af == AF_INET6 ? "IPv6:" : "";
+ family = af == AF_INET ? "ipv4:" : af == AF_INET6 ? "ipv6:" : "";
if (nr_ports == 0)
bus_print_property_valuef(name, expected_value, flags, "%sany", family);
else if (nr_ports == 1)
assert_se(manager_startup(m, NULL, NULL) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "2000", STRV_MAKE("2000"), STRV_MAKE("any")) >= 0);
- assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "2000", STRV_MAKE("IPv6:2001-2002"), STRV_MAKE("any")) >= 0);
- assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "6666", STRV_MAKE("IPv4:6666", "6667"), STRV_MAKE("any")) >= 0);
+ assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "2000", STRV_MAKE("ipv6:2001-2002"), STRV_MAKE("any")) >= 0);
+ assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "6666", STRV_MAKE("ipv4:6666", "6667"), STRV_MAKE("any")) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "6666", STRV_MAKE("6667", "6668", ""), STRV_MAKE("any")) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "7777", STRV_MAKE_EMPTY, STRV_MAKE_EMPTY) >= 0);
assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "8888", STRV_MAKE("any"), STRV_MAKE("any")) >= 0);