wg: allowed-ips is easier to parse with spaces instead of ", "
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
50e1f58fde
commit
b5415c0b65
|
@ -129,7 +129,7 @@ cmd_add() {
|
||||||
done
|
done
|
||||||
up_if
|
up_if
|
||||||
if [[ $AUTO_ROUTE -eq 1 ]]; then
|
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
|
if ! add_default "$i" && [[ $(ip route get "$i") != *dev\ $INTERFACE\ * ]]; then
|
||||||
add_route "$i"
|
add_route "$i"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -288,7 +288,7 @@ static bool ugly_print(struct wgdevice *device, const char *param, bool with_int
|
||||||
printf("%s\t", key(peer->public_key));
|
printf("%s\t", key(peer->public_key));
|
||||||
if (peer->num_ipmasks) {
|
if (peer->num_ipmasks) {
|
||||||
for_each_wgipmask(peer, ipmask, j)
|
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
|
} else
|
||||||
printf("(none)\n");
|
printf("(none)\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue