assert(items);
- r = sd_bus_message_open_container(reply, 'a', "(iqq)");
+ r = sd_bus_message_open_container(reply, 'a', "(iiqq)");
if (r < 0)
return r;
LIST_FOREACH(socket_bind_items, i, *items) {
- r = sd_bus_message_append(reply, "(iqq)", i->address_family, i->nr_ports, i->port_min);
+ r = sd_bus_message_append(reply, "(iiqq)", i->address_family, i->ip_protocol, i->nr_ports, i->port_min);
if (r < 0)
return r;
}
SD_BUS_PROPERTY("ManagedOOMMemoryPressureLimit", "u", NULL, offsetof(CGroupContext, moom_mem_pressure_limit), 0),
SD_BUS_PROPERTY("ManagedOOMPreference", "s", property_get_managed_oom_preference, offsetof(CGroupContext, moom_preference), 0),
SD_BUS_PROPERTY("BPFProgram", "a(ss)", property_get_bpf_foreign_program, 0, 0),
- SD_BUS_PROPERTY("SocketBindAllow", "a(iqq)", property_get_socket_bind, offsetof(CGroupContext, socket_bind_allow), 0),
- SD_BUS_PROPERTY("SocketBindDeny", "a(iqq)", property_get_socket_bind, offsetof(CGroupContext, socket_bind_deny), 0),
+ SD_BUS_PROPERTY("SocketBindAllow", "a(iiqq)", property_get_socket_bind, offsetof(CGroupContext, socket_bind_allow), 0),
+ SD_BUS_PROPERTY("SocketBindDeny", "a(iiqq)", property_get_socket_bind, offsetof(CGroupContext, socket_bind_deny), 0),
SD_BUS_VTABLE_END
};
CGroupSocketBindItem **list;
uint16_t nr_ports, port_min;
size_t n = 0;
- int family;
+ int32_t family, ip_protocol;
list = streq(name, "SocketBindAllow") ? &c->socket_bind_allow : &c->socket_bind_deny;
- r = sd_bus_message_enter_container(message, 'a', "(iqq)");
+ r = sd_bus_message_enter_container(message, 'a', "(iiqq)");
if (r < 0)
return r;
- while ((r = sd_bus_message_read(message, "(iqq)", &family, &nr_ports, &port_min)) > 0) {
+ while ((r = sd_bus_message_read(message, "(iiqq)", &family, &ip_protocol, &nr_ports, &port_min)) > 0) {
if (!IN_SET(family, AF_UNSPEC, AF_INET, AF_INET6))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects INET or INET6 family, if specified.", name);
+ if (ip_protocol != 0)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects ip protocol equals to 0, for the time being.", name);
+
if (port_min + (uint32_t) nr_ports > (1 << 16))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "%s= expects maximum port value lesser than 65536.", name);
*item = (CGroupSocketBindItem) {
.address_family = family,
+ .ip_protocol = ip_protocol,
.nr_ports = nr_ports,
.port_min = port_min
};
if (STR_IN_SET(field, "SocketBindAllow",
"SocketBindDeny")) {
if (isempty(eq))
- r = sd_bus_message_append(m, "(sv)", field, "a(iqq)", 0);
+ r = sd_bus_message_append(m, "(sv)", field, "a(iiqq)", 0);
else {
+ /* No ip protocol specified for now. */
+ int32_t family = AF_UNSPEC, ip_protocol = 0;
const char *address_family, *user_port;
_cleanup_free_ char *word = NULL;
- int family = AF_UNSPEC;
r = extract_first_word(&eq, &word, ":", 0);
if (r == -ENOMEM)
user_port = eq ? eq : word;
if (streq(user_port, "any")) {
- r = sd_bus_message_append(m, "(sv)", field, "a(iqq)", 1, family, 0, 0);
+ r = sd_bus_message_append(m, "(sv)", field, "a(iiqq)", 1, family, ip_protocol, 0, 0);
if (r < 0)
return bus_log_create_error(r);
} else {
return log_error_errno(r, "Invalid port or port range: %s", user_port);
r = sd_bus_message_append(
- m, "(sv)", field, "a(iqq)", 1, family, port_max - port_min + 1, port_min);
+ m, "(sv)", field, "a(iiqq)", 1, family, ip_protocol, port_max - port_min + 1, port_min);
}
}
if (r < 0)
return 1;
} else if (STR_IN_SET(name, "SocketBindAllow", "SocketBindDeny")) {
uint16_t nr_ports, port_min;
- int af;
+ int32_t af, ip_protocol;
- r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(iqq)");
+ r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(iiqq)");
if (r < 0)
return bus_log_parse_error(r);
- while ((r = sd_bus_message_read(m, "(iqq)", &af, &nr_ports, &port_min)) > 0) {
+ while ((r = sd_bus_message_read(m, "(iiqq)", &af, &ip_protocol, &nr_ports, &port_min)) > 0) {
const char *family, *colon;
family = strempty(af_to_ipv4_ipv6(af));