diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2023-03-27 19:35:26 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-03-29 13:48:12 +0200 |
commit | 98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57 (patch) | |
tree | c930cd7a516058ea162391a081fa7ad15c9f3cf6 /conf.c | |
parent | 33d88f79d920699be5162e1f5d6901da0c02b005 (diff) | |
download | passt-98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57.tar passt-98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57.tar.gz passt-98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57.tar.bz2 passt-98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57.tar.lz passt-98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57.tar.xz passt-98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57.tar.zst passt-98a9a7d9e59f50f4b42e0dd7f52f45241ac60a57.zip |
conf: Allow binding to ports on an interface without a specific address
Somebody might want to bind listening sockets to a specific
interface, but not a specific address, and there isn't really a
reason to prevent that. For example:
-t %eth0/2022
Alternatively, we support options such as -t 0.0.0.0%eth0/2022 and
-t ::%eth0/2022, but not together, for the same port.
Enable this kind of syntax and add examples to the man page.
Reported-by: Paul Holzinger <pholzing@redhat.com>
Link: https://github.com/containers/podman/issues/14425#issuecomment-1485192195
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -263,7 +263,9 @@ static void conf_ports(const struct ctx *c, char optname, const char *optarg, ifname++; } - if (inet_pton(AF_INET, buf, addr)) + if (ifname == buf + 1) /* Interface without address */ + addr = NULL; + else if (inet_pton(AF_INET, buf, addr)) af = AF_INET; else if (inet_pton(AF_INET6, buf, addr)) af = AF_INET6; |