Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web: not possible to add a connection address using a netmask #1846

Closed
dgdavid opened this issue Dec 20, 2024 · 1 comment · Fixed by #1847
Closed

web: not possible to add a connection address using a netmask #1846

dgdavid opened this issue Dec 20, 2024 · 1 comment · Fixed by #1847
Assignees
Labels
bug Something isn't working

Comments

@dgdavid
Copy link
Contributor

dgdavid commented Dec 20, 2024

While trying to add an IP address to a connection using a netmask instead of a prefix length the request fails silently.

It is a problem from two point of view:

  • The form says user can users a netmask, but actually they cannot
  • The form is sent as successful request, but actually it failed

The root of the problem could be in the formatIp network utility, which does not take care to convert the netmask to a prefix length. It is called by connection#toApi.

Or maybe the backend should allow netmask too.

Below the error from axios

{
    "message": "Request failed with status code 422",
    "name": "AxiosError",
    "stack": "AxiosError: Request failed with status code 422\n    at settle (http://localhost:8080/index.js:129393:12)\n    at XMLHttpRequest.onloadend (http://localhost:8080/index.js:127842:66)\n    at Axios.request (http://localhost:8080/index.js:128382:41)",
    "config": {
        "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
        },
        "adapter": [
            "xhr",
            "http",
            "fetch"
        ],
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "timeout": 0,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1,
        "maxBodyLength": -1,
        "env": {},
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/json"
        },
        "responseType": "json",
        "method": "put",
        "url": "/api/network/connections/Wired connection 1",
        "data": "{\"id\":\"Wired connection 1\",\"status\":\"up\",\"nameservers\":[],\"method4\":\"manual\",\"method6\":\"auto\",\"interface\":\"enp1s0\",\"addresses\":[\"192.168.122.195/24\",\"192.168.122.196/22\",\"192.168.122.197/255.255.255.0\"]}"
    },
    "code": "ERR_BAD_REQUEST",
    "status": 422
}
@dgdavid
Copy link
Contributor Author

dgdavid commented Dec 20, 2024

Note: while fixing the issue would be worth reviewing network mutations, queries, and query invalidations.

@dgdavid dgdavid added the bug Something isn't working label Dec 20, 2024
@dgdavid dgdavid assigned teclator and dgdavid and unassigned teclator Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants