jhalter / mobius

A Hotline server implemented in Golang for macOS, Linux, and Windows operating systems
MIT License
73 stars 8 forks source link

Problems with double NAT #100

Closed Knezzen closed 9 months ago

Knezzen commented 1 year ago

Hi!

A user behind a double NAT connection is experiencing strange behaviour when trying to upload files and list directories. Getting this in the logs when the user tries to access the "Files" section. The user get's disconnected when this happens.

2023-04-05T11:23:31.617+0200    debug   Received Transaction    {"remoteAddr": "Users.IP.Address:42771", "login": "guest", "name": "UserNick", "RequestType": "TranGetFileNameList"}
2023-04-05T11:23:31.618+0200    error   PANIC   {"err": "runtime error: index out of range [2] with length 0", "trace": "goroutine 6 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x65\ngithub.com/jhalter/mobius/hotline.dontPanic(0xc0003c6000?)\n\t/home/circleci/project/hotline/panic.go:13 +0xb2\npanic({0x7f3700, 0xc00001c1e0})\n\t/usr/local/go/src/runtime/panic.go:890 +0x262\ngithub.com/jhalter/mobius/hotline.(*FilePathItem).Write(...)\n\t/home/circleci/project/hotline/file_path.go:37\ngithub.com/jhalter/mobius/hotline.(*FilePath).Write(0xc000022080, {0xc0000205ba, 0x2, 0x2})\n\t/home/circleci/project/hotline/file_path.go:64 +0x385\ngithub.com/jhalter/mobius/hotline.readPath({0xc0003368e8, 0x18}, {0xc0000205ba, 0x2, 0x2}, {0x0, 0x0, 0x4bf3a6?})\n\t/home/circleci/project/hotline/file_path.go:97 +0x91\ngithub.com/jhalter/mobius/hotline.HandleGetFileNameList(0xc0003c6000, 0xc00047e480)\n\t/home/circleci/project/hotline/transaction_handlers.go:1686 +0xe9\ngithub.com/jhalter/mobius/hotline.(*ClientConn).handleTransaction(0xc0003c6000, {0x0, 0x0, 0x0, {0xc0000205a2, 0x2, 0x1a}, {0xc0000205a4, 0x4, 0x18}, ...})\n\t/home/circleci/project/hotline/client_conn.go:82 +0xae3\ngithub.com/jhalter/mobius/hotline.(*Server).handleNewConnection(0xc00033aff0, {0x2?, 0x2?}, {0x7f44583d8818, 0xc000014028}, {0xc000336528, 0x13})\n\t/home/circleci/project/hotline/server.go:731 +0x2c65\ngithub.com/jhalter/mobius/hotline.(*Server).Serve.func1()\n\t/home/circleci/project/hotline/server.go:197 +0x1ba\ncreated by github.com/jhalter/mobius/hotline.(*Server).Serve\n\t/home/circleci/project/hotline/server.go:193 +0x98\n"}
jhalter commented 1 year ago

Thanks, I'll investigate. I suspect there's something else going wrong here unrelated to NAT.

jhalter commented 1 year ago

I think I've fixed the bug in #104, released as 0.10.22