[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: : Export END_CIRC_REASON_* to controler
Thus spake Nick Mathewson (nickm@xxxxxxxxxxxxx):
> On Mon, Oct 09, 2006 at 04:44:59AM -0500, Mike Perry wrote:
> > Thus spake Mike Perry (mikepery@xxxxxxxxxx):
> >
> > > Attached is a patch to export circuit failure reasons to the
> > > controller. I had to convert several END_CIRC_AT_ORIGIN reason
> > > codes to the real reason codes for calls to circuit_mark_for_close().
> >
> > Woops. In a couple places I forgot to negate the reason codes.
>
> Hi, Mike! I've applied your patch, and tweaked it to take effect only
> when extended events are enabled. Thanks!
Ok, I've been doing some more testing and I noticed a couple things.
1. If the circuit path is empty, there's a double space between
FAILED/CLOSED and the REASON. Not sure how to best handle this. I
tweaked my regex to work with single or double space (I think), so
it doesn't matter to me, but it is sort of contrary to the spec.
2. There's a couple reasons in the source that I missed. New diff
attached for those.
The next version of my scanner is almost ready. I've been testing it
pretty heavily for a while now, and it's worlds better than the last
one. Will post it to the or-talk list in a day or so, and we can think
about how much, if any, feedback there should be to the dirservers
from it, and what they should do w/ that info.
--
Mike Perry
Mad Computer Scientist
fscked.org evil labs
Index: src/or/control.c
===================================================================
--- src/or/control.c (revision 8691)
+++ src/or/control.c (working copy)
@@ -2370,7 +2370,7 @@
}
if (!safe || !circ->p_streams) {
- circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_NONE);
+ circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_REQUESTED);
}
send_control_done(conn);
Index: src/or/relay.c
===================================================================
--- src/or/relay.c (revision 8691)
+++ src/or/relay.c (working copy)
@@ -158,7 +158,7 @@
if (relay_crypt(circ, cell, cell_direction, &layer_hint, &recognized) < 0) {
log_warn(LD_BUG,"relay crypt failed. Dropping connection.");
- return -1;
+ return -END_CIRC_REASON_INTERNAL;
}
if (recognized) {
Index: src/or/command.c
===================================================================
--- src/or/command.c (revision 8691)
+++ src/or/command.c (working copy)
@@ -378,6 +378,12 @@
} else { /* the destroy came from ahead */
circuit_set_n_circid_orconn(circ, 0, NULL);
if (CIRCUIT_IS_ORIGIN(circ)) {
+ /* Prevent arbitrary destroys from going unnoticed by controller */
+ if(reason == END_CIRC_AT_ORIGIN ||
+ reason == END_CIRC_REASON_NONE ||
+ reason == END_CIRC_REASON_REQUESTED) {
+ reason = END_CIRC_REASON_OR_CONN_CLOSED;
+ }
circuit_mark_for_close(circ, reason);
} else {
char payload[1];