feat: awg 2.0
Some checks failed
Linux / Build for Ubuntu (push) Has been cancelled
Linux / Build for Alpine (push) Has been cancelled
Windows / Build for Windows (push) Has been cancelled
Linux / GitHub Release (push) Has been cancelled
Windows / GitHub Release (push) Has been cancelled

This commit is contained in:
Yaroslav Gurov 2025-08-22 10:56:25 +02:00
parent 09db5f7cb3
commit b648e1b45f
18 changed files with 13 additions and 416 deletions

View file

@ -64,10 +64,6 @@ enum wgdevice_attribute {
WGDEVICE_A_I3,
WGDEVICE_A_I4,
WGDEVICE_A_I5,
WGDEVICE_A_J1,
WGDEVICE_A_J2,
WGDEVICE_A_J3,
WGDEVICE_A_ITIME,
__WGDEVICE_A_LAST
};

View file

@ -11,7 +11,7 @@ while read -r -d $'\t' device; do
if [[ $device != "$last_device" ]]; then
[[ -z $last_device ]] && printf '\n' || printf '%s,\n' "$end"
last_device="$device"
read -r private_key public_key listen_port jc jmin jmax s1 s2 s3 s4 h1 h2 h3 h4 i1 i2 i3 i4 i5 j1 j2 j3 itime fwmark
read -r private_key public_key listen_port jc jmin jmax s1 s2 s3 s4 h1 h2 h3 h4 i1 i2 i3 i4 i5 fwmark
printf '\t"%s": {' "$device"
delim=$'\n'
[[ $private_key == "(none)" ]] || { printf '%s\t\t"privateKey": "%s"' "$delim" "$private_key"; delim=$',\n'; }
@ -33,10 +33,6 @@ while read -r -d $'\t' device; do
[[ $i3 == "(none)" ]] || { printf '%s\t\t"i3": "%s"' "$delim" "$i3"; delim=$',\n'; }
[[ $i4 == "(none)" ]] || { printf '%s\t\t"i4": "%s"' "$delim" "$i4"; delim=$',\n'; }
[[ $i5 == "(none)" ]] || { printf '%s\t\t"i5": "%s"' "$delim" "$i5"; delim=$',\n'; }
[[ $j1 == "(none)" ]] || { printf '%s\t\t"j1": "%s"' "$delim" "$j1"; delim=$',\n'; }
[[ $j2 == "(none)" ]] || { printf '%s\t\t"j2": "%s"' "$delim" "$j2"; delim=$',\n'; }
[[ $j3 == "(none)" ]] || { printf '%s\t\t"j3": "%s"' "$delim" "$j3"; delim=$',\n'; }
[[ $itime == "0" ]] || { printf '%s\t\t"itime": %u' "$delim" $(( itime )); delim=$',\n'; }
[[ $fwmark == "off" ]] || { printf '%s\t\t"fwmark": %u' "$delim" $(( $fwmark )); delim=$',\n'; }
printf '%s\t\t"peers": {' "$delim"; end=$'\n\t\t}\n\t}'
delim=$'\n'

View file

