diff options
author | euxane | 2024-11-30 09:27:40 +0100 |
---|---|---|
committer | euxane | 2024-11-30 09:27:40 +0100 |
commit | 096a9b17ac3445daa11e7e1b2e702c70bd0e4ee4 (patch) | |
tree | 7c006f9df8949c9cf272489b9a1e6b874122e047 /ping.nim | |
parent | 9df9f0c41ea6aa59cb34151c0505f6fae36ef12e (diff) | |
download | tickwatch-096a9b17ac3445daa11e7e1b2e702c70bd0e4ee4.tar.gz |
ping: use current sender address at each request
The sending IP address can change after the start of the program.
That's happening regularly with IPv6 SLAAC privacy extensions.
Diffstat (limited to 'ping.nim')
-rw-r--r-- | ping.nim | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -217,11 +217,11 @@ proc initPingMonitor*(target: IpAddress, ident: uint16): PingMonitor = | |||
217 | PingMonitor( | 217 | PingMonitor( |
218 | socket: newSocket(domain, SOCK_RAW, proto), | 218 | socket: newSocket(domain, SOCK_RAW, proto), |
219 | target: target, | 219 | target: target, |
220 | source: getPrimaryIPAddr(target), | ||
221 | ident: ident, | 220 | ident: ident, |
222 | ) | 221 | ) |
223 | 222 | ||
224 | func buildEchoRequest(mon: PingMonitor): ICMPPacket = | 223 | proc buildEchoRequest(mon: PingMonitor): ICMPPacket = |
224 | mon.source = getPrimaryIPAddr(dest=mon.target) | ||
225 | buildEchoRequest(mon.source, mon.target, mon.ident, mon.seqNum, mon.payload) | 225 | buildEchoRequest(mon.source, mon.target, mon.ident, mon.seqNum, mon.payload) |
226 | 226 | ||
227 | proc sendEchoRequest(mon: PingMonitor, timeout: Duration) = | 227 | proc sendEchoRequest(mon: PingMonitor, timeout: Duration) = |