mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-25 19:32:09 +00:00
implement get/set_rdomain() for Linux
Not enabled, pending implementation of valid_rdomain() and autoconf glue
This commit is contained in:
parent
6eee79f9b8
commit
ce1cca39d7
@ -41,7 +41,44 @@
|
||||
* including tun/tap forwarding and routing domains.
|
||||
*/
|
||||
|
||||
#if defined(SYS_RDOMAIN_XXX)
|
||||
#if defined(SYS_RDOMAIN_LINUX) || defined(SSH_TUN_LINUX)
|
||||
#include <linux/if.h>
|
||||
#endif
|
||||
|
||||
#if defined(SYS_RDOMAIN_LINUX)
|
||||
char *
|
||||
sys_get_rdomain(int fd)
|
||||
{
|
||||
char dev[IFNAMSIZ + 1];
|
||||
socklen_t len = sizeof(dev) - 1;
|
||||
|
||||
if (getsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, dev, &len) == -1) {
|
||||
error("%s: cannot determine VRF for fd=%d : %s",
|
||||
__func__, fd, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
dev[len] = '\0';
|
||||
return strdup(dev);
|
||||
}
|
||||
|
||||
int
|
||||
sys_set_rdomain(int fd, const char *name)
|
||||
{
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
|
||||
name, strlen(name)) == -1) {
|
||||
error("%s: setsockopt(%d, SO_BINDTODEVICE, %s): %s",
|
||||
__func__, fd, name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
valid_rdomain(const char *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#elif defined(SYS_RDOMAIN_XXX)
|
||||
/* XXX examples */
|
||||
char *
|
||||
sys_get_rdomain(int fd)
|
||||
@ -84,7 +121,6 @@ sys_set_process_rdomain(const char *name)
|
||||
*/
|
||||
|
||||
#if defined(SSH_TUN_LINUX)
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
|
||||
int
|
||||
|
@ -31,14 +31,17 @@ int sys_tun_infilter(struct ssh *, struct Channel *, char *, int);
|
||||
u_char *sys_tun_outfilter(struct ssh *, struct Channel *, u_char **, size_t *);
|
||||
#endif
|
||||
|
||||
#if defined(SYS_RDOMAIN_XXX)
|
||||
#if defined(SYS_RDOMAIN_LINUX)
|
||||
# define HAVE_SYS_GET_RDOMAIN
|
||||
# define HAVE_SYS_SET_RDOMAIN
|
||||
# define HAVE_SYS_SET_PROCESS_RDOMAIN
|
||||
# define HAVE_SYS_VALID_RDOMAIN
|
||||
char *sys_get_rdomain(int fd);
|
||||
int sys_set_rdomain(int fd, const char *name);
|
||||
int valid_rdomain(const char *name);
|
||||
#endif
|
||||
|
||||
#if defined(SYS_RDOMAIN_XXX)
|
||||
# define HAVE_SYS_SET_PROCESS_RDOMAIN
|
||||
void sys_set_process_rdomain(const char *name);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user