@ -25,7 +25,6 @@
// Keys that should be not stripped of whitespace
static const char *awg_special_handshake_keys[] = {
"I1", "I2", "I3", "I4", "I5",
"J1", "J2", "J3",
NULL
};
@ -616,22 +615,6 @@ static bool process_line(struct config_ctx *ctx, const char *line)
ret = parse_awg_string(&ctx->device->i5, "I5", value);
if (ret)
ctx->device->flags |= WGDEVICE_HAS_I5;
} else if (key_match("J1")) {
ret = parse_awg_string(&ctx->device->j1, "J1", value);
if (ret)
ctx->device->flags |= WGDEVICE_HAS_J1;
} else if (key_match("J2")) {
ret = parse_awg_string(&ctx->device->j2, "J2", value);
if (ret)
ctx->device->flags |= WGDEVICE_HAS_J2;
} else if (key_match("J3")) {
ret = parse_awg_string(&ctx->device->j3, "J3", value);
if (ret)
ctx->device->flags |= WGDEVICE_HAS_J3;
} else if (key_match("Itime")) {
ret = parse_uint32(&ctx->device->itime, "Itime", value);
if (ret)
ctx->device->flags |= WGDEVICE_HAS_ITIME;
} else {
goto error;
}
@ -940,34 +923,6 @@ struct wgdevice *config_read_cmd(const char *argv[], int argc)
device->flags |= WGDEVICE_HAS_I5;
argv += 2;
argc -= 2;
} else if (!strcmp(argv[0], "j1") && argc >= 2 && !peer) {
if (!parse_awg_string(&device->j1, "j1", argv[1]))
goto error;
device->flags |= WGDEVICE_HAS_J1;
argv += 2;
argc -= 2;
} else if (!strcmp(argv[0], "j2") && argc >= 2 && !peer) {
if (!parse_awg_string(&device->j2, "j2", argv[1]))
goto error;
device->flags |= WGDEVICE_HAS_J2;
argv += 2;
argc -= 2;
} else if (!strcmp(argv[0], "j3") && argc >= 2 && !peer) {
if (!parse_awg_string(&device->j3, "j3", argv[1]))
goto error;
device->flags |= WGDEVICE_HAS_J3;
argv += 2;
argc -= 2;
} else if (!strcmp(argv[0], "itime") && argc >= 2 && !peer) {
if (!parse_uint32(&device->itime, "itime", argv[1]))
goto error;
device->flags |= WGDEVICE_HAS_ITIME;
argv += 2;
argc -= 2;
} else if (!strcmp(argv[0], "peer") && argc >= 2) {
struct wgpeer *new_peer = calloc(1, sizeof(*new_peer));

View file

@ -96,11 +96,7 @@ enum {
WGDEVICE_HAS_I2 = 1U << 17,
WGDEVICE_HAS_I3 = 1U << 18,
WGDEVICE_HAS_I4 = 1U << 19,
WGDEVICE_HAS_I5 = 1U << 20,
WGDEVICE_HAS_J1 = 1U << 21,
WGDEVICE_HAS_J2 = 1U << 22,
WGDEVICE_HAS_J3 = 1U << 23,
WGDEVICE_HAS_ITIME = 1U << 24
WGDEVICE_HAS_I5 = 1U << 20
};
struct wgdevice {
@ -133,10 +129,6 @@ struct wgdevice {
char* i3;
char* i4;
char* i5;
char* j1;
char* j2;
char* j3;
uint32_t itime;
};
#define for_each_wgpeer(__dev, __peer) for ((__peer) = (__dev)->first_peer; (__peer); (__peer) = (__peer)->next_peer)
@ -161,9 +153,6 @@ static inline void free_wgdevice(struct wgdevice *dev)
free(dev->i3);
free(dev->i4);
free(dev->i5);
free(dev->j1);
free(dev->j2);
free(dev->j3);
free(dev);
}

View file

@ -253,54 +253,6 @@ static int kernel_get_device(struct wgdevice **device, const char *ifname)
dev->flags |= WGDEVICE_HAS_I5;
}
}
if (nvlist_exists_binary(nvl_device, "j1"))
{
binary = nvlist_get_binary(nvl_device, "j1", &size);
if (binary && size < MAX_AWG_STRING_LEN)
{
dev->j1 = strdup((const char*)binary);
if (!dev->j1) {
ret = ENOMEM;
goto err;
}
dev->flags |= WGDEVICE_HAS_J1;
}
}
if (nvlist_exists_binary(nvl_device, "j2"))
{
binary = nvlist_get_binary(nvl_device, "j2", &size);
if (binary && size < MAX_AWG_STRING_LEN)
{
dev->j2 = strdup((const char*)binary);
if (!dev->j2) {
ret = ENOMEM;
goto err;
}
dev->flags |= WGDEVICE_HAS_J2;
}
}
if (nvlist_exists_binary(nvl_device, "j3"))
{
binary = nvlist_get_binary(nvl_device, "j3", &size);
if (binary && size < MAX_AWG_STRING_LEN)
{
dev->j3 = strdup((const char*)binary);
if (!dev->j3) {
ret = ENOMEM;
goto err;
}
dev->flags |= WGDEVICE_HAS_J3;
}
}
if (nvlist_exists_number(nvl_device, "itime"))
{
number = nvlist_get_number(nvl_device, "itime");
if (number <= UINT32_MAX)
{
dev->itime = number;
dev->flags |= WGDEVICE_HAS_ITIME;
}
}
if (nvlist_exists_number(nvl_device, "user-cookie")) {
number = nvlist_get_number(nvl_device, "user-cookie");
@ -515,14 +467,6 @@ static int kernel_set_device(struct wgdevice *dev)
nvlist_add_binary(nvl_device, "i4", dev->i4, strlen(dev->i4) + 1);
if (dev->flags & WGDEVICE_HAS_I5)
nvlist_add_binary(nvl_device, "i5", dev->i5, strlen(dev->i5) + 1);
if (dev->flags & WGDEVICE_HAS_J1)
nvlist_add_binary(nvl_device, "j1", dev->j1, strlen(dev->j1) + 1);
if (dev->flags & WGDEVICE_HAS_J2)
nvlist_add_binary(nvl_device, "j2", dev->j2, strlen(dev->j2) + 1);
if (dev->flags & WGDEVICE_HAS_J3)
nvlist_add_binary(nvl_device, "j3", dev->j3, strlen(dev->j3) + 1);
if (dev->flags & WGDEVICE_HAS_ITIME)
nvlist_add_number(nvl_device, "itime", dev->itime);
if (dev->flags & WGDEVICE_HAS_FWMARK)
nvlist_add_number(nvl_device, "user-cookie", dev->fwmark);
if (dev->flags & WGDEVICE_REPLACE_PEERS)

View file

@ -45,7 +45,7 @@ void put_magic_header_attr(struct nlmsghdr *nlh, int attr_name, char *header_fie
}\
snprintf(magic_header, 12, "%u", numeric_value);\
device->flags |= attr_name;\
} else if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {\
} else if (!mnl_attr_validate(attr, MNL_TYPE_NUL_STRING)) {\
magic_header = strdup(mnl_attr_get_str(attr));\
if (!magic_header) {\
perror("strdup");\
@ -224,14 +224,6 @@ again:
mnl_attr_put_strz(nlh, WGDEVICE_A_I4, dev->i4);
if (dev->flags & WGDEVICE_HAS_I5)
mnl_attr_put_strz(nlh, WGDEVICE_A_I5, dev->i5);
if (dev->flags & WGDEVICE_HAS_J1)
mnl_attr_put_strz(nlh, WGDEVICE_A_J1, dev->j1);
if (dev->flags & WGDEVICE_HAS_J2)
mnl_attr_put_strz(nlh, WGDEVICE_A_J2, dev->j2);
if (dev->flags & WGDEVICE_HAS_J3)
mnl_attr_put_strz(nlh, WGDEVICE_A_J3, dev->j3);
if (dev->flags & WGDEVICE_HAS_ITIME)
mnl_attr_put_u32(nlh, WGDEVICE_A_ITIME, dev->itime);
if (dev->flags & WGDEVICE_HAS_FWMARK)
mnl_attr_put_u32(nlh, WGDEVICE_A_FWMARK, dev->fwmark);
if (dev->flags & WGDEVICE_REPLACE_PEERS)
@ -589,7 +581,7 @@ static int parse_device(const struct nlattr *attr, void *data)
GET_MAGIC_HEADER(attr, device->transport_packet_magic_header, WGDEVICE_HAS_H4);
break;
case WGDEVICE_A_I1:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
if (!mnl_attr_validate(attr, MNL_TYPE_NUL_STRING)) {
device->i1 = strdup(mnl_attr_get_str(attr));
if (!device->i1) {
perror("strdup");
@ -600,7 +592,7 @@ static int parse_device(const struct nlattr *attr, void *data)
}
break;
case WGDEVICE_A_I2:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
if (!mnl_attr_validate(attr, MNL_TYPE_NUL_STRING)) {
device->i2 = strdup(mnl_attr_get_str(attr));
if (!device->i2) {
perror("strdup");
@ -611,7 +603,7 @@ static int parse_device(const struct nlattr *attr, void *data)
}
break;
case WGDEVICE_A_I3:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
if (!mnl_attr_validate(attr, MNL_TYPE_NUL_STRING)) {
device->i3 = strdup(mnl_attr_get_str(attr));
if (!device->i3) {
perror("strdup");
@ -622,7 +614,7 @@ static int parse_device(const struct nlattr *attr, void *data)
}
break;
case WGDEVICE_A_I4:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
if (!mnl_attr_validate(attr, MNL_TYPE_NUL_STRING)) {
device->i4 = strdup(mnl_attr_get_str(attr));
if (!device->i4) {
perror("strdup");
@ -633,7 +625,7 @@ static int parse_device(const struct nlattr *attr, void *data)
}
break;
case WGDEVICE_A_I5:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
if (!mnl_attr_validate(attr, MNL_TYPE_NUL_STRING)) {
device->i5 = strdup(mnl_attr_get_str(attr));
if (!device->i5) {
perror("strdup");
@ -643,45 +635,6 @@ static int parse_device(const struct nlattr *attr, void *data)
device->flags |= WGDEVICE_HAS_I5;
}
break;
case WGDEVICE_A_J1:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
device->j1 = strdup(mnl_attr_get_str(attr));
if (!device->j1) {
perror("strdup");
return MNL_CB_ERROR;
}
device->flags |= WGDEVICE_HAS_J1;
}
break;
case WGDEVICE_A_J2:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
device->j2 = strdup(mnl_attr_get_str(attr));
if (!device->j2) {
perror("strdup");
return MNL_CB_ERROR;
}
device->flags |= WGDEVICE_HAS_J2;
}
break;
case WGDEVICE_A_J3:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) {
device->j3 = strdup(mnl_attr_get_str(attr));
if (!device->j3) {
perror("strdup");
return MNL_CB_ERROR;
}
device->flags |= WGDEVICE_HAS_J3;
}
break;
case WGDEVICE_A_ITIME:
if (!mnl_attr_validate(attr, MNL_TYPE_U32)) {
device->itime = mnl_attr_get_u32(attr);
device->flags |= WGDEVICE_HAS_ITIME;
}
break;
}
return MNL_CB_OK;

View file

@ -222,39 +222,6 @@ static int kernel_get_device(struct wgdevice **device, const char *iface)
dev->flags |= WGDEVICE_HAS_I5;
}
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_J1)
{
dev->j1 = strdup(wg_iface->i_j1);
if (!dev->j1)
goto out;
dev->flags |= WGDEVICE_HAS_J1;
}
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_J2)
{
dev->j2 = strdup(wg_iface->i_j2);
if (!dev->j2)
goto out;
dev->flags |= WGDEVICE_HAS_J2;
}
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_J3)
{
dev->j3 = strdup(wg_iface->i_j3);
if (!dev->j3)
goto out;
dev->flags |= WGDEVICE_HAS_J3;
}
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_ITIME)
{
dev->itime = wg_iface->i_itime;
dev->flags |= WGDEVICE_HAS_ITIME;
}
wg_peer = &wg_iface->i_peers[0];
for (size_t i = 0; i < wg_iface->i_peers_count; ++i) {
peer = calloc(1, sizeof(*peer));
@ -479,39 +446,6 @@ static int kernel_set_device(struct wgdevice *dev)
wg_iface->i_flags |= WG_INTERFACE_DEVICE_HAS_I5;
}
if (dev->flags & WGDEVICE_HAS_J1)
{
wg_iface->i_j1 = strdup(dev->j1);
if (!wg_iface->i_j1)
goto out;
wg_iface->i_flags |= WG_INTERFACE_DEVICE_HAS_J1;
}
if (dev->flags & WGDEVICE_HAS_J2)
{
wg_iface->i_j2 = strdup(dev->j2);
if (!wg_iface->i_j2)
goto out;
wg_iface->i_flags |= WG_INTERFACE_DEVICE_HAS_J2;
}
if (dev->flags & WGDEVICE_HAS_J3)
{
wg_iface->i_j3 = strdup(dev->j3);
if (!wg_iface->i_j3)
goto out;
wg_iface->i_flags |= WG_INTERFACE_DEVICE_HAS_J3;
}
if (dev->flags & WGDEVICE_HAS_ITIME)
{
wg_iface->i_itime = dev->itime;
wg_iface->i_flags |= WG_INTERFACE_DEVICE_HAS_ITIME;
}
peer_count = 0;
wg_peer = &wg_iface->i_peers[0];
for_each_wgpeer(dev, peer) {
@ -586,12 +520,6 @@ out:
free(wg_iface->i_i4);
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_I5)
free(wg_iface->i_i5);
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_J1)
free(wg_iface->i_j1);
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_J2)
free(wg_iface->i_j2);
if (wg_iface->i_flags & WG_INTERFACE_DEVICE_HAS_J3)
free(wg_iface->i_j3);
}
free(wgdata.wgd_interface);
return ret;

