[BUG] Address Subnet CIDR caclulation bug #579

Closed
opened 2025-11-13 12:04:56 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @jackrosenberg on GitHub (Aug 12, 2025).

When creating a new site via the API, the calculation for CIDR range appears to be going wrong.

curl -X 'PUT' \
  'https://api.DASHBOARDl/v1/org/test/site' \
  -H 'accept: */*' \
  -H 'Authorization: Bearer ADMIN_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "test_site",
  "exitNodeId": 1,
  "pubKey": "this.is.the.public.key",
  "subnet": "100.90.128.0/24",
  "newtId": "this.is.the.newt.id",
  "secret": "1234567890",
  "address": "100.90.128.0",
  "type": "newt"
}'

gives:

{
  "data": null,
  "success": false,
  "error": true,
  "message": "IP is not in the CIDR range of the subnet.",
  "status": 400,
  "stack": null
}
Originally created by @jackrosenberg on GitHub (Aug 12, 2025). When creating a new site via the API, the calculation for CIDR range appears to be going wrong. ``` curl -X 'PUT' \ 'https://api.DASHBOARDl/v1/org/test/site' \ -H 'accept: */*' \ -H 'Authorization: Bearer ADMIN_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "name": "test_site", "exitNodeId": 1, "pubKey": "this.is.the.public.key", "subnet": "100.90.128.0/24", "newtId": "this.is.the.newt.id", "secret": "1234567890", "address": "100.90.128.0", "type": "newt" }' ``` gives: ``` { "data": null, "success": false, "error": true, "message": "IP is not in the CIDR range of the subnet.", "status": 400, "stack": null } ```
GiteaMirror added the stale label 2025-11-13 12:04:56 -06:00
Author
Owner

@oschwartz10612 commented on GitHub (Aug 13, 2025):

This is a failure on naming vars on my side. When you define an address this is the address that newt will use in client mode when accepting clients. This address needs to be in the same subnet as the org not the subnet on the site. The subnet on the site is used to connect to gerbil in normal operation and should be in the subnet of the exit node. This gets overwritten now when it connects to an exit node if needed.

Does that help?

@oschwartz10612 commented on GitHub (Aug 13, 2025): This is a failure on naming vars on my side. When you define an address this is the address that newt will use in _client_ mode when accepting clients. This address needs to be in the same subnet as the _org_ not the subnet on the site. The subnet on the site is used to connect to gerbil in normal operation and should be in the subnet of the exit node. This gets overwritten now when it connects to an exit node if needed. Does that help?
Author
Owner

@jackrosenberg commented on GitHub (Aug 14, 2025):

I believe so, will try this out once SQLite and python stop fighting me at every step!

@jackrosenberg commented on GitHub (Aug 14, 2025): I believe so, will try this out once SQLite and python stop fighting me at every step!
Author
Owner

@github-actions[bot] commented on GitHub (Aug 29, 2025):

This issue has been automatically marked as stale due to 14 days of inactivity. It will be closed in 14 days if no further activity occurs.

@github-actions[bot] commented on GitHub (Aug 29, 2025): This issue has been automatically marked as stale due to 14 days of inactivity. It will be closed in 14 days if no further activity occurs.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#579