diff options
Diffstat (limited to 'openbsd-compat/port-net.c')
-rw-r--r-- | openbsd-compat/port-net.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/openbsd-compat/port-net.c b/openbsd-compat/port-net.c index f6e32ad49..efc9f46fb 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) | |||
76 | int | 76 | int |
77 | valid_rdomain(const char *name) | 77 | valid_rdomain(const char *name) |
78 | { | 78 | { |
79 | return 0; | 79 | int fd; |
80 | |||
81 | /* | ||
82 | * This is a pretty crappy way to test. It would be better to | ||
83 | * check whether "name" represents a VRF device, but apparently | ||
84 | * that requires an rtnetlink transaction. | ||
85 | */ | ||
86 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) | ||
87 | return 0; | ||
88 | if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, | ||
89 | name, strlen(name)) == -1) { | ||
90 | close(fd); | ||
91 | return 0; | ||
92 | } | ||
93 | close(fd); | ||
94 | return 1; | ||
80 | } | 95 | } |
81 | #elif defined(SYS_RDOMAIN_XXX) | 96 | #elif defined(SYS_RDOMAIN_XXX) |
82 | /* XXX examples */ | 97 | /* XXX examples */ |