File: tbf

package info (click to toggle)
tcng 10b-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,636 kB
  • ctags: 2,515
  • sloc: ansic: 19,040; pascal: 4,640; yacc: 2,619; sh: 1,914; perl: 1,546; lex: 772; makefile: 756
file content (26 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * tbf - Single TBF shaper
 */

#define MTU  1508B
#define RATE 1Mbps
#define BURST  3kB
#define LIMIT 20kB

#define PACKET		/* 100-sizeof(iphdr) = 80 bytes. */ \
  IP_PCK($ip_src=10.0.0.1 $ip_dst=10.0.0.2) \
  0 x 80

dev eth0 10000 { /* 10 Mbps */
    tbf (mtu MTU,limit LIMIT,rate RATE,burst BURST);
}

every 0.0005s send PACKET		/* 1.6 Mbps */

; Excess: 600 kbps, so we will fill the burst after 24ms, and start
; losing packets 267ms later. We should lose about 532 packets (of
; 2001) or 53200 bytes. Actual numbers vary slightly due to 1024 vs.
; 1000 issues.

time 1s
end