Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The problem of wrong return value of destroy under non root Linux #100

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions exec/bin/tcnetwork/tcnetwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,19 @@ func addQdiscForDL(channel spec.Channel, ctx context.Context, netInterface strin
}

// stopNet, no need to add os.Exit
func stopNet(netInterface string) {
func stopNet(netInterface string) *spec.Response{
ctx := context.Background()
cl.Run(ctx, "tc", fmt.Sprintf(`filter del dev %s parent 1: prio 4`, netInterface))
cl.Run(ctx, "tc", fmt.Sprintf(`qdisc del dev %s root`, netInterface))
run := cl.Run(ctx, "tc", fmt.Sprintf(`filter del dev %s parent 1: prio 4`, netInterface))
response := cl.Run(ctx, "tc", fmt.Sprintf(`qdisc del dev %s root`, netInterface))
if !response.Success {
bin.PrintErrAndExit(response.Err)
return response
} else if !run.Success {
bin.PrintErrAndExit(run.Err)
return run
}
bin.PrintOutputAndExit(response.Result.(string))
return response
}

// getPeerPorts returns all ports communicating with the port
Expand Down