diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-06-29 14:39:21 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-06-29 14:39:21 +0200 |
commit | 7e185db1418635a28e5aacbd17b1f17b9ab89e35 (patch) | |
tree | e617d1dbca6c3d45207f9db145ec270bf8496132 /src/send.go | |
parent | 1f0976a26c1d0a6b5eb2c0aa993f12d89f96eed2 (diff) |
Completed get/set configuration
For debugging of "outbound flow"
Mostly, a few things still missing
Diffstat (limited to 'src/send.go')
-rw-r--r-- | src/send.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/send.go b/src/send.go index 4ff75db..ab75750 100644 --- a/src/send.go +++ b/src/send.go @@ -61,9 +61,11 @@ func (peer *Peer) InsertOutbound(elem *QueueOutboundElement) { * Obs. Single instance per TUN device */ func (device *Device) RoutineReadFromTUN(tun TUNDevice) { + device.log.Debug.Println("Routine, TUN Reader: started") for { // read packet + device.log.Debug.Println("Read") packet := make([]byte, 1<<16) // TODO: Fix & avoid dynamic allocation size, err := tun.Read(packet) if err != nil { @@ -76,8 +78,6 @@ func (device *Device) RoutineReadFromTUN(tun TUNDevice) { continue } - device.log.Debug.Println("New packet on TUN:", packet) // TODO: Slow debugging, remove. - // lookup peer var peer *Peer @@ -85,10 +85,12 @@ func (device *Device) RoutineReadFromTUN(tun TUNDevice) { case IPv4version: dst := packet[IPv4offsetDst : IPv4offsetDst+net.IPv4len] peer = device.routingTable.LookupIPv4(dst) + device.log.Debug.Println("New IPv4 packet:", packet, dst) case IPv6version: dst := packet[IPv6offsetDst : IPv6offsetDst+net.IPv6len] peer = device.routingTable.LookupIPv6(dst) + device.log.Debug.Println("New IPv6 packet:", packet, dst) default: device.log.Debug.Println("Receieved packet with unknown IP version") @@ -97,7 +99,7 @@ func (device *Device) RoutineReadFromTUN(tun TUNDevice) { if peer == nil { device.log.Debug.Println("No peer configured for IP") - return + continue } // insert into nonce/pre-handshake queue |