2
0
Эх сурвалжийг харах

control->Send: Also set the src port

With the source port also set, we only need to enable inbound
firewall rules on the 'server' side of the connection, as
the conntrack will allow replies.
Dave Russell 5 жил өмнө
parent
commit
e9657d571e
1 өөрчлөгдсөн 5 нэмэгдсэн , 0 устгасан
  1. 5 0
      control.go

+ 5 - 0
control.go

@@ -204,7 +204,12 @@ func (c *Control) Send(ip uint32, port uint16, t NebulaMessageSubType, payload [
 	binary.BigEndian.PutUint16(packet[2:4], uint16(length))
 	binary.BigEndian.PutUint16(packet[2:4], uint16(length))
 	binary.BigEndian.PutUint32(packet[12:16], ip2int(c.f.inside.CidrNet().IP.To4()))
 	binary.BigEndian.PutUint32(packet[12:16], ip2int(c.f.inside.CidrNet().IP.To4()))
 	binary.BigEndian.PutUint32(packet[16:20], ip)
 	binary.BigEndian.PutUint32(packet[16:20], ip)
+
+	// Set identical values for src and dst port as they're only
+	// used for nebula firewall rule mataching.
+	binary.BigEndian.PutUint16(packet[20:22], port)
 	binary.BigEndian.PutUint16(packet[22:24], port)
 	binary.BigEndian.PutUint16(packet[22:24], port)
+
 	copy(packet[headerLen:], payload)
 	copy(packet[headerLen:], payload)
 
 
 	nb := make([]byte, 12)
 	nb := make([]byte, 12)