File: xdev

package info (click to toggle)
tcng 10b-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,632 kB
  • ctags: 2,515
  • sloc: ansic: 19,038; pascal: 4,640; yacc: 2,619; sh: 1,908; perl: 1,546; lex: 772; makefile: 755
file content (38 lines) | stat: -rw-r--r-- 795 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
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * xdev - Cross-device policing
 *
 * Traffic on different interfaces is limited by the same policer.
 */

#define LIMIT 200kbps
#define BURST 10kB
#define MTU 1500B

#define PACKET	UDP_HDR($ip_src=10.0.0.1 $ip_dst=10.0.0.2) \
		0 x 980	/* 1000-sizeof(iphdr) = 980 bytes */

dev eth0 1000 /* 1 Mbps */
dev eth1 1000 /* 1 Mbps */ {
    $p = police (rate LIMIT,burst BURST,mtu MTU) drop;
    eth0 {
	dsmark (indices 1) {
	    class (0) on tcindex (mask 0) element (0)
	      police $p;
	}
    }
    eth1 {
	dsmark (indices 1) {
	    class (0) on tcindex (mask 0) element (0)
	      police $p;
	}
    }
}

/* Use slightly odd numbers or get weird phase effects in simulation. */

every 0.011s send eth0 PACKET	/* 800 kbps */
time 1.006s
every 0.011s send eth1 PACKET	/* 800 kbps */

time 5s
end