# Pastebin xPjmUA25 # We test that Netlink/IPC is working properly by doing things that usually cause split responses ip0 link add dev wg0 type wireguard config=( "[Interface]" "PrivateKey=$(wg genkey)" "[Peer]" "PublicKey=$(wg genkey)" ) for a in {1..255}; do for b in {0..255}; do config+=( "AllowedIPs=$a.$b.0.0/16,$a::$b/128" ) done done n0 wg setconf wg0 <(printf '%s\n' "${config[@]}") i=0 for ip in $(n0 wg show wg0 allowed-ips); do ((++i)) done ((i == 255*256*2+1)) ip0 link del wg0 ip0 link add dev wg0 type wireguard config=( "[Interface]" "PrivateKey=$(wg genkey)" ) for a in {1..40}; do config+=( "[Peer]" "PublicKey=$(wg genkey)" ) for b in {1..52}; do config+=( "AllowedIPs=$a.$b.0.0/16" ) done done n0 wg setconf wg0 <(printf '%s\n' "${config[@]}") i=0 while read -r line; do j=0 for ip in $line; do ((++j)) done ((j == 53)) ((++i)) done < <(n0 wg show wg0 allowed-ips) ((i == 40)) ip0 link del wg0 ip0 link add wg0 type wireguard config=( ) for i in {1..29}; do config+=( "[Peer]" "PublicKey=$(wg genkey)" ) done config+=( "[Peer]" "PublicKey=$(wg genkey)" "AllowedIPs=255.2.3.4/32,abcd::255/128" ) n0 wg setconf wg0 <(printf '%s\n' "${config[@]}") n0 wg showconf wg0 > /dev/null ip0 link del wg0 allowedips=( ) for i in {1..197}; do allowedips+=( abcd::$i ) done saved_ifs="$IFS" IFS=, allowedips="${allowedips[*]}" IFS="$saved_ifs" ip0 link add wg0 type wireguard n0 wg set wg0 peer "$pub1" n0 wg set wg0 peer "$pub2" allowed-ips "$allowedips" { read -r pub allowedips [[ $pub == "$pub1" && $allowedips == "(none)" ]] read -r pub allowedips [[ $pub == "$pub2" ]] i=0 for _ in $allowedips; do ((++i)) done ((i == 197)) } < <(n0 wg show wg0 allowed-ips) ip0 link del wg0