summaryrefslogtreecommitdiffstats
path: root/src/status.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-11-12 15:04:27 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-11-12 15:04:27 +0100
commitbe929dbe2dffa82ca1f91538f56a1bb0490000bd (patch)
treebb51b76662ce49aab71af132487c28d8c664b3f0 /src/status.c
parent5ddca2604f03fc33a427ebd6e49fda7d6967f993 (diff)
downloadfastd-be929dbe2dffa82ca1f91538f56a1bb0490000bd.tar
fastd-be929dbe2dffa82ca1f91538f56a1bb0490000bd.zip
Use peer specifier from log instead of the peer name for the status output
This fixes a crash when status sockets are used with peers without names, but the JSON output format is changed: named peers will now use "<name>" as key instead of "name".
Diffstat (limited to 'src/status.c')
-rw-r--r--src/status.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/status.c b/src/status.c
index 8e0c427..36a38b6 100644
--- a/src/status.c
+++ b/src/status.c
@@ -174,7 +174,10 @@ static void dump_status(int fd) {
if (!fastd_peer_is_enabled(peer))
continue;
- json_object_object_add(peers, peer->name, dump_peer(peer));
+ char name[1024];
+ fastd_snprint_peer_str(name, sizeof(name), peer);
+
+ json_object_object_add(peers, name, dump_peer(peer));
}