View file

@ -95,14 +95,6 @@ static int userspace_set_device(struct wgdevice *dev)
fprintf(f, "i4=%s\n", dev->i4);
if (dev->flags & WGDEVICE_HAS_I5)
fprintf(f, "i5=%s\n", dev->i5);
if (dev->flags & WGDEVICE_HAS_J1)
fprintf(f, "j1=%s\n", dev->j1);
if (dev->flags & WGDEVICE_HAS_J2)
fprintf(f, "j2=%s\n", dev->j2);
if (dev->flags & WGDEVICE_HAS_J3)
fprintf(f, "j3=%s\n", dev->j3);
if (dev->flags & WGDEVICE_HAS_ITIME)
fprintf(f, "itime=%u\n", dev->itime);
for_each_wgpeer(dev, peer) {
key_to_hex(hex, peer->public_key);
@ -332,33 +324,6 @@ static int userspace_get_device(struct wgdevice **out, const char *iface)
}
dev->flags |= WGDEVICE_HAS_I5;
} else if (!peer && !strcmp(key, "j1")) {
dev->j1 = strdup(value);
if (!dev->j1) {
ret = -ENOMEM;
goto err;
}
dev->flags |= WGDEVICE_HAS_J1;
} else if (!peer && !strcmp(key, "j2")) {
dev->j2 = strdup(value);
if (!dev->j2) {
ret = -ENOMEM;
goto err;
}
dev->flags |= WGDEVICE_HAS_J2;
} else if (!peer && !strcmp(key, "j3")) {
dev->j3 = strdup(value);
if (!dev->j3) {
ret = -ENOMEM;
goto err;
}
dev->flags |= WGDEVICE_HAS_J3;
} else if (!peer && !strcmp(key, "itime")) {
dev->itime = NUM(0xffffffffU);
dev->flags |= WGDEVICE_HAS_ITIME;
} else if (!strcmp(key, "public_key")) {
struct wgpeer *new_peer = calloc(1, sizeof(*new_peer));

View file

@ -345,28 +345,6 @@ static int kernel_get_device(struct wgdevice **device, const char *iface)
memcpy(dev->i5, wg_iface->I5, i5_size);
dev->flags |= WGDEVICE_HAS_I5;
}
if (wg_iface->Flags & WG_IOCTL_INTERFACE_J1) {
const size_t j1_size = strlen((char*)wg_iface->J1) + 1;
dev->j1 = (char*)malloc(j1_size);
memcpy(dev->j1, wg_iface->J1, j1_size);
dev->flags |= WGDEVICE_HAS_J1;
}
if (wg_iface->Flags & WG_IOCTL_INTERFACE_J2) {
const size_t j2_size = strlen((char*)wg_iface->J2) + 1;
dev->j2 = (char*)malloc(j2_size);
memcpy(dev->j2, wg_iface->J2, j2_size);
dev->flags |= WGDEVICE_HAS_J2;
}
if (wg_iface->Flags & WG_IOCTL_INTERFACE_J3) {
const size_t j3_size = strlen((char*)wg_iface->J3) + 1;
dev->j3 = (char*)malloc(j3_size);
memcpy(dev->j3, wg_iface->J3, j3_size);
dev->flags |= WGDEVICE_HAS_J3;
}
if (wg_iface->Flags & WG_IOCTL_INTERFACE_ITIME) {
dev->itime = wg_iface->Itime;
dev->flags |= WGDEVICE_HAS_ITIME;
}
wg_peer = buf + sizeof(WG_IOCTL_INTERFACE);
for (ULONG i = 0; i < wg_iface->PeersCount; ++i) {
@ -586,32 +564,6 @@ static int kernel_set_device(struct wgdevice *dev)
memcpy(wg_iface->I5, dev->i5, i5_size);
wg_iface->Flags |= WG_IOCTL_INTERFACE_I5;
}
if (dev->flags & WGDEVICE_HAS_J1)
{
const size_t j1_size = strlen(dev->j1) + 1;
wg_iface->J1 = (UCHAR*)malloc(j1_size);
memcpy(wg_iface->J1, dev->j1, j1_size);
wg_iface->Flags |= WG_IOCTL_INTERFACE_J1;
}
if (dev->flags & WGDEVICE_HAS_J2)
{
const size_t j2_size = strlen(dev->j2) + 1;
wg_iface->J2 = (UCHAR*)malloc(j2_size);
memcpy(wg_iface->J2, dev->j2, j2_size);
wg_iface->Flags |= WG_IOCTL_INTERFACE_J2;
}
if (dev->flags & WGDEVICE_HAS_J3)
{
const size_t j3_size = strlen(dev->j3) + 1;
wg_iface->J3 = (UCHAR*)malloc(j3_size);
memcpy(wg_iface->J3, dev->j3, j3_size);
wg_iface->Flags |= WG_IOCTL_INTERFACE_J3;
}
if (dev->flags & WGDEVICE_HAS_ITIME)
{
wg_iface->Itime = dev->itime;
wg_iface->Flags |= WG_IOCTL_INTERFACE_ITIME;
}
peer_count = 0;
wg_peer = (void *)wg_iface + sizeof(WG_IOCTL_INTERFACE);
@ -691,12 +643,6 @@ out:
free(wg_iface->I4);
if (wg_iface->I5)
free(wg_iface->I5);
if (wg_iface->J1)
free(wg_iface->J1);
if (wg_iface->J2)
free(wg_iface->J2);
if (wg_iface->J3)
free(wg_iface->J3);
}
free(wg_iface);
CloseHandle(handle);

