On 21/08/2018 17:21, Denis Ovsienko wrote: > (moving this to tcpdump-workers) > > ---- On Tue, 08 May 2018 14:41:13 +0100 Francois-Xavier Le Bail > <devel.fx.leb...@orange.fr> wrote ---- > > e.g.: > > proto1_print(...) > > { > > ndo->ndo_protocol = "proto1"; > > ... > > proto2_print(...); > > ... > > } > > > > proto2_print(...) > > { > > ndo->ndo_protocol = "proto2"; > > ... > > } > > > > If proto2_print, a "final protocol" (don't call another function with > ndo_protocol assignment), need > > to print truncated string with/without longjmp process: no problem. > > > > If no truncated case occurs in proto2_print, after return, the > proto1_print function take the > > control and if truncated case occurs in proto1_print it will print > "[|proto2]". > > > > Thus after all calls of function with ndo_protocol assignment, we will > need a ndo_protocol re-assign > > like: > > > > proto1_print(...) > > { > > ndo->ndo_protocol = "proto1"; > > ... > > proto2_print(...); > > ndo->ndo_protocol = "proto1"; > > ... > > } > > > > It can bring errors (forgetting...). > > > > Could we do things differently ? > > With things done this way it looks like this issue could happen, although it > would result in incorrect labeling, not incorrect behaviour. > > A possible solution could be some stack structure and a macro to call the > next function, which macro would take care to update the stack before and > after the function call. But to me such a solution looks more complicated > than the problem, I would rather proof-read the source code once and leave it > to work.
Agreed. Some ndo_protocol reassignment already done in 6daf3a54 and d8802934. Perhaps more to do. I will have a look. _______________________________________________ tcpdump-workers mailing list tcpdump-workers@lists.tcpdump.org https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers