diff --git a/contrib/embeddable-wg-library/wireguard.c b/contrib/embeddable-wg-library/wireguard.c index d7f40e4..86fd004 100644 --- a/contrib/embeddable-wg-library/wireguard.c +++ b/contrib/embeddable-wg-library/wireguard.c @@ -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 }; diff --git a/contrib/json/wg-json b/contrib/json/wg-json index bd15f03..b8ca46c 100755 --- a/contrib/json/wg-json +++ b/contrib/json/wg-json @@ -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' diff --git a/src/config.c b/src/config.c index f61de28..aa614ba 100644 --- a/src/config.c +++ b/src/config.c @@ -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)); diff --git a/src/containers.h b/src/containers.h index 9046fa7..c6505da 100644 --- a/src/containers.h +++ b/src/containers.h @@ -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); } diff --git a/src/ipc-freebsd.h b/src/ipc-freebsd.h index 119bc20..d6f27a3 100644 --- a/src/ipc-freebsd.h +++ b/src/ipc-freebsd.h @@ -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) diff --git a/src/ipc-linux.h b/src/ipc-linux.h index 84ee11f..141c5aa 100644 --- a/src/ipc-linux.h +++ b/src/ipc-linux.h @@ -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; diff --git a/src/ipc-openbsd.h b/src/ipc-openbsd.h index c3606f6..1f87cae 100644 --- a/src/ipc-openbsd.h +++ b/src/ipc-openbsd.h @@ -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; diff --git a/src/ipc-uapi.h b/src/ipc-uapi.h index 45ca24a..91b1181 100644 --- a/src/ipc-uapi.h +++ b/src/ipc-uapi.h @@ -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)); diff --git a/src/ipc-windows.h b/src/ipc-windows.h index c5488cd..21ad264 100644 --- a/src/ipc-windows.h +++ b/src/ipc-windows.h @@ -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); diff --git a/src/set.c b/src/set.c index dc56667..4252c21 100644 --- a/src/set.c +++ b/src/set.c @@ -18,7 +18,7 @@ int set_main(int argc, const char *argv[]) int ret = 1; if (argc < 3) { - fprintf(stderr, "Usage: %s %s [listen-port ] [fwmark ] [private-key ] [jc ] [jmin ] [jmax ] [s1 ] [s2 ] [s3 ] [s4 ] [h1 ] [h2 ] [h3 ] [h4 ] [i1 \"\"] [i2 \"\"] [i3 \"\"] [i4 \"\"] [i5 \"\"] [j1 \"\"] [j2 \"\"] [j3 \"\"] [itime ][peer [remove] [preshared-key ] [endpoint :] [persistent-keepalive ] [allowed-ips /[,/] [advanced-security ]...] ]...\n", PROG_NAME, argv[0]); + fprintf(stderr, "Usage: %s %s [listen-port ] [fwmark ] [private-key ] [jc ] [jmin ] [jmax ] [s1 ] [s2 ] [s3 ] [s4 ] [h1 ] [h2 ] [h3 ] [h4 ] [i1 \"\"] [i2 \"\"] [i3 \"\"] [i4 \"\"] [i5 \"\"] [peer [remove] [preshared-key ] [endpoint :] [persistent-keepalive ] [allowed-ips /[,/] [advanced-security ]...] ]...\n", PROG_NAME, argv[0]); return 1; } diff --git a/src/show.c b/src/show.c index 1175faf..d396f54 100644 --- a/src/show.c +++ b/src/show.c @@ -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 { | 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 { | 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) diff --git a/src/showconf.c b/src/showconf.c index 81d5354..57a38c7 100644 --- a/src/showconf.c +++ b/src/showconf.c @@ -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) { diff --git a/src/uapi/linux/linux/wireguard.h b/src/uapi/linux/linux/wireguard.h index bde7b50..0b35d69 100644 --- a/src/uapi/linux/linux/wireguard.h +++ b/src/uapi/linux/linux/wireguard.h @@ -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) diff --git a/src/uapi/openbsd/net/if_wg.h b/src/uapi/openbsd/net/if_wg.h index e782d0c..dd3c848 100644 --- a/src/uapi/openbsd/net/if_wg.h +++ b/src/uapi/openbsd/net/if_wg.h @@ -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 { diff --git a/src/uapi/windows/wireguard.h b/src/uapi/windows/wireguard.h index ff948f8..2c6636a 100644 --- a/src/uapi/windows/wireguard.h +++ b/src/uapi/windows/wireguard.h @@ -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) diff --git a/src/wg-quick/android.c b/src/wg-quick/android.c index e2d9f67..a803998 100644 --- a/src/wg-quick/android.c +++ b/src/wg-quick/android.c @@ -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); diff --git a/src/wg-quick/freebsd.bash b/src/wg-quick/freebsd.bash index 6213309..543a231 100755 --- a/src/wg-quick/freebsd.bash +++ b/src/wg-quick/freebsd.bash @@ -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' diff --git a/src/wg-quick/openbsd.bash b/src/wg-quick/openbsd.bash index 902737c..1afd2a5 100755 --- a/src/wg-quick/openbsd.bash +++ b/src/wg-quick/openbsd.bash @@ -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'