occtl iroutes outputs invalid JSON
Description of problem
When running occtl -j show iroutes, the output is not a proper JSON array but a malformed JSON object. Multiple keys like "ID" and "IP" appear at the same level, which is invalid JSON and prevents proper parsing.
Steps to reproduce
- Run the command:
occtl -j show iroutes
- Observe the output (malformed JSON as returned):
{
"ID": 1,
"Username": "masoud1",
"vhost": "default",
"Device": "vpns1",
"IP": "172.16.24.241",
"iRoutes": [],
"IP": "172.16.24.241"
"ID": 2,
"Username": "masoud2",
"vhost": "default",
"Device": "vpns0",
"IP": "172.16.24.70",
"iRoutes": [],
"IP": "172.16.24.70"
}
Expected behavior
The command should return a JSON array of objects instead of a single object with repeated keys. Example of valid output:
[
{
"ID": 1,
"Username": "masoud1",
"vhost": "default",
"Device": "vpns1",
"IP": "172.16.24.241",
"iRoutes": []
},
{
"ID": 2,
"Username": "masoud2",
"vhost": "default",
"Device": "vpns0",
"IP": "172.16.24.70",
"iRoutes": []
}
]
Version of Ocserv used
- Ocserv version: 1.3.0
- OS tested: Debian 12, Debian 13, Ubuntu 22.04
- Issue persists on all tested systems
Additional info
- The
occtl -joutput is difficult to consume in scripts or JSON parsers. -
occtl show irouteswithout-jalways shows nothing, making it impossible to verify routes.