aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2025-12-02 15:02:03 +1100
committerStefano Brivio <sbrivio@redhat.com>2025-12-02 23:07:08 +0100
commitf37db87f1676c821a4a3826a77bcafe29b28f80f (patch)
tree170d45ebdb9efd73bd9f5e704c2e0d852fb1b472
parent0ae7b8c21bdb6130686f6c8aead3e8ab4c0921c8 (diff)
downloadpasst-f37db87f1676c821a4a3826a77bcafe29b28f80f.tar
passt-f37db87f1676c821a4a3826a77bcafe29b28f80f.tar.gz
passt-f37db87f1676c821a4a3826a77bcafe29b28f80f.tar.bz2
passt-f37db87f1676c821a4a3826a77bcafe29b28f80f.tar.lz
passt-f37db87f1676c821a4a3826a77bcafe29b28f80f.tar.xz
passt-f37db87f1676c821a4a3826a77bcafe29b28f80f.tar.zst
passt-f37db87f1676c821a4a3826a77bcafe29b28f80f.zip
conf: More useful errors for kernels without SO_BINDTODEVICE
Before 5.7, the kernel didn't allow SO_BINDTODEVICE to be called unprivileged. That means for earlier kernels, we can't implement binding listening sockets to a specific interface (e.g. -t %eth0/80). Currently we'll generate an error on this at the point we actually attempt the SO_BINDTODEVICE setsockopt(), at which point the connection to the command line option might not be entirely clear. Use the fact we now probe for SO_BINDTODEVICE support to make a clearer error message at the time we parse the forwarding option. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--conf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/conf.c b/conf.c
index 66b9e63..43bcaf3 100644
--- a/conf.c
+++ b/conf.c
@@ -156,6 +156,12 @@ static void conf_ports_range_except(const struct ctx *c, char optname,
optname, optarg);
}
+ if (ifname && c->no_bindtodevice) {
+ die(
+"Device binding for '-%c %s' unsupported (requires kernel 5.7+)",
+ optname, optarg);
+ }
+
for (i = first; i <= last; i++) {
if (bitmap_isset(exclude, i))
continue;