The DoS subsystem keeps track of statistics that are logged in the heartbeat with dos_log_heartbeat(). I would like those to be exposed to the control port so it can be collected and graph over time (improve relay monitoring).
The code will be easier to maintain if you use smartlist_add_asprintf() for each key=value, and smartlist_join_strings() at the end.
The code will be even easier to maintain if you write a function that checks *_enabled, formats the key=value, and returns a newly allocated string. Then you can just pass the key name, the *_enabled variable, and the actual variable to the function.
There are also some minor issues with the code, I added comments on the pull request.
I'd like to check this advice with the developer who wrote the DoS code, so I'm assigning this ticket to them for review.
I agree that changing control-spec first is the way to go.
I'll wait for dgoulet's comment on how this should be done.
Yes, what teor proposed is really the way to go.
@moonsikpark, you can simply make a branch to the tor-spec.git and add the dos category to GETINFO like teor suggested. Do a first pass and we'll go from there :).