Skip to content

Commit 788417a

Browse files
authored
Merge pull request #23 from OpenCloudOS/dev
nettrace: allow to use drop-stack in any mode
2 parents c8ca291 + 316e27d commit 788417a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/trace.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ static void trace_all_set_ret()
179179

180180
static int trace_prepare_args()
181181
{
182+
trace_t *drop_trace = search_trace_enabled("kfree_skb");
182183
trace_args_t *args = &trace_ctx.args;
183184
char *traces = args->traces;
184185
trace_t *trace;
@@ -195,12 +196,15 @@ static int trace_prepare_args()
195196
if (args->intel)
196197
trace_ctx.mode = TRACE_MODE_INETL;
197198

199+
if (args->drop_stack) {
200+
if (trace_set_stack(drop_trace))
201+
goto err;
202+
}
203+
198204
if (args->drop) {
199205
trace_ctx.mode = TRACE_MODE_DROP;
200-
traces = "kfree_skb";
201-
} else if (args->drop_stack) {
202-
pr_err("--drop should be set!\n");
203-
goto err;
206+
trace_set_enable(drop_trace);
207+
goto skip_trace;
204208
}
205209

206210
if (!traces) {
@@ -247,15 +251,11 @@ static int trace_prepare_args()
247251
trace_group_enable("life");
248252
break;
249253
case TRACE_MODE_BASIC:
254+
break;
250255
case TRACE_MODE_DROP: {
251-
trace_t *drop_trace = search_trace_enabled(traces);
252-
253256
if (!trace_ctx.drop_reason)
254257
pr_warn("skb drop reason is not support by your kernel"
255258
", drop reason will not be printed\n");
256-
257-
if (args->drop_stack && trace_set_stack(drop_trace))
258-
goto err;
259259
break;
260260
}
261261
default:

0 commit comments

Comments
 (0)