This commit is contained in:
Tristan B. Velloza Kildaire 2024-12-15 19:24:15 +02:00
parent 1c2b9858c6
commit c6585c242e
2 changed files with 15 additions and 2 deletions

16
TAP.c
View File

@ -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));

View File

@ -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;