mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
set point-to-point mode on TAP
This commit is contained in:
parent
df430650ef
commit
aef42701c0
13
vendor/libtuntap-master/tuntap-windows.c
vendored
13
vendor/libtuntap-master/tuntap-windows.c
vendored
@ -372,6 +372,7 @@ int
|
|||||||
tuntap_sys_set_ipv4(struct device *dev, t_tun_in_addr *s, uint32_t mask)
|
tuntap_sys_set_ipv4(struct device *dev, t_tun_in_addr *s, uint32_t mask)
|
||||||
{
|
{
|
||||||
IPADDR sock[3];
|
IPADDR sock[3];
|
||||||
|
IPADDR pp[2];
|
||||||
DWORD len, ret;
|
DWORD len, ret;
|
||||||
IPADDR ep[4];
|
IPADDR ep[4];
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
@ -396,6 +397,18 @@ tuntap_sys_set_ipv4(struct device *dev, t_tun_in_addr *s, uint32_t mask)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pp[0] = s->S_un.S_addr;
|
||||||
|
pp[1] = mask;
|
||||||
|
|
||||||
|
ret = DeviceIoControl(dev->tun_fd, TAP_IOCTL_CONFIG_POINT_TO_POINT, &pp, sizeof(pp),
|
||||||
|
&pp, sizeof(pp), &len, NULL);
|
||||||
|
if(!ret)
|
||||||
|
{
|
||||||
|
int errcode = GetLastError();
|
||||||
|
tuntap_log(TUNTAP_LOG_ERR, (const char *)formated_error(L"%1%0", errcode));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ep[0] = s->S_un.S_addr;
|
ep[0] = s->S_un.S_addr;
|
||||||
ep[1] = mask;
|
ep[1] = mask;
|
||||||
ep[2] = (s->S_un.S_addr | ~mask)
|
ep[2] = (s->S_un.S_addr | ~mask)
|
||||||
|
Loading…
Reference in New Issue
Block a user