View file

@ -18,7 +18,7 @@ int set_main(int argc, const char *argv[])
int ret = 1;
if (argc < 3) {
fprintf(stderr, "Usage: %s %s <interface> [listen-port <port>] [fwmark <mark>] [private-key <file path>] [jc <junk_count>] [jmin <min_value>] [jmax <max_value>] [s1 <init_junk>] [s2 <resp_junk>] [s3 <cookie_junk>] [s4 <trans_junk>] [h1 <init_header>] [h2 <resp_header>] [h3 <cookie_header>] [h4 <transp_header>] [i1 \"<taged_junk>\"] [i2 \"<taged_junk>\"] [i3 \"<taged_junk>\"] [i4 \"<taged_junk>\"] [i5 \"<taged_junk>\"] [j1 \"<taged_junk>\"] [j2 \"<taged_junk>\"] [j3 \"<taged_junk>\"] [itime <itimeout>][peer <base64 public key> [remove] [preshared-key <file path>] [endpoint <ip>:<port>] [persistent-keepalive <interval seconds>] [allowed-ips <ip1>/<cidr1>[,<ip2>/<cidr2>] [advanced-security <on|off>]...] ]...\n", PROG_NAME, argv[0]);
fprintf(stderr, "Usage: %s %s <interface> [listen-port <port>] [fwmark <mark>] [private-key <file path>] [jc <junk_count>] [jmin <min_value>] [jmax <max_value>] [s1 <init_junk>] [s2 <resp_junk>] [s3 <cookie_junk>] [s4 <trans_junk>] [h1 <init_header>] [h2 <resp_header>] [h3 <cookie_header>] [h4 <transp_header>] [i1 \"<taged_junk>\"] [i2 \"<taged_junk>\"] [i3 \"<taged_junk>\"] [i4 \"<taged_junk>\"] [i5 \"<taged_junk>\"] [peer <base64 public key> [remove] [preshared-key <file path>] [endpoint <ip>:<port>] [persistent-keepalive <interval seconds>] [allowed-ips <ip1>/<cidr1>[,<ip2>/<cidr2>] [advanced-security <on|off>]...] ]...\n", PROG_NAME, argv[0]);
return 1;
}

