1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00

Fixed incomming initiation bug

This commit is contained in:
Mathias Hall-Andersen 2017-07-10 17:20:43 +02:00
parent 44c9896883
commit 9c4acb9f35
2 changed files with 7 additions and 6 deletions

View File

@ -18,9 +18,7 @@ func main() {
} }
deviceName := os.Args[1] deviceName := os.Args[1]
// Open TUN device // open TUN device
// TODO: Fix capabilities
tun, err := CreateTUN(deviceName) tun, err := CreateTUN(deviceName)
log.Println(tun, err) log.Println(tun, err)
@ -29,8 +27,9 @@ func main() {
} }
device := NewDevice(tun, LogLevelDebug) device := NewDevice(tun, LogLevelDebug)
device.log.Info.Println("Starting device")
// Start configuration lister // start configuration lister
socketPath := fmt.Sprintf("/var/run/wireguard/%s.sock", deviceName) socketPath := fmt.Sprintf("/var/run/wireguard/%s.sock", deviceName)
l, err := net.Listen("unix", socketPath) l, err := net.Listen("unix", socketPath)

View File

@ -358,11 +358,13 @@ func (device *Device) RoutineHandshake() {
return return
} }
logDebug.Println("Creating response...")
outElem := device.NewOutboundElement() outElem := device.NewOutboundElement()
writer := bytes.NewBuffer(outElem.data[:0]) writer := bytes.NewBuffer(outElem.data[:0])
binary.Write(writer, binary.LittleEndian, response) binary.Write(writer, binary.LittleEndian, response)
elem.packet = writer.Bytes() outElem.packet = writer.Bytes()
peer.mac.AddMacs(elem.packet) peer.mac.AddMacs(outElem.packet)
addToOutboundQueue(peer.queue.outbound, outElem) addToOutboundQueue(peer.queue.outbound, outElem)
case MessageResponseType: case MessageResponseType: