Bug 254607 - net/wireguard-tools: patch-wg-quick_freebsd.bash-2 cause "Destination address required"
Summary: net/wireguard-tools: patch-wg-quick_freebsd.bash-2 cause "Destination address...
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Bernhard Froehlich
Depends on:
Reported: 2021-03-27 17:55 UTC by Koichiro Iwao
Modified: 2021-04-04 19:42 UTC (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Koichiro Iwao freebsd_committer 2021-03-27 17:55:39 UTC

after recent addition of patch-wg-quick_freebsd.bash-2 broke it. Did you actually test it?

# pkg info|grep wireguard
wireguard-2,1                  Meta-port for Wireguard
wireguard-go-0.0.20210323,1    WireGuard implementation in Go
wireguard-kmod-0.0.20210323    WireGuard implementation for the FreeBSD kernel
wireguard-tools-1.0.20210315_3 Fast, modern and secure VPN Tunnel

# wg-quick up wg0
[#] ifconfig wg create name wgs
[#] wg setconf wg0 /dev/stdin
[#] ifconfig wg0 inet alias
ifconfig: ioctl (SIOCAIFADDR): Destination address required
[#] ifconfig wg0 destroy

wireguard-tools-1.0.20210315_2 was working properly. 

Simple instructions to reproduce:
1. ifconfig wg create name wg0
2. ifconfig wg0 inet alias
3. ifconfig fails with "ifconfig: ioctl (SIOCAIFADDR): Destination address required"

I think the removed argument "${1%%/*}" is necessary. It is the destination address. I haven't test it at FreeBSD 13 but at least patch-wg-quick_freebsd.bash-2 must not be applied on FreeBSD 12.

This works:
ifconfig "$INTERFACE" inet "$1" "${1%%/*}" alias

but his doesn't work actually:
ifconfig "$INTERFACE" inet "$1" alias
Comment 1 Bernhard Froehlich freebsd_committer 2021-03-27 19:37:53 UTC
For comparison this is the output that I have:

[#] ifconfig wg create name wg0
[#] wg setconf wg0 /dev/stdin
[#] ifconfig wg0 inet alias
[#] ifconfig wg0 inet6 2001:470:7527:1111::1/64 alias
[#] ifconfig wg0 mtu 1360
[#] ifconfig wg0 up

It makes me believe that your wg0.conf is wrong. This is the beginning of the interface section:

Address =,2001:470:7527:1111::1/64

Please check that your Address entries need to be subnets.
Comment 2 Koichiro Iwao freebsd_committer 2021-03-28 04:26:01 UTC
(In reply to Bernhard Froehlich from comment #1)
Hmmm, I don't think my config is wrong. Definitely, the config worked with wireguard-tools-1.0.20210315_2 but don't work with wireguard-tools-1.0.20210315_3. 

Simply, even not using wg-quick but running ifconfig commands picked up your wg output directly didn't work.

icepick# ifconfig wg create name wg0
icepick# ifconfig wg0 inet alias
ifconfig: ioctl (SIOCAIFADDR): Destination address required

> [#] ifconfig wg0 inet alias
So, this command requires a destination address.  One more argument is required but oddly it is removed from wg-quick.

FYI, this is my config.

Address =
PrivateKey = 
PublicKey = 
PresharedKey = 
AllowedIps =
Endpoint = server:12345
PersistentKeepAlive = 25
Comment 3 Koichiro Iwao freebsd_committer 2021-03-28 04:36:36 UTC
My bad, reloading the kernel module solved the issue. 

I'm not using WireGuard with rc scripts. I'm just using with only wg-quick. The kernel module is not auto reloaded in such a situation.