summaryrefslogtreecommitdiffhomepage
path: root/src/receive.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-07-31 22:26:55 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-07-31 22:26:55 +0200
commitd7a49b8b8c43d92fd601d32b2f5130d2dabbc748 (patch)
tree488f2c92632437207612c85c7ca6714822572cd4 /src/receive.go
parent1fb00e8045b4e3f5466c0ea9b829e9865008c09b (diff)
Verify source address
Diffstat (limited to 'src/receive.go')
-rw-r--r--src/receive.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/receive.go b/src/receive.go
index c74211b..700b894 100644
--- a/src/receive.go
+++ b/src/receive.go
@@ -508,8 +508,8 @@ func (peer *Peer) RoutineSequentialReceiver() {
// verify IPv4 source
- dst := elem.packet[IPv4offsetDst : IPv4offsetDst+net.IPv4len]
- if device.routingTable.LookupIPv4(dst) != peer {
+ src := elem.packet[IPv4offsetSrc : IPv4offsetSrc+net.IPv4len]
+ if device.routingTable.LookupIPv4(src) != peer {
logInfo.Println("Packet with unallowed source IP from", peer.String())
return
}
@@ -529,8 +529,8 @@ func (peer *Peer) RoutineSequentialReceiver() {
// verify IPv6 source
- dst := elem.packet[IPv6offsetDst : IPv6offsetDst+net.IPv6len]
- if device.routingTable.LookupIPv6(dst) != peer {
+ src := elem.packet[IPv6offsetSrc : IPv6offsetSrc+net.IPv6len]
+ if device.routingTable.LookupIPv6(src) != peer {
logInfo.Println("Packet with unallowed source IP from", peer.String())
return
}