Newt UDP hole punching does not parse ipv6 port correctly #55

Open
opened 2025-11-19 07:12:58 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @kevin-gillet on GitHub (Sep 4, 2025).

Newt version 1.4.4 seems to parse port for hole punching based on what is after the first colon, but this way of working is incompatible with ipv6 because the ipv6 adress is written with multiple colons.

Newt is installed as a systemd service on a debian12-lxc-amd64 container.

root@newt-debian12-lxc-amd64:~# systemctl status newt --no-pager -l
● newt.service - Newt
     Loaded: loaded (/etc/systemd/system/newt.service; enabled; preset: enabled)
     Active: active (running) since Thu 2025-09-04 01:08:47 UTC; 1min 10s ago
 Invocation: 2c220ee5295b4579b7195e664bde8be1
   Main PID: 12761 (newt)
      Tasks: 7 (limit: 76567)
     Memory: 15.4M (peak: 15.9M)
        CPU: 46ms
     CGroup: /system.slice/newt.service
             └─12761 /root/.local/bin/newt --id <redacted> --secret <redacted> --endpoint <redacted> --accept-clients --native

Sep 04 01:09:33 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:33 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
Sep 04 01:09:36 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:36 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
Sep 04 01:09:38 newt-dc03 newt[12761]: INFO: 2025/09/04 01:09:38 Failed to report peer bandwidth: failed to calculate peer bandwidth: failed to get device: file does not exist
Sep 04 01:09:39 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:39 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
Sep 04 01:09:42 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:42 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
Sep 04 01:09:45 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:45 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
Sep 04 01:09:48 newt-dc03 newt[12761]: INFO: 2025/09/04 01:09:48 Failed to report peer bandwidth: failed to calculate peer bandwidth: failed to get device: file does not exist
Sep 04 01:09:48 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:48 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
Sep 04 01:09:51 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:51 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
Sep 04 01:09:54 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:54 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax
root@newt-dc03:~# nslookup <redacted>
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   <redacted>
Address: xxxx:cf06:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx

Here it is parsing "cf06" as the port but it is part of the ipv6 adress.

Originally created by @kevin-gillet on GitHub (Sep 4, 2025). Newt **version 1.4.4** seems to parse port for hole punching based on what is after the first colon, but this way of working is incompatible with ipv6 because the ipv6 adress is written with multiple colons. Newt is installed as a systemd service on a debian12-lxc-amd64 container. ``` root@newt-debian12-lxc-amd64:~# systemctl status newt --no-pager -l ● newt.service - Newt Loaded: loaded (/etc/systemd/system/newt.service; enabled; preset: enabled) Active: active (running) since Thu 2025-09-04 01:08:47 UTC; 1min 10s ago Invocation: 2c220ee5295b4579b7195e664bde8be1 Main PID: 12761 (newt) Tasks: 7 (limit: 76567) Memory: 15.4M (peak: 15.9M) CPU: 46ms CGroup: /system.slice/newt.service └─12761 /root/.local/bin/newt --id <redacted> --secret <redacted> --endpoint <redacted> --accept-clients --native Sep 04 01:09:33 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:33 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax Sep 04 01:09:36 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:36 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax Sep 04 01:09:38 newt-dc03 newt[12761]: INFO: 2025/09/04 01:09:38 Failed to report peer bandwidth: failed to calculate peer bandwidth: failed to get device: file does not exist Sep 04 01:09:39 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:39 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax Sep 04 01:09:42 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:42 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax Sep 04 01:09:45 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:45 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax Sep 04 01:09:48 newt-dc03 newt[12761]: INFO: 2025/09/04 01:09:48 Failed to report peer bandwidth: failed to calculate peer bandwidth: failed to get device: file does not exist Sep 04 01:09:48 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:48 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax Sep 04 01:09:51 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:51 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax Sep 04 01:09:54 newt-dc03 newt[12761]: ERROR: 2025/09/04 01:09:54 Failed to send UDP hole punch: failed to parse server port: strconv.ParseUint: parsing "cf06": invalid syntax root@newt-dc03:~# nslookup <redacted> Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: Name: <redacted> Address: xxxx:cf06:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx ``` Here it is parsing "cf06" as the port but it is part of the ipv6 adress.
Author
Owner

@oschwartz10612 commented on GitHub (Sep 4, 2025):

I think a similar fix that you did in
https://github.com/fosrl/olm/pull/26 would be appropriate here if you
have time! If not I can take a look.

@oschwartz10612 commented on GitHub (Sep 4, 2025): I think a similar fix that you did in https://github.com/fosrl/olm/pull/26 would be appropriate here if you have time! If not I can take a look.
Author
Owner

@kevin-gillet commented on GitHub (Sep 5, 2025):

Hmm more challenge than expected here, the entire network stack is hardcoded to use ipv4, i will try to implement the dual stack to permit ipv6 use.

@kevin-gillet commented on GitHub (Sep 5, 2025): Hmm more challenge than expected here, the entire network stack is hardcoded to use ipv4, i will try to implement the dual stack to permit ipv6 use.
Author
Owner

@kevin-gillet commented on GitHub (Sep 6, 2025):

Made some core changes here on the network stack, can you please test all the edge cases you know to be extensively sure they don't break.

@kevin-gillet commented on GitHub (Sep 6, 2025): Made some core changes here on the network stack, can you please test all the edge cases you know to be extensively sure they don't break.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/newt#55