mirror of
https://github.com/yarrick/iodine.git
synced 2024-12-23 05:43:32 +02:00
Linux server interfaces populated with V6 addresses
This commit is contained in:
parent
1e196bff4d
commit
16e1b731f6
3 changed files with 26 additions and 6 deletions
|
@ -372,7 +372,7 @@ int main(int argc, char **argv)
|
|||
fprintf(stderr, "Sending DNS queries for %s to %s\n",
|
||||
topdomain, format_addr(&nameservaddr, nameservaddr_len));
|
||||
|
||||
if (client_handshake(dns_fd, raw_mode, autodetect_frag_size, max_downstream_frag_size)) {
|
||||
if (client_handshake(dns_fd, raw_mode, autodetect_frag_size, max_downstream_frag_size, forward_v6)) {
|
||||
retval = 1;
|
||||
goto cleanup2;
|
||||
}
|
||||
|
|
|
@ -2437,7 +2437,7 @@ main(int argc, char **argv)
|
|||
srand(time(NULL));
|
||||
fw_query_init();
|
||||
|
||||
while ((choice = getopt(argc, argv, "46vcsfhDu:t:d:m:l:L:p:n:b:P:z:F:i:")) != -1) {
|
||||
while ((choice = getopt(argc, argv, "46vcsfhDuS:t:d:m:l:L:p:n:b:P:z:F:i:")) != -1) {
|
||||
switch(choice) {
|
||||
case '4':
|
||||
addrfamily = AF_INET;
|
||||
|
@ -2678,11 +2678,17 @@ main(int argc, char **argv)
|
|||
}
|
||||
if (!skipipconfig) {
|
||||
const char *other_ip = users_get_first_ip();
|
||||
if (tun_setip(argv[0], other_ip, netmask, forward_v6) != 0 || tun_setmtu(mtu) != 0) {
|
||||
retval = 1;
|
||||
if (tun_setip(argv[0], other_ip, netmask, forward_v6) || tun_setmtu(mtu) != 0) {
|
||||
retval = 1;
|
||||
free((void*) other_ip);
|
||||
goto cleanup;
|
||||
}
|
||||
goto cleanup;
|
||||
|
||||
}
|
||||
if ((mtu < 1280) && (forward_v6)) {
|
||||
warnx("Interface mtu of %d below the 1280 threshold needed for IPv6 tunneling.\n", mtu);
|
||||
warnx("Proceeding without IPv6 tunneling\n");
|
||||
}
|
||||
|
||||
free((void*) other_ip);
|
||||
}
|
||||
|
||||
|
|
14
src/tun.c
14
src/tun.c
|
@ -595,9 +595,11 @@ int
|
|||
tun_setip(const char *ip, const char *other_ip, int netbits, int forward_v6)
|
||||
{
|
||||
char cmdline[512];
|
||||
char v6_cmdline[512];
|
||||
int netmask;
|
||||
struct in_addr net;
|
||||
int i;
|
||||
int v6_r;
|
||||
#ifndef LINUX
|
||||
int r;
|
||||
#endif
|
||||
|
@ -630,6 +632,18 @@ tun_setip(const char *ip, const char *other_ip, int netbits, int forward_v6)
|
|||
# else
|
||||
display_ip = ip;
|
||||
# endif
|
||||
fprintf(stderr, "Setting IPv6 of %s to ::%s\n", if_name, ip);
|
||||
|
||||
snprintf(v6_cmdline, sizeof(cmdline),
|
||||
IFCONFIGPATH "ifconfig %s inet6 add ::%s/64",
|
||||
if_name,
|
||||
display_ip);
|
||||
|
||||
v6_r = system(v6_cmdline);
|
||||
|
||||
if (v6_r != 0) {
|
||||
return v6_r;
|
||||
}
|
||||
snprintf(cmdline, sizeof(cmdline),
|
||||
IFCONFIGPATH "ifconfig %s %s %s netmask %s",
|
||||
if_name,
|
||||
|
|
Loading…
Reference in a new issue