pex: add support for figuring out the external data port via STUN servers
[project/unetd.git] / wg-linux.c
index a9f37b9d443b1ba54c50119b7f5131c5ca38120b..9eaa9c4ec622b2b3e2bc76093243cf28951495c2 100644 (file)
@@ -102,7 +102,7 @@ wg_linux_init_local(struct network *net, struct network_peer *peer)
        struct nl_msg *msg;
 
        msg = wg_genl_msg(net, true);
-       nla_put_u16(msg, WGDEVICE_A_LISTEN_PORT, peer->port);
+       nla_put_u16(msg, WGDEVICE_A_LISTEN_PORT, peer ? peer->port : 0);
 
        return wg_genl_call(msg);
 }