mirror of
https://github.com/markqvist/tncattach.git
synced 2025-09-03 05:27:47 -04:00
Work
This commit is contained in:
parent
1c2b9858c6
commit
c6585c242e
16
TAP.c
16
TAP.c
@ -6,7 +6,7 @@ extern bool verbose;
|
|||||||
extern bool noipv6;
|
extern bool noipv6;
|
||||||
extern bool set_ipv4;
|
extern bool set_ipv4;
|
||||||
extern bool set_ipv6;
|
extern bool set_ipv6;
|
||||||
extern bool link_local_v6;
|
extern bool set_linklocal;
|
||||||
extern bool set_netmask;
|
extern bool set_netmask;
|
||||||
extern bool noup;
|
extern bool noup;
|
||||||
extern int mtu;
|
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`
|
// Firstly, obtain the interface index by `ifr_name`
|
||||||
int inet6 = socket(AF_INET6, SOCK_DGRAM, 0);
|
int inet6 = socket(AF_INET6, SOCK_DGRAM, 0);
|
||||||
@ -260,6 +260,18 @@ int open_tap(void) {
|
|||||||
exit(1);
|
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
|
// Convert ASCII IPv6 address to ABI structure
|
||||||
struct in6_addr six_addr_itself;
|
struct in6_addr six_addr_itself;
|
||||||
memset(&six_addr_itself, 0, sizeof(struct in6_addr));
|
memset(&six_addr_itself, 0, sizeof(struct in6_addr));
|
||||||
|
@ -35,6 +35,7 @@ bool noup = false;
|
|||||||
bool daemonize = false;
|
bool daemonize = false;
|
||||||
bool set_ipv4 = false;
|
bool set_ipv4 = false;
|
||||||
bool set_ipv6 = false;
|
bool set_ipv6 = false;
|
||||||
|
bool set_linklocal = false;
|
||||||
bool set_netmask = false;
|
bool set_netmask = false;
|
||||||
bool kiss_over_tcp = false;
|
bool kiss_over_tcp = false;
|
||||||
char* ipv4_addr;
|
char* ipv4_addr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user