set point-to-point mode on TAP

This commit is contained in:
Rick V 2019-08-29 17:05:18 -05:00
parent df430650ef
commit aef42701c0
No known key found for this signature in database
GPG Key ID: C0EDC8723FDC3465

View File

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