]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg: allowed-ips is easier to parse with spaces instead of ", "
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 20 Dec 2016 18:14:19 +0000 (19:14 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 23 Dec 2016 20:09:23 +0000 (21:09 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
contrib/wg-config/wg-config
src/show.c

index f2272b321ddefd316d844ffc6c62bb7a1e9b9546..d7ea38c10e2676875770ad5c3223dcd63f3a362b 100755 (executable)
@@ -129,7 +129,7 @@ cmd_add() {
        done
        up_if
        if [[ $AUTO_ROUTE -eq 1 ]]; then
-               for i in $(wg show "$INTERFACE" allowed-ips | grep -Po '(?<=[\t ])[0-9.:/a-z]+(?<=,)?' | sort -nr -k 2 -t /); do
+               for i in $(wg show "$INTERFACE" allowed-ips | grep -Po '(?<=[\t ])[0-9.:/a-z]+' | sort -nr -k 2 -t /); do
                        if ! add_default "$i" && [[ $(ip route get "$i") != *dev\ $INTERFACE\ * ]]; then
                                add_route "$i"
                        fi
index 624f789cdb0aa98c4e2f64b31e8d02bb68315f36..7c32af9c731a3b639ea24312c6ec021e42b38f77 100644 (file)
@@ -288,7 +288,7 @@ static bool ugly_print(struct wgdevice *device, const char *param, bool with_int
                        printf("%s\t", key(peer->public_key));
                        if (peer->num_ipmasks) {
                                for_each_wgipmask(peer, ipmask, j)
-                                       printf("%s/%u%s", ip(ipmask), ipmask->cidr, j == (size_t)peer->num_ipmasks - 1 ? "\n" : ", ");
+                                       printf("%s/%u%c", ip(ipmask), ipmask->cidr, j == (size_t)peer->num_ipmasks - 1 ? '\n' : ' ');
                        } else
                                printf("(none)\n");
                }