Skip to content

Commit 4014139

Browse files
committed
fix: network destroy
Signed-off-by: tiny-x <xf.yefei@gmail.com>
1 parent 99ae75d commit 4014139

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

exec/network/tc/network_tc.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,12 @@ func stopNet(ctx context.Context, netInterface string, cl spec.Channel) *spec.Re
337337
if os.Getuid() != 0 {
338338
return spec.ReturnFail(spec.Forbidden, fmt.Sprintf("tc no permission"))
339339
}
340-
341-
resposne := cl.Run(ctx, "tc", fmt.Sprintf(`filter del dev %s parent 1: prio 4`, netInterface))
342-
if !resposne.Success {
343-
return resposne
340+
response := cl.Run(ctx, "tc", fmt.Sprintf(`filter show dev %s parent 1: prio 4`, netInterface))
341+
if response.Success && response.Result != "" {
342+
response = cl.Run(ctx, "tc", fmt.Sprintf(`filter del dev %s parent 1: prio 4`, netInterface))
343+
if !response.Success {
344+
log.Errorf(ctx, "tc del filter err, %s", response.Err)
345+
}
344346
}
345347
return cl.Run(ctx, "tc", fmt.Sprintf(`qdisc del dev %s root`, netInterface))
346348
}

0 commit comments

Comments
 (0)