From 3aaaea6309bb159dffe5e765f73e4d76c23e3074 Mon Sep 17 00:00:00 2001 From: Ryan Huber Date: Mon, 15 Mar 2021 12:58:23 -0700 Subject: [PATCH] don't allow a useless handshake with yourself (#402) * don't allow a useless handshake with yourself * remove helper --- handshake_ix.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/handshake_ix.go b/handshake_ix.go index f7cf031..f7310d2 100644 --- a/handshake_ix.go +++ b/handshake_ix.go @@ -107,6 +107,14 @@ func ixHandshakeStage1(f *Interface, addr *udpAddr, packet []byte, h *Header) { certName := remoteCert.Details.Name fingerprint, _ := remoteCert.Sha256Sum() + if vpnIP == ip2int(f.certState.certificate.Details.Ips[0].IP) { + l.WithField("vpnIp", IntIp(vpnIP)).WithField("udpAddr", addr). + WithField("certName", certName). + WithField("fingerprint", fingerprint). + WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Refusing to handshake with myself") + return + } + myIndex, err := generateIndex() if err != nil { l.WithError(err).WithField("vpnIp", IntIp(vpnIP)).WithField("udpAddr", addr).