summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-04-27 12:52:30 +0200
committerGitHub <noreply@github.com>2021-04-27 12:52:30 +0200
commit862e01d70fd0d689d67a8c7cb003dfd87b62ae09 (patch)
treeeba30fefd17d32dcba93c67dfa1e56666cb45cb5 /src/systemctl
parent1ceaad69378272c64da4ecaab0d59ebb7a92ca0a (diff)
parent7dc1707aabc3a788f15beb2eec1b4dcfaeec2b47 (diff)
downloadsystemd-862e01d70fd0d689d67a8c7cb003dfd87b62ae09.tar.gz
Merge pull request #17655 from wat-ze-hex/bpf-build-rule
Introduce SocketBind{Allow|Deny}= properties powered by source compiled BPF
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl-show.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c
index dc45de4b3d..37b1672d5d 100644
--- a/src/systemctl/systemctl-show.c
+++ b/src/systemctl/systemctl-show.c
@@ -1713,6 +1713,34 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
return bus_log_parse_error(r);
return 1;
+ } else if (STR_IN_SET(name, "SocketBindAllow", "SocketBindDeny")) {
+ uint16_t nr_ports, port_min;
+ const char *family;
+ int af;
+
+ r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(iqq)");
+ 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:" : "";
+ if (nr_ports == 0)
+ bus_print_property_valuef(name, expected_value, value, "%sany", family);
+ else if (nr_ports == 1)
+ bus_print_property_valuef(
+ name, expected_value, value, "%s%hu", family, port_min);
+ else
+ bus_print_property_valuef(
+ name, expected_value, value, "%s%hu-%hu", family, port_min,
+ (uint16_t) (port_min + nr_ports - 1));
+ }
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ return 1;
}
break;