diff --git a/TAP.c b/TAP.c index 50fdbc4..81ac378 100644 --- a/TAP.c +++ b/TAP.c @@ -6,7 +6,7 @@ extern bool verbose; extern bool noipv6; extern bool set_ipv4; extern bool set_ipv6; -extern bool link_local_v6; +extern bool set_linklocal; extern bool set_netmask; extern bool noup; extern int mtu; @@ -241,7 +241,7 @@ int open_tap(void) { } } - if(set_ipv6) + if(set_ipv6 || set_linklocal) { // Firstly, obtain the interface index by `ifr_name` int inet6 = socket(AF_INET6, SOCK_DGRAM, 0); @@ -260,6 +260,18 @@ int open_tap(void) { exit(1); } + // if link-local was NOT requested and interface + // has been up'd -> then kernel would have added + // a link-local already, this removes it + if(!set_linklocal & !noup) + { + // TODO: Get all addresses that start with fe80 + } + // Else it could have been no-up; hence you will have to remove + // the link-local yourself + // Other else is link-local was requested, then we don't care (whether + // up'd or not as it will inevitably be added by the kernel) + // Convert ASCII IPv6 address to ABI structure struct in6_addr six_addr_itself; memset(&six_addr_itself, 0, sizeof(struct in6_addr)); diff --git a/tncattach.c b/tncattach.c index 92bd6ac..ab5772c 100644 --- a/tncattach.c +++ b/tncattach.c @@ -35,6 +35,7 @@ bool noup = false; bool daemonize = false; bool set_ipv4 = false; bool set_ipv6 = false; +bool set_linklocal = false; bool set_netmask = false; bool kiss_over_tcp = false; char* ipv4_addr;