]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: freebsd: allow loopback to work
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 24 Jan 2019 02:26:51 +0000 (03:26 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 24 Jan 2019 02:28:54 +0000 (03:28 +0100)
FreeBSD adds a route for point-to-point destination addresses. We don't
really want to specify any destination address, but unfortunately we
have to. Before we tried to cheat by giving our own address as the
destination, but this had the unfortunate effect of preventing
loopback from working on our local ip address. We work around this with
yet another kludge: we set the destination address to 127.0.0.1. Since
127.0.0.1 is already assigned to an interface, this has the same effect
of not specifying a destination address, and therefore we accomplish the
intended behavior.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/freebsd.bash

index e83dbef0a85af36e75017f3e368e798cf5012b0d..93f1a3b772522549ac784cd87a666f335addb35f 100755 (executable)
@@ -158,7 +158,7 @@ add_addr() {
        if [[ $1 == *:* ]]; then
                cmd ifconfig "$INTERFACE" inet6 "$1" alias
        else
-               cmd ifconfig "$INTERFACE" inet "$1" "${1%%/*}" alias
+               cmd ifconfig "$INTERFACE" inet "$1" 127.0.0.1 alias
        fi
 }