Skip to content

Commit f71fcc2

Browse files
committed
ipn/wg: choose msg type from lower random bits
1 parent 83585b2 commit f71fcc2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

intra/ipn/wg/wgconn.go

+2
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ func isWgMsgInit(x byte) bool {
440440
// We decided to put our identifier in this region and still support messages
441441
// from other WireGuard clients (albeit with less reliable routing than we can
442442
// offer).
443+
// Though the open source Cloudflare WARP boring-tun impl does not do so:
444+
// github.com/cloudflare/boringtun/blob/64a2fc7c63/boringtun/src/noise/handshake.rs#L734
443445
return x == device.MessageInitiationType
444446
}
445447

intra/ipn/wgproxy.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,12 @@ func NewWgProxy(id string, ctl protect.Controller, rev netstack.GConnHandler, cf
523523
// github.com/bepass-org/warp-plus/blob/19ac233cc6/wiresocks/config.go#L184
524524
var reservedBytes [3]byte
525525
if isRPN(id) {
526-
reservedBytes[0] = uint8(rand.UintN(0x100))
527-
reservedBytes[1] = uint8(rand.UintN(0x100))
528-
reservedBytes[2] = uint8(rand.UintN(0x100))
526+
// reservedBytes[0] = uint8(rand.UintN(0x100))
527+
// reservedBytes[1] = uint8(rand.UintN(0x100))
528+
// reservedBytes[2] = uint8(rand.UintN(0x100))
529+
reservedBytes[0] = uint8(rand.UintN(0x1))
530+
reservedBytes[1] = uint8(rand.UintN(0x2))
531+
reservedBytes[2] = uint8(rand.UintN(0x3))
529532
}
530533

531534
var wgep wgconn

0 commit comments

Comments
 (0)