unioslo / mreg

GNU General Public License v3.0
7 stars 13 forks source link

Using the networks endpoint with the wrong netmask may give 500 errors. #516

Open terjekv opened 11 months ago

terjekv commented 11 months ago

This is not ideal. Assume 172.16.20.0/22 exists:

$ curl -s -H "Authorization: Token $(cat ~/.mreg-cli_auth_token  | cut -d "¤" -f2)" 'https://.../api/v1/networks/172.16.20.0%2f20/used_host_list'

<!doctype html>
<html lang="en">
<head>
  <title>Server Error (500)</title>
</head>
<body>
  <h1>Server Error (500)</h1><p></p>
</body>
</html>
curl -v -s -H "Authorization: Token $(cat ~/.mreg-cli_auth_token  | cut -d "¤" -f2)" 'https://.../api/v1/networks/172.16.20.0%2f22/used_host_list'
{"172.16.20.1", "gateway"}