Post Ak38f0WJMERLLOxBCa by hp@mastodon.tmm.cx
 (DIR) More posts by hp@mastodon.tmm.cx
 (DIR) Post #Ak2Rcv4iKr6LqenrUm by nicd@social.ahlcode.fi
       2024-07-18T00:04:42.284Z
       
       0 likes, 1 repeats
       
       So I made this little #UDP proxy: https://git.ahlcode.fi/nicd/valproxy/src/commit/879287a6f419efc0b41602e764bbef0d614aeff7/index.jsIt takes in UDP packets from a #Systemd socket and passes their content on to a local target. This part seems to work well, as the server replies with its own packets. On line 168 the contents of the replies are written back to the original socket, using the source address and port (meaning the remote address and remote port of the client that sent the original UDP packet). To my knowledge, this should make the packets route right back to the remote client.But currently I don't get anything back. All the replies are lost somewhere. I don't exactly know where, but I know it's after they're written to the Systemd socket and they don't appear in Wireshark on the client.Have I misunderstood how UDP works? Or networking for that matter? Any common gotchas I should look at? (Except, of course, not doing this silly thing in the first place. But let's not get into that here.)Please boost if you know any networking geeks. :)#networking #help #JavaScript
       
 (DIR) Post #Ak38f0WJMERLLOxBCa by hp@mastodon.tmm.cx
       2024-07-18T00:35:25Z
       
       0 likes, 0 repeats
       
       @nicd how are you getting the systemd socket? Are you doing socket activation?
       
 (DIR) Post #Ak38f1RjuiNSDVp2iO by nicd@social.ahlcode.fi
       2024-07-18T06:22:00.757Z
       
       0 likes, 0 repeats
       
       @hp@mastodon.tmm.cx Yeah, ListenDatagram=5678
       
 (DIR) Post #Ak38f2fbMf3m0nJcxc by nicd@social.ahlcode.fi
       2024-07-18T08:29:21.657Z
       
       1 likes, 0 repeats
       
       @hp@mastodon.tmm.cx I found the issue! I was getting the rinfo.address (remote client address) as a mapped dual stack address (::ffff:1.2.3.4). I have to drop the ::ffff: prefix when writing the reply. Then the packets make it back to the client! :)