tUpdate wireguard/tun version - icmphop - Add hops in ipv6 traceroute
(HTM) git clone git://git.z3bra.org/icmphop.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit bbd0df075e2820375fb0f66bcee290e8596d2399
(DIR) parent 78d7939eb890f450394dc3e0e5ae56d93bb48065
(HTM) Author: Willy Goiffon <contact@z3bra.org>
Date: Mon, 15 Apr 2024 13:39:54 +0200
Update wireguard/tun version
Diffstat:
M go.mod | 10 +++++-----
M icmphop.go | 22 +++++++++++++++-------
2 files changed, 20 insertions(+), 12 deletions(-)
---
(DIR) diff --git a/go.mod b/go.mod
t@@ -1,13 +1,13 @@
module z3bra.org/icmphop
-go 1.19
+go 1.20
require (
- golang.org/x/net v0.0.0-20221004154528-8021a29435af
- golang.zx2c4.com/wireguard v0.0.0-20220920152132-bb719d3a6e2c
+ golang.org/x/net v0.24.0
+ golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
)
require (
- golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
- golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 // indirect
+ golang.org/x/sys v0.19.0 // indirect
+ golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
)
(DIR) diff --git a/icmphop.go b/icmphop.go
t@@ -129,18 +129,25 @@ func main() {
src := make([]byte, 16)
dst := make([]byte, 16)
- buf := make([]byte, *mtu+TUN_HEADER)
- sz, err := tun.Read(buf, TUN_HEADER)
+ lens := make([]int, 1)
+ bufs := make([][]byte, 1)
+ bufs[0] = make([]byte, *mtu+TUN_HEADER)
+ n, err := tun.Read(bufs, lens, TUN_HEADER)
if err != nil {
log.Fatalf("Read %s: %s", *ifname, err.Error())
}
+ if n < 1 {
+ continue
+ }
+
+ sz := lens[0]
// Invalid packet, ignore it
if sz < IPV6_HEADER {
continue
}
- packet := buf[TUN_HEADER : TUN_HEADER+sz]
+ packet := bufs[0][TUN_HEADER : TUN_HEADER+sz]
/*
* Skip packet if the specified number of hops cannot
t@@ -207,9 +214,10 @@ func main() {
}
// Construct final return packet
- b := make([]byte, TUN_HEADER)
- b = append(b, ipv6...)
- b = append(b, icmp...)
+ b := make([][]byte, 1)
+ b[0] = make([]byte, TUN_HEADER)
+ b[0] = append(b[0], ipv6...)
+ b[0] = append(b[0], icmp...)
if *verbose == true {
log.Printf("%s %s > %s ICMP Type 0x%02x Code %d (%d bytes)",
t@@ -218,7 +226,7 @@ func main() {
net.IP(dst).String(),
icmp[0],
icmp[1],
- len(b))
+ len(b[0]))
}
tun.Write(b, TUN_HEADER)