[openssh-commits] [openssh] 01/01: basic valid_rdomain() implementation for Linux
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed Oct 25 14:10:12 AEDT 2017
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 97c5aaf925d61641d599071abb56012cde265978
Author: Damien Miller <djm at mindrot.org>
Date: Wed Oct 25 14:09:56 2017 +1100
basic valid_rdomain() implementation for Linux
---
openbsd-compat/port-net.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/openbsd-compat/port-net.c b/openbsd-compat/port-net.c
index f6e32ad4..efc9f46f 100644
--- a/openbsd-compat/port-net.c
+++ b/openbsd-compat/port-net.c
@@ -76,7 +76,22 @@ sys_set_rdomain(int fd, const char *name)
int
valid_rdomain(const char *name)
{
- return 0;
+ int fd;
+
+ /*
+ * This is a pretty crappy way to test. It would be better to
+ * check whether "name" represents a VRF device, but apparently
+ * that requires an rtnetlink transaction.
+ */
+ if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
+ return 0;
+ if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
+ name, strlen(name)) == -1) {
+ close(fd);
+ return 0;
+ }
+ close(fd);
+ return 1;
}
#elif defined(SYS_RDOMAIN_XXX)
/* XXX examples */
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list