mirror of
https://github.com/yarrick/iodine.git
synced 2025-12-06 04:11:45 +00:00
Add support for openbsd routing domain, #95
This commit is contained in:
committed by
Erik Ekman
parent
9c3343e6ac
commit
d4849a5dbf
10
src/iodine.c
10
src/iodine.c
@@ -136,6 +136,7 @@ main(int argc, char **argv)
|
||||
int lazymode;
|
||||
int selecttimeout;
|
||||
int hostname_maxlen;
|
||||
int rtable = 0;
|
||||
|
||||
nameserv_addr = NULL;
|
||||
topdomain = NULL;
|
||||
@@ -174,7 +175,7 @@ main(int argc, char **argv)
|
||||
__progname++;
|
||||
#endif
|
||||
|
||||
while ((choice = getopt(argc, argv, "vfhru:t:d:P:m:M:F:T:O:L:I:")) != -1) {
|
||||
while ((choice = getopt(argc, argv, "vfhru:t:d:R:P:m:M:F:T:O:L:I:")) != -1) {
|
||||
switch(choice) {
|
||||
case 'v':
|
||||
version();
|
||||
@@ -198,6 +199,9 @@ main(int argc, char **argv)
|
||||
case 'd':
|
||||
device = optarg;
|
||||
break;
|
||||
case 'R':
|
||||
rtable = atoi(optarg);
|
||||
break;
|
||||
case 'P':
|
||||
strncpy(password, optarg, sizeof(password));
|
||||
password[sizeof(password)-1] = 0;
|
||||
@@ -325,6 +329,10 @@ main(int argc, char **argv)
|
||||
retval = 1;
|
||||
goto cleanup2;
|
||||
}
|
||||
#ifdef OPENBSD
|
||||
if (rtable > 0)
|
||||
socket_setrtable(dns_fd, rtable);
|
||||
#endif
|
||||
|
||||
signal(SIGINT, sighandler);
|
||||
signal(SIGTERM, sighandler);
|
||||
|
||||
@@ -67,3 +67,11 @@ get_resolvconf_addr()
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef OPENBSD
|
||||
void
|
||||
socket_setrtable(int fd, int rtable)
|
||||
{
|
||||
if (setsockopt (fd, IPPROTO_IP, SO_RTABLE, &rtable, sizeof(rtable)) == -1)
|
||||
err(1, "Failed to set routing table %d", rtable);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
#define __UTIL_H__
|
||||
|
||||
char *get_resolvconf_addr();
|
||||
void socket_setrtable(int fd, int rtable);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user