Primary IPv4 column sorts lexicographically instead of numerically
What installation are you running?
Production (netalertx)
Is there an existing issue for this?
- I have searched the existing open and closed issues and I checked the docs https://docs.netalertx.com/
The issue occurs in the following browsers. Select at least 2.
- Firefox
- Chrome
- Edge
- Safari (unsupported) - PRs welcome
- N/A - This is an issue with the backend
Current Behavior
On the Devices page, sorting by the IPv4 / Primary IPv4 column sorts the addresses alphabetically instead of numerically.
For example, I get an order like:
192.168.1.1
192.168.1.105
192.168.1.106
192.168.1.112
192.168.1.117
192.168.1.120
192.168.1.132
192.168.1.138
192.168.1.139
192.168.1.140
192.168.1.144
192.168.1.15I'm running v26.9.0.
I found #1606, which looks like the same kind of sorting problem, but that issue appears to have been fixed for the IP column in another view. The Primary IPv4 column on the Devices page still seems to sort as a string.
Expected Behavior
IPv4 addresses should be sorted numerically.
For example:
192.168.1.1
192.168.1.15
192.168.1.20
192.168.1.21
...
192.168.1.105
192.168.1.106This should behave the same way as the existing numeric IP sorting used elsewhere.
Steps To Reproduce
- Open Devices → All devices.
- Make sure the IPv4 / Primary IPv4 column is visible.
- Click the IPv4 column header to sort ascending.
- Devices are sorted lexicographically, e.g. 192.168.1.105 appears before 192.168.1.15.
Relevant app.conf settings
No special configuration seems to be required. The Primary IPv4 column is enabled in the Devices table.
NetAlertX version: v26.9.0docker-compose.yml
Standard Docker installation using host networking. I don't believe the Docker configuration is relevant to the table sorting issue.Debug or Trace enabled
- I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
Relevant app.log section
No relevant errors are written to app.log when sorting the column. The issue is reproducible directly from the Devices table.
Docker Logs
No relevant Docker log output is produced when sorting the IPv4 column. The issue is reproducible entirely from the Devices table UI.
Source: netalertx/NetAlertX