View file

@ -202,7 +202,7 @@ static char *bytes(uint64_t b)
static const char *COMMAND_NAME;
static void show_usage(void)
{
fprintf(stderr, "Usage: %s %s { <interface> | all | interfaces } [public-key | private-key | listen-port | fwmark | peers | preshared-keys | endpoints | allowed-ips | latest-handshakes | transfer | persistent-keepalive | dump | jc | jmin | jmax | s1 | s2 | s3 | s4 | h1 | h2 | h3 | h4 | i1 | i2 | i3 | i4 | i5 | j1 | j2 | j3 | itime]\n", PROG_NAME, COMMAND_NAME);
fprintf(stderr, "Usage: %s %s { <interface> | all | interfaces } [public-key | private-key | listen-port | fwmark | peers | preshared-keys | endpoints | allowed-ips | latest-handshakes | transfer | persistent-keepalive | dump | jc | jmin | jmax | s1 | s2 | s3 | s4 | h1 | h2 | h3 | h4 | i1 | i2 | i3 | i4 | i5]\n", PROG_NAME, COMMAND_NAME);
}
static void pretty_print(struct wgdevice *device)
@ -252,14 +252,6 @@ static void pretty_print(struct wgdevice *device)
terminal_printf(" " TERMINAL_BOLD "i4" TERMINAL_RESET ": %s\n", device->i4);
if (device->i5)
terminal_printf(" " TERMINAL_BOLD "i5" TERMINAL_RESET ": %s\n", device->i5);
if (device->j1)
terminal_printf(" " TERMINAL_BOLD "j1" TERMINAL_RESET ": %s\n", device->j1);
if (device->j2)
terminal_printf(" " TERMINAL_BOLD "j2" TERMINAL_RESET ": %s\n", device->j2);
if (device->j3)
terminal_printf(" " TERMINAL_BOLD "j3" TERMINAL_RESET ": %s\n", device->j3);
if (device->itime)
terminal_printf(" " TERMINAL_BOLD "itime" TERMINAL_RESET ": %u\n", device->itime);
if (device->first_peer) {
sort_peers(device);
@ -326,13 +318,6 @@ static void dump_print(struct wgdevice *device, bool with_interface)
fputc('\t', stdout);
fputs(device->i5 ? device->i5 : "(null)", stdout);
fputc('\t', stdout);
fputs(device->j1 ? device->j1 : "(null)", stdout);
fputc('\t', stdout);
fputs(device->j2 ? device->j2 : "(null)", stdout);
fputc('\t', stdout);
fputs(device->j3 ? device->j3 : "(null)", stdout);
fputc('\t', stdout);
printf("%u\t", device->itime);
if (device->fwmark)
printf("0x%x\n", device->fwmark);
@ -449,22 +434,6 @@ static bool ugly_print(struct wgdevice *device, const char *param, bool with_int
if (with_interface)
printf("%s\t", device->name);
printf("%s\n", device->i5);
} else if (!strcmp(param, "j1")) {
if (with_interface)
printf("%s\t", device->name);
printf("%s\n", device->j1);
} else if (!strcmp(param, "j2")) {
if (with_interface)
printf("%s\t", device->name);
printf("%s\n", device->j2);
} else if (!strcmp(param, "j3")) {
if (with_interface)
printf("%s\t", device->name);
printf("%s\n", device->j3);
} else if (!strcmp(param, "itime")) {
if (with_interface)
printf("%s\t", device->name);
printf("%u\n", device->itime);
} else if (!strcmp(param, "endpoints")) {
for_each_wgpeer(device, peer) {
if (with_interface)

View file

@ -78,14 +78,6 @@ int showconf_main(int argc, const char *argv[])
printf("I4 = %s\n", device->i4);
if (device->flags & WGDEVICE_HAS_I5)
printf("I5 = %s\n", device->i5);
if (device->flags & WGDEVICE_HAS_J1)
printf("J1 = %s\n", device->j1);
if (device->flags & WGDEVICE_HAS_J2)
printf("J2 = %s\n", device->j2);
if (device->flags & WGDEVICE_HAS_J3)
printf("J3 = %s\n", device->j3);
if (device->flags & WGDEVICE_HAS_ITIME)
printf("Itime = %u\n", device->itime);
printf("\n");
for_each_wgpeer(device, peer) {

View file

@ -199,10 +199,6 @@ enum wgdevice_attribute {
WGDEVICE_A_I3,
WGDEVICE_A_I4,
WGDEVICE_A_I5,
WGDEVICE_A_J1,
WGDEVICE_A_J2,
WGDEVICE_A_J3,
WGDEVICE_A_ITIME,
__WGDEVICE_A_LAST
};
#define WGDEVICE_A_MAX (__WGDEVICE_A_LAST - 1)

View file

@ -88,10 +88,6 @@ struct wg_peer_io {
#define WG_INTERFACE_DEVICE_HAS_I3 (1 << 18)
#define WG_INTERFACE_DEVICE_HAS_I4 (1 << 19)
#define WG_INTERFACE_DEVICE_HAS_I5 (1 << 20)
#define WG_INTERFACE_DEVICE_HAS_J1 (1 << 21)
#define WG_INTERFACE_DEVICE_HAS_J2 (1 << 22)
#define WG_INTERFACE_DEVICE_HAS_J3 (1 << 23)
#define WG_INTERFACE_DEVICE_HAS_ITIME (1 << 24)
struct wg_interface_io {
uint16_t i_flags;
@ -119,10 +115,6 @@ struct wg_interface_io {
uint8_t* i_i3;
uint8_t* i_i4;
uint8_t* i_i5;
uint8_t* i_j1;
uint8_t* i_j2;
uint8_t* i_j3;
uint32_t i_itime;
};
struct wg_data_io {

View file

@ -73,11 +73,7 @@ typedef enum
WG_IOCTL_INTERFACE_I2 = 1U << 17,
WG_IOCTL_INTERFACE_I3 = 1U << 18,
WG_IOCTL_INTERFACE_I4 = 1U << 19,
WG_IOCTL_INTERFACE_I5 = 1U << 20,
WG_IOCTL_INTERFACE_J1 = 1U << 21,
WG_IOCTL_INTERFACE_J2 = 1U << 22,
WG_IOCTL_INTERFACE_J3 = 1U << 23,
WG_IOCTL_INTERFACE_ITIME = 1U << 24
WG_IOCTL_INTERFACE_I5 = 1U << 20
} WG_IOCTL_INTERFACE_FLAG;
typedef struct _WG_IOCTL_INTERFACE
@ -104,10 +100,6 @@ typedef struct _WG_IOCTL_INTERFACE
UCHAR* I3;
UCHAR* I4;
UCHAR* I5;
UCHAR* J1;
UCHAR* J2;
UCHAR* J3;
ULONG Itime;
} __attribute__((aligned(8))) WG_IOCTL_INTERFACE;
#define WG_IOCTL_GET CTL_CODE(45208U, 321, METHOD_OUT_DIRECT, FILE_READ_DATA | FILE_WRITE_DATA)

View file

@ -1292,14 +1292,6 @@ static void parse_options(char **iface, char **config, unsigned int *mtu, char *
is_awg_on = true;
} else if (!strncasecmp(clean, "I5=", 3) && j > 4) {
is_awg_on = true;
} else if (!strncasecmp(clean, "J1=", 3) && j > 4) {
is_awg_on = true;
} else if (!strncasecmp(clean, "J2=", 3) && j > 4) {
is_awg_on = true;
} else if (!strncasecmp(clean, "J3=", 3) && j > 4) {
is_awg_on = true;
} else if (!strncasecmp(clean, "Itime=", 6) && j > 4) {
is_awg_on = true;
}
}
*config = concat_and_free(*config, "", line);

View file

@ -114,11 +114,7 @@ parse_options() {
I2);&
I3);&
I4);&
I5);&
J1);&
J2);&
J3);&
Itime) IS_AWG_ON=1;;
I5) IS_AWG_ON=1;;
esac
fi
WG_CONFIG+="$line"$'\n'

View file

@ -85,11 +85,7 @@ parse_options() {
I2);&
I3);&
I4);&
I5);&
J1);&
J2);&
J3);&
Itime) IS_AWG_ON=1;;
I5) IS_AWG_ON=1;;
esac
fi
WG_CONFIG+="$line"$'\n'