summaryrefslogtreecommitdiffstats
path: root/src/tests/keywords/xlat-virtual-attr
blob: e4769939fa2132cf31b1ce9348c4cfa5108e305d (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#
#  PRE: if
#

update reply {
	Filter-Id := "filter"
}

if ("%{Client-Shortname}" != '<UNKNOWN-CLIENT>') {
	update reply {
		Filter-Id += "fail 0"
	}
}

if ("%{Request-Processing-Stage}" != 'authorize') {
	update reply {
		Filter-Id += "fail 1"
	}
}

if ("%{Virtual-Server}" != 'default') {
	update reply {
		Filter-Id += "fail 2"
	}
}

if ("%{Module-Return-Code}" != '') {
	update reply {
		Filter-Id += "fail 3a"
	}
}

ok
if ("%{Module-Return-Code}" != 'ok') {
	update reply {
		Filter-Id += "fail 3b"
	}
}

if ("%{Packet-Type}" != 'Access-Request') {
	update reply {
		Filter-Id += "fail 4"
	}
}

# Response hasn't been set yet
if ("%{Response-Packet-Type}" != '') {
	update reply {
		Filter-Id += "fail 5"
	}
}

if ("%{Packet-Authentication-Vector}" != '0x00000000000000000000000000000000') {
	update reply {
		Filter-Id += "fail 6"
	}
}

if ("%{Client-IP-Address}" != 127.0.0.1) {
	update reply {
		Filter-Id += "fail 7a"
	}
}

if ("%{Packet-Src-IP-Address}" != 127.0.0.1) {
	update reply {
		Filter-Id += "fail 7b"
	}
}

if ("%{Packet-Dst-IP-Address}" != 127.0.0.1) {
	update reply {
		Filter-Id += "fail 8"
	}
}

# Can't have both...
if ("%{Packet-Src-IPv6-Address}" != '') {
	update reply {
		Filter-Id += "fail 9"
	}
}

if ("%{Packet-Dst-IPv6-Address}" != '') {
	update reply {
		Filter-Id += "fail 10"
	}
}

if ("%{Packet-Src-Port}" != '18120') {
	update reply {
		Filter-Id += "fail 11"
	}
}

if ("%{Packet-Dst-Port}" != '1812') {
	update reply {
		Filter-Id += "fail 12"
	}
}


# We should allow the user to overload virtual attributes
update request {
	Client-Shortname := 'my_test_client'
}

if ("%{Client-Shortname}" != 'my_test_client') {
	update reply {
		Filter-Id += "fail 13"
	}
}

# Operations on virtual attributes should be the same as on real ones
if ("%{Virtual-Server[0]}" != 'default') {
	update reply {
		Filter-Id += "fail 14"
	}
}

if ("%{Virtual-Server[*]}" != 'default') {
	update reply {
		Filter-Id += "fail 15"
	}
}

if ("%{Virtual-Server[#]}" != 1) {
	update reply {
		Filter-Id += "fail 16"
	}
}