aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@noconroy.net>2020-03-04 20:29:16 +1100
committerMatt Dunwoodie <ncon@noconroy.net>2020-03-04 20:29:16 +1100
commita920c30d084d19f0414968970e17034106b1d1df (patch)
treea4e4f1a58a87767d02a0f2749c3dcc9471f7be76
parentWe want to stay under load while the timer HASN'T expired (diff)
downloadwireguard-openbsd-a920c30d084d19f0414968970e17034106b1d1df.tar.xz
wireguard-openbsd-a920c30d084d19f0414968970e17034106b1d1df.zip
Attempt to send again after EADDRNOTAVAIL
In the case that the address is not available, say when another interface IP changes, we want to try again without setting any sticky port. This was exacerbated if the local side kept sending packets, such as with the ping command, as the 5 second re-initiation timer would not trigger and therefore not call wg_peer_clear_src.
-rw-r--r--src/if_wg.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/if_wg.c b/src/if_wg.c
index e37ca90..93b3d1e 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -629,6 +629,11 @@ wg_send(struct wg_softc *sc, struct mbuf *m, struct wg_endpoint *e)
if (so != NULL) {
ret = so->so_proto->pr_usrreq(so, PRU_SEND, m, &peernam,
control, NULL);
+ /* If we cannot assign the requested local IP, we attempt to
+ * send again without the 'control' parameter. */
+ if (ret == EADDRNOTAVAIL)
+ ret = so->so_proto->pr_usrreq(so, PRU_SEND, m, &peernam,
+ NULL, NULL);
} else {
ret = ENOTCONN;
m_freem(control);