Skip to content

Setting latency/delay for an interface #121

Answered by florianl
hellt asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @hellt

Latency64 is not the correct attribute for this use case. Here is an example for tc qdisc add dev tcDev root netem delay 100ms:

	tcTime, err := core.Duration2TcTime(100 * time.Millisecond)
	if err != nil {
		return err
	}
	ticks := core.Time2Tick(tcTime)

	qdisc := tc.Object{
		tc.Msg{
			Family:  unix.AF_UNSPEC,
			Ifindex: uint32(devID.Index),
			Handle:  core.BuildHandle(0x1, 0x0),
			Parent:  tc.HandleRoot,
			Info:    0,
		},
		tc.Attribute{
			Kind: "netem",
			// tc qdisc add dev tcDev root netem delay 100ms
			Netem: &tc.Netem{
				Qopt: tc.NetemQopt{
					Latency: ticks,
				},
			},
		},
	}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hellt
Comment options

@robshakir
Comment options

Answer selected by hellt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants