|
|
|
@ -187,7 +187,8 @@ tuntap_sys_set_ipv4_tap(struct device *dev, t_tun_in_addr *s4, uint32_t bits)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
tuntap_sys_add_route(struct device *dev, t_tun_in_addr *s4, uint32_t bits)
|
|
|
|
|
tuntap_sys_add_route(struct device *dev, t_tun_in_addr *s4, uint32_t bits,
|
|
|
|
|
uint32_t netmask)
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_in mask;
|
|
|
|
|
mask.sin_family = AF_INET;
|
|
|
|
@ -205,8 +206,8 @@ tuntap_sys_add_route(struct device *dev, t_tun_in_addr *s4, uint32_t bits)
|
|
|
|
|
dev->if_name, addr, addr, netmask);
|
|
|
|
|
tuntap_log(TUNTAP_LOG_INFO, buf);
|
|
|
|
|
system(buf);
|
|
|
|
|
snprintf(buf, sizeof(buf), "route add %s/%d -interface %s", addr,
|
|
|
|
|
dev->netmask, dev->if_name);
|
|
|
|
|
snprintf(buf, sizeof(buf), "route add %s/%d -interface %s", addr, netmask,
|
|
|
|
|
dev->if_name);
|
|
|
|
|
tuntap_log(TUNTAP_LOG_INFO, buf);
|
|
|
|
|
system(buf);
|
|
|
|
|
return 0;
|
|
|
|
@ -214,7 +215,7 @@ tuntap_sys_add_route(struct device *dev, t_tun_in_addr *s4, uint32_t bits)
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
tuntap_sys_set_ipv4_tun(struct device *dev, t_tun_in_addr *s4,
|
|
|
|
|
t_tun_in_addr *s4dest, uint32_t bits)
|
|
|
|
|
t_tun_in_addr *s4dest, uint32_t bits, uint32_t netmask)
|
|
|
|
|
{
|
|
|
|
|
struct ifaliasreq ifrq;
|
|
|
|
|
struct sockaddr_in mask;
|
|
|
|
@ -252,7 +253,7 @@ tuntap_sys_set_ipv4_tun(struct device *dev, t_tun_in_addr *s4,
|
|
|
|
|
tuntap_log(TUNTAP_LOG_ERR, "Can't set IP address");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return tuntap_sys_add_route(dev, s4, bits);
|
|
|
|
|
return tuntap_sys_add_route(dev, s4, bits, netmask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|