summaryrefslogtreecommitdiff
path: root/src/shared/socket-netlink.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-03 15:33:25 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-10 00:46:44 +0200
commita07ab56a4975f1159fd466530f150bfd2230f83c (patch)
tree793febe4e8ccfbecd9a81f107b1dceb05ca3f47a /src/shared/socket-netlink.c
parentc4c6ee3a959f0f082f232790677709e01b862fa9 (diff)
downloadsystemd-a07ab56a4975f1159fd466530f150bfd2230f83c.tar.gz
Allow interface scopes to be specified in ListenStream=
Closes #12624. The formatting in systemd.socket.xml is updated a bit. Currently in_addr_port_ifindex_name_to_string() always prints the ifindex numerically. This is not super useful since the interface numbers are semi-random. Should we use interface names in preference?
Diffstat (limited to 'src/shared/socket-netlink.c')
-rw-r--r--src/shared/socket-netlink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/socket-netlink.c b/src/shared/socket-netlink.c
index 198892b007..0ecbf7dee0 100644
--- a/src/shared/socket-netlink.c
+++ b/src/shared/socket-netlink.c
@@ -157,9 +157,9 @@ int socket_address_parse(SocketAddress *a, const char *s) {
} else {
union in_addr_union address;
- int family;
+ int family, ifindex;
- r = in_addr_port_ifindex_name_from_string_auto(s, &family, &address, &port, NULL, NULL);
+ r = in_addr_port_ifindex_name_from_string_auto(s, &family, &address, &port, &ifindex, NULL);
if (r < 0)
return r;
@@ -181,6 +181,7 @@ int socket_address_parse(SocketAddress *a, const char *s) {
.sin6_family = AF_INET6,
.sin6_addr = address.in6,
.sin6_port = htobe16(port),
+ .sin6_scope_id = ifindex,
},
.size = sizeof(struct sockaddr_in6),
};