]> git.ipfire.org Git - thirdparty/wireguard-tools.git/commitdiff
wg-quick: linux: quote ifname for nft
authorJason A. Donenfeld <Jason@zx2c4.com>
Sat, 28 Dec 2019 17:35:12 +0000 (18:35 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sat, 28 Dec 2019 17:35:41 +0000 (18:35 +0100)
Otherwise nft(8) has strange ideas of what a string is.

Suggested-by: RistiCore <RistiCore@mail.ee>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
src/wg-quick/linux.bash

index e9c90520728de2ea2cfc958f99bf41384b083c03..cd5e06604ce4e7e866992a1cc9d1c61cccef19a6 100755 (executable)
@@ -227,7 +227,7 @@ add_default() {
        while read -r line; do
                [[ $line =~ .*inet6?\ ([0-9a-f:.]+)/[0-9]+.* ]] || continue
                printf -v restore '%s-I PREROUTING ! -i %s -d %s -m addrtype ! --src-type LOCAL -j DROP %s\n' "$restore" "$INTERFACE" "${BASH_REMATCH[1]}" "$marker"
-               printf -v nftcmd '%sadd rule %s %s preraw iifname != %s %s daddr %s fib saddr type != local drop\n' "$nftcmd" "$pf" "$nftable" "$INTERFACE" "$pf" "${BASH_REMATCH[1]}"
+               printf -v nftcmd '%sadd rule %s %s preraw iifname != "%s" %s daddr %s fib saddr type != local drop\n' "$nftcmd" "$pf" "$nftable" "$INTERFACE" "$pf" "${BASH_REMATCH[1]}"
        done < <(ip -o $proto addr show dev "$INTERFACE" 2>/dev/null)
        printf -v restore '%sCOMMIT\n*mangle\n-I POSTROUTING -m mark --mark %d -p udp -j CONNMARK --save-mark %s\n-I PREROUTING -p udp -j CONNMARK --restore-mark %s\nCOMMIT\n' "$restore" $table "$marker" "$marker"
        printf -v nftcmd '%sadd rule %s %s postmangle meta l4proto udp mark %d ct mark set mark \n' "$nftcmd" "$pf" "$nftable" $table