wg-quick android support for new fields

This commit is contained in:
Mark Puha 2023-09-29 12:21:23 +02:00
parent adba8c59a0
commit fb6f2b71f9

View file

@ -41,6 +41,7 @@
static bool is_exiting = false;
static bool binder_available = false;
static unsigned int sdk_version;
static bool is_asecurity_on = false;
static void *xmalloc(size_t size)
{
@ -632,7 +633,10 @@ static void auto_su(int argc, char *argv[])
static void add_if(const char *iface)
{
cmd("ip link add %s type wireguard", iface);
if (is_asecurity_on)
cmd("wireguard-go %s", iface);
else
cmd("ip link add %s type wireguard", iface);
}
static void del_if(const char *iface)
@ -1256,7 +1260,25 @@ static void parse_options(char **iface, char **config, unsigned int *mtu, char *
} else if (!strncasecmp(clean, "MTU=", 4) && j > 4) {
*mtu = atoi(clean + 4);
continue;
}
} else if (!strncasecmp(clean, "Jc=", 3) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "Jmin=", 5) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "Jmax=", 5) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "S1=", 3) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "S2=", 3) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "H1=", 3) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "H2=", 3) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "H3=", 3) && j > 4 {
is_asecurity_on = true;
} else if (!strncasecmp(clean, "H4=", 3) && j > 4 {
is_asecurity_on = true;
}
}
*config = concat_and_free(*config, "", line);
}