|
|
|
|
@ -223,7 +223,8 @@ fail:
|
|
|
|
|
struct tun_if* tun_init_nat(struct UASYNC* ua, const char* ifname, const char* ip_addr_str, int mtu, int test_mode) |
|
|
|
|
{ |
|
|
|
|
if (!ua || !ifname || !ip_addr_str) return NULL; |
|
|
|
|
if (mtu <= 0) mtu = TUN_MTU_DEFAULT; |
|
|
|
|
(void)mtu; |
|
|
|
|
int tun_mtu = TUN_MTU_DEFAULT; |
|
|
|
|
|
|
|
|
|
struct tun_if* tun = u_calloc(1, sizeof(struct tun_if)); |
|
|
|
|
if (!tun) return NULL; |
|
|
|
|
@ -238,7 +239,7 @@ struct tun_if* tun_init_nat(struct UASYNC* ua, const char* ifname, const char* i
|
|
|
|
|
snprintf(ip_str, sizeof(ip_str), "%s/32", ip_addr_str); |
|
|
|
|
|
|
|
|
|
if (!test_mode) { |
|
|
|
|
if (tun_platform_init(tun, tun->ifname, ip_str, mtu) != 0) { |
|
|
|
|
if (tun_platform_init(tun, tun->ifname, ip_str, tun_mtu) != 0) { |
|
|
|
|
u_free(tun); |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
|