commit 1565432acd4544e7ec7645b347334be41e556243 from: Tracey Emery date: Sun Jul 26 19:36:14 2020 UTC update manuals, add some debug logging, add echo query commit - 47c9f5f0b2b3086e00efc35ad9451dcaadc24e7e commit + 1565432acd4544e7ec7645b347334be41e556243 blob - a61c6268de48d7570eaed8b9ecbb79082c02a396 blob + 163c4341b7e9445c742f1acf71e5391c6f176492 --- thingsctl/thingsctl.8 +++ thingsctl/thingsctl.8 @@ -44,6 +44,12 @@ to communicate with .Pp The following commands are available: .Bl -tag -width Ds +.It Cm echo Ar string +Echo a thing's packets by its name. +A thing could be sending hostile data! +Use at your own risk. +.It Cm kill Ar string +Disconnect a subscribed client from thingsd by client name. .It Cm list clients Show all clients connected to things. .It Cm list sockets @@ -57,13 +63,16 @@ Disable verbose logging. Enable verbose logging. .It Cm log debug Enable very noisy debug logging. -.It Cm kill Ar string -Disconnect a subscribed client from thingsd by client name. -.It Cm show Ar string -View string version of a thing's packets by its name. -Showing packets blocks all other calls. -A thing could be sending binary data! -Use at your own risk. +.It Cm show client Ar string +Show the data for a single client by name. +.It Cm show control +Return control process logging verbosity. +.It Cm show parent +Return parent process logging verbosity. +.It Cm show socket Ar string +Show the data for a single socket by name. +.It Cm show thing Ar string +Show the data for a single thing by name. .El .Sh FILES .Bl -tag -width "/var/run/thingsd.sockXX" -compact @@ -75,8 +84,3 @@ socket used for communication with .Sh SEE ALSO .Xr thingsd.conf 5 , .Xr thingsd 8 -.Sh HISTORY -The -.Nm -program first appeared in -.Ox 6.5 . blob - 6c20a6a5fdae73708b6be52e071567afac3895e2 blob + 655da0ab34ce892b14d8c19f9560e1c200d4110a --- thingsctl/thingsctl.c +++ thingsctl/thingsctl.c @@ -158,8 +158,17 @@ main(int argc, char *argv[]) 0, -1, NULL, 0); break; case SHOW_PACKETS: - imsg_compose(ibuf, IMSG_SHOW_PACKETS_REQUEST, 0, - 0, -1, res->name, sizeof(res->name)); + printf("\nEchoing thing packets may have unexcpected "); + printf("consequences!\n"); + printf("Are you sure you want to echo packets? (y|n) "); + ch = getchar(); + if (ch == 'y' || ch == 'Y') { + printf("Waiting for incoming packets\n"); + imsg_compose(ibuf, IMSG_SHOW_PACKETS_REQUEST, 0, + 0, -1, res->name, sizeof(res->name)); + } else + printf("Echo packets ignored\n"); + printf("\n"); break; case SHOW_PARENT: imsg_compose(ibuf, IMSG_GET_INFO_PARENT_REQUEST, 0, blob - dbe8eccfd67314d4a604784e98e583b0cf5c6d13 blob + a5ac19820cc9a642b5ee12c59f37f7448cd135a6 --- thingsd/things.c +++ thingsd/things.c @@ -299,6 +299,7 @@ things_echo_pkt(struct privsep *ps, struct imsg *imsg) packet_client->imsg = *imsg; memcpy(packet_client->name, imsg->data, sizeof(packet_client->name)); + log_debug("control packet echo request for %s", packet_client->name); TAILQ_INSERT_TAIL(thingsd_env->packet_clients, packet_client, entry); } @@ -315,6 +316,8 @@ things_stop_pkt(struct privsep *ps, struct imsg *imsg) if (fd == packet_client->imsg.hdr.peerid) { TAILQ_REMOVE(thingsd_env->packet_clients, packet_client, entry); + log_debug("control packet echo request stopping for %s", + packet_client->name); free(packet_client); @@ -497,7 +500,7 @@ do_reconn(void) thingsd_env->conn_retry) { dead_thing->dtime = time(NULL); - log_info("attempting to reconnect %s", + log_debug("attempting to reconnect %s", dead_thing->name); switch (dead_thing->type) {