<feed xmlns='http://www.w3.org/2005/Atom'>
<title>wireguard-tools/src/wg-quick, branch master</title>
<subtitle>Required tools for WireGuard, such as wg(8) and wg-quick(8)</subtitle>
<id>https://git.zx2c4.com/wireguard-tools/atom/src/wg-quick?h=master</id>
<link rel='self' href='https://git.zx2c4.com/wireguard-tools/atom/src/wg-quick?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/'/>
<updated>2026-05-06T21:21:24Z</updated>
<entry>
<title>wg-quick: darwin: properly parse netstat -nr output</title>
<updated>2026-05-06T21:21:24Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2026-05-06T21:21:24Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=a998407747005ea7e4e0258d96f105c97241e1d3'/>
<id>urn:sha1:a998407747005ea7e4e0258d96f105c97241e1d3</id>
<content type='text'>
Looking at the source [1], it appears that the interface is always the
4th argument, regardless of the family:

C1.	if (fam != old_fam) // FALSE

P1.	p_sockaddr(params, &amp;addr.u_sa, &amp;mask.u_sa, rtm-&gt;rtm_flags,
	    WID_DST(addr.u_sa.sa_family));

P2.	p_sockaddr(params, rti_info[RTAX_GATEWAY], NULL, RTF_HOST,
	    WID_GW(addr.u_sa.sa_family));

C2.	if (params-&gt;lflag &amp;&amp; (rtm-&gt;rtm_addrs &amp; RTA_IFA)) // FALSE

P3.	p_flags(rtm-&gt;rtm_flags, "%-10.10s ");

C3.	if (params-&gt;lflag) // FALSE

P4. 	printf("%*.*s", WID_IF(addr.u_sa.sa_family),
		WID_IF(addr.u_sa.sa_family), ifname);

Because C1, C2, and C3 evaluate to false, interface is always in the 4th
argument.

[1] https://github.com/apple-oss-distributions/network_cmds/blob/97e27e6244c16d399bfeb254315ddc5828711c56/netstat.tproj/route.c#L328

Reported-by: Florian Uekermann &lt;florian@uekermann.me&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>global: bump copyright</title>
<updated>2026-03-21T11:20:43Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2026-03-21T11:20:43Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=997ffa0c89b4a6a3998325ceeb55588bb0cf8017'/>
<id>urn:sha1:997ffa0c89b4a6a3998325ceeb55588bb0cf8017</id>
<content type='text'>
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: linux: do not unnecessarily set sysctl</title>
<updated>2026-02-23T21:54:42Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2026-02-23T21:54:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=ac74ed6d7dd4d77f56c7f05c053a5e645e0e33a0'/>
<id>urn:sha1:ac74ed6d7dd4d77f56c7f05c053a5e645e0e33a0</id>
<content type='text'>
In some restrictive container namespaces, sysctl is locked down and
can't be changed. This shouldn't be a problem, though, at least in
theory, because net.ipv4.conf.all.src_valid_mark is already 1. However,
currently wg-quick unconditionally sets it. Instead, check to see if
it's already 1 before trying make it 1.

Suggested-by: Dean P &lt;dean@apakossa.org&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: use addconf instead of setconf</title>
<updated>2025-06-19T15:08:50Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2025-06-19T14:58:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=0b7d9821f2815973a2930ace28a3f73c205d0e5c'/>
<id>urn:sha1:0b7d9821f2815973a2930ace28a3f73c205d0e5c</id>
<content type='text'>
The example in the man page at some point changed:

-    \fBPostUp = wg set %i private-key &lt;(pass WireGuard/private-keys/%i)\fP
+    \fBPreUp = wg set %i private-key &lt;(pass WireGuard/private-keys/%i)\fP

This is actually wrong because PreUp is followed by set_config(), which
calls `wg setconf`, which in turn deletes the private key from the
interface because it is missing from the configuration. Replacing this
with `wg addconf` is safe to do because the interface is newly created.

Suggested-by: Matthias Dressel &lt;code@deadcode.eu&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: linux: deal with resolvconf migration more gracefully</title>
<updated>2025-05-23T19:01:53Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2025-05-23T18:59:38Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=d3b40aff964789a2a0533cb7a070592a75a996e3'/>
<id>urn:sha1:d3b40aff964789a2a0533cb7a070592a75a996e3</id>
<content type='text'>
When Ubuntu systems upgrade from Debian's atrocious resolvconf to the
systemd-resolve symlink, they sometimes leave around
/etc/resolvconf/interface-order, which then winds up breaking the
detection and passing the bogus 'tun.' prefix to systemd's resolvconf,
resulting in failure. Work around this by only doing the 'tun.' prefix
hack if resolvconf isn't a symlink. This is ugly but so it goes.

