Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update client and server to allow forwarding IPv6 packets within the tunnel #65

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed bug with initializing users structure. Wasn't allowing multiple…
… users to connect V6
chris-hellberg committed Dec 31, 2021
commit 061fac44d2246d21959120b46b07eade0538417e
20 changes: 10 additions & 10 deletions src/user.c
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ int init_users(in_addr_t my_ip, int netbits)
char newip[16];
char ip6Tmp[16];
char ip6Tmp2[18];
char ipv4Tmp[16];

int maxusers;

@@ -71,26 +70,27 @@ int init_users(in_addr_t my_ip, int netbits)
for (i = 0; i < usercount; i++) {
in_addr_t ip;
users[i].id = i;

memset(ip6Tmp,0,strlen(ip6Tmp));
memset(ip6Tmp2,0,strlen(ip6Tmp2));

snprintf(newip, sizeof(newip), "0.0.0.%d", i + skip + 1);

ip = ipstart.s_addr + inet_addr(newip);
if (ip == my_ip && skip == 0) {
/* This IP was taken by iodined */
skip++;
snprintf(newip, sizeof(newip), "0.0.0.%d", i + skip + 1);
ip = ipstart.s_addr + inet_addr(newip);

inet_ntop(AF_INET, &ip, ip6Tmp, INET_ADDRSTRLEN);

snprintf(ip6Tmp2, sizeof(ip6Tmp2), "::%s", ip6Tmp);

inet_pton(AF_INET6, ip6Tmp2, &users[i].tun_ip6);
memset(ip6Tmp2,0,strlen(ip6Tmp2));
inet_ntop(AF_INET6, &users[i].tun_ip6, ip6Tmp2, INET6_ADDRSTRLEN);
inet_ntop(AF_INET, &ip, ipv4Tmp, INET_ADDRSTRLEN);
memset(ip6Tmp2,0,strlen(ip6Tmp2));

}
users[i].tun_ip = ip;

inet_ntop(AF_INET, &ip, ip6Tmp, INET_ADDRSTRLEN);
snprintf(ip6Tmp2, sizeof(ip6Tmp2), "::%s", ip6Tmp);
inet_pton(AF_INET6, ip6Tmp2, &users[i].tun_ip6);

net.s_addr = ip;
users[i].disabled = 0;
users[i].authenticated = 0;