File: u32

package info (click to toggle)
tcng 10b-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,644 kB
  • sloc: ansic: 19,040; pascal: 4,640; yacc: 2,619; sh: 1,914; perl: 1,546; lex: 772; makefile: 751
file content (36 lines) | stat: -rw-r--r-- 1,036 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
/*
 * u32 - Classify using u32
 *
 * We distinguish UDP, TCP in general, two TCP port pairs in particular,
 * and a specific destination host last
 */


#define PORT_USER 0x1234

#define MY_UDP		UDP_PCK($ip_src=10.0.0.1 $ip_dst=10.0.0.2 \
			  $udp_sport=PORT_USER $udp_dport=PORT_DOMAIN)
#define MY_TCP(PARAMS)	TCP_PCK($ip_src=10.0.0.1 $ip_dst=10.0.0.2 \
			  $tcp_sport=PORT_USER $tcp_dport=PORT_HTTP PARAMS)
#define MY_ICMP(PARAMS) ICMP_PCK($ip_src=10.0.0.2 $ip_dst=10.0.0.1 PARAMS)

dev eth0 100000 /* 100 Mbps */ {
    #define PORT_USER 0x1234

    prio (bands 5) {
	class if ip_proto == IPPROTO_UDP; /* ... if (udp)  would be neat */
	class if tcp_sport == PORT_USER && tcp_dport == PORT_TELNET;
	class if tcp_sport == PORT_USER && tcp_dport == PORT_SMTP;
	class if ip_proto == IPPROTO_TCP;
	class if ip_dst == 10.0.0.2;
    }
}

send MY_UDP
send MY_TCP($tcp_dport=PORT_TELNET)
send MY_TCP($tcp_dport=PORT_SMTP)
send MY_TCP($tcp_dport=PORT_HTTP $ip_dst=10.0.0.2)
send MY_ICMP($ip_dst=10.0.0.2)
send MY_ICMP($ip_dst=10.0.0.1)

end