Reported-by: Andrei Borzenkov &lt;arvidjaar@gmail.com&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: pass on # comments to {Pre,Post}{Up,Down}</title>
<updated>2025-05-23T18:43:30Z</updated>
<author>
<name>Robyn Kosching</name>
<email>robyn@kosching.me</email>
</author>
<published>2025-01-15T11:33:50Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=90deacd33da06534ee98d41c6e76e108b35cf077'/>
<id>urn:sha1:90deacd33da06534ee98d41c6e76e108b35cf077</id>
<content type='text'>
Currently commands in {Pre,Post}{Up,Down} are stripped of everything
starting with the first #, even if the # is escaped or in a string. This
patch leaves comment interpretation to the shell, as it can presumably
already handle the difference between comments and escaped #.

Signed-off-by: Robyn Kosching &lt;robyn@kosching.me&gt;
[Jason: massage commit message, port to other platforms]
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: linux: use smallest mtu, not largest</title>
<updated>2025-05-21T21:07:59Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2025-05-21T21:03:08Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=5150cd647073be1f1c12688aef291bdf17970154'/>
<id>urn:sha1:5150cd647073be1f1c12688aef291bdf17970154</id>
<content type='text'>
By accident, this function was looking at the endpoint with the largest
MTU rather than the smallest one.

Reported-by: Ismael Bouya &lt;ismael@bouya.org&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: linux: add 'dev' to 'ip link add' to avoid keyword conflicts</title>
<updated>2025-05-20T22:16:18Z</updated>
<author>
<name>TriangleSnake</name>
<email>trianglesnake2002@gmail.com</email>
</author>
<published>2025-05-05T07:13:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=a2dbc3377e0f16f57f856e696162da62ab5b3766'/>
<id>urn:sha1:a2dbc3377e0f16f57f856e696162da62ab5b3766</id>
<content type='text'>
Signed-off-by: TriangleSnake &lt;trianglesnake2002@gmail.com&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: run PreUp hook after creating interface</title>
<updated>2023-05-18T14:38:34Z</updated>
<author>
<name>Daniel Gröber</name>
<email>dxld@darkboxed.org</email>
</author>
<published>2022-12-07T18:00:31Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=e6888dd74ee4215449517f43aba9c11a1633ea4e'/>
<id>urn:sha1:e6888dd74ee4215449517f43aba9c11a1633ea4e</id>
<content type='text'>
Currently PreUp hooks run before the interface is created. This is
problematic for moving the device into a Linux VRFs as this will
currently clear all assigned IPv6 addressess (possibly a bug), so if we
did this in PostUp (i.e. before add_addr) we'll have to manually re-add
all assigned addresses. This is obviously less than ideal.

Instead create the wg device just before running PreUp hooks. We apply
this to all platforms for consistency.

Test case:

    $ ip link add vrf-test type vrf table 1234
    $ ip link add wg-test type wireguard
    $ ip addr add dev wg-test 192.168.42.42/24
    $ ip addr add dev wg-test fe80::/64

    $ ip -br addr show wg-test
    wg-test          DOWN           192.168.42.42/24 fe80::/64

    $ ip link set dev wg-test master vrf-test

    $ ip -br addr show wg-test
    wg-test          DOWN           192.168.42.42/32

Signed-off-by: Daniel Gröber &lt;dxld@darkboxed.org&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
<entry>
<title>wg-quick: linux: prevent traffic from momentarily leaking into tunnel</title>
<updated>2022-06-17T11:53:43Z</updated>
<author>
<name>Tom Yan</name>
<email>tom.ty89@gmail.com</email>
</author>
<published>2022-06-17T11:34:19Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/wireguard-tools/commit/?id=71799a8f6d1450b63071a21cad6ed434b348d3d5'/>
<id>urn:sha1:71799a8f6d1450b63071a21cad6ed434b348d3d5</id>
<content type='text'>
The wireguard route table ip rule should stay as a no-op until the
`suppress_prefixlength 0 table main` rule is in effect. Therefore, add
the wireguard default route to its route table after the latter rule is
added.

Signed-off-by: Tom Yan &lt;tom.ty89@gmail.com&gt;
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
</content>
</entry>
</feed>
