set point-to-point mode on TAP

pull/787/head
Rick V 5 years ago
parent df430650ef
commit aef42701c0
No known key found for this signature in database
GPG Key ID: C0EDC8723FDC3465

@ -372,6 +372,7 @@ int
tuntap_sys_set_ipv4(struct device *dev, t_tun_in_addr *s, uint32_t mask)
{
IPADDR sock[3];
IPADDR pp[2];
DWORD len, ret;
IPADDR ep[4];
#pragma pack(push)
@ -396,6 +397,18 @@ tuntap_sys_set_ipv4(struct device *dev, t_tun_in_addr *s, uint32_t mask)
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[1] = mask;
ep[2] = (s->S_un.S_addr | ~mask)

Loading…
Cancel
Save