OpenCoverage

addrmatch.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/addrmatch.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11struct xaddr {-
12 sa_family_t af;-
13 union {-
14 struct in_addr v4;-
15 struct in6_addr v6;-
16 u_int8_t addr8[16];-
17 u_int32_t addr32[4];-
18 } xa;-
19 u_int32_t scope_id;-
20-
21-
22-
23-
24};-
25-
26static int-
27addr_unicast_masklen(int af)-
28{-
29 switch (af) {-
30 case
executed 10 times by 1 test: case 2 :
Executed by:
  • test_match
executed 10 times by 1 test: case 2 :
Executed by:
  • test_match
10
31 2
executed 10 times by 1 test: case 2 :
Executed by:
  • test_match
10
32 :
executed 10 times by 1 test: case 2 :
Executed by:
  • test_match
10
33 return
executed 10 times by 1 test: return 32;
Executed by:
  • test_match
32;
executed 10 times by 1 test: return 32;
Executed by:
  • test_match
10
34 case
never executed: case 10 :
never executed: case 10 :
0
35 10
never executed: case 10 :
0
36 :
never executed: case 10 :
0
37 return
never executed: return 128;
128;
never executed: return 128;
0
38 default
never executed: default:
:
never executed: default:
0
39 return
never executed: return -1;
-1;
never executed: return -1;
0
40 }-
41}-
42-
43static inline int-
44masklen_valid(int af, u_int masklen)-
45{-
46 switch (af) {-
47 case
executed 47 times by 1 test: case 2 :
Executed by:
  • test_match
executed 47 times by 1 test: case 2 :
Executed by:
  • test_match
47
48 2
executed 47 times by 1 test: case 2 :
Executed by:
  • test_match
47
49 :
executed 47 times by 1 test: case 2 :
Executed by:
  • test_match
47
50 return
executed 47 times by 1 test: return masklen <= 32 ? 0 : -1;
Executed by:
  • test_match
masklen <= 32
masklen <= 32Description
TRUEevaluated 45 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 2 times by 1 test
Evaluated by:
  • test_match
? 0 : -1;
executed 47 times by 1 test: return masklen <= 32 ? 0 : -1;
Executed by:
  • test_match
2-47
51 case
never executed: case 10 :
never executed: case 10 :
0
52 10
never executed: case 10 :
0
53 :
never executed: case 10 :
0
54 return
never executed: return masklen <= 128 ? 0 : -1;
masklen <= 128
masklen <= 128Description
TRUEnever evaluated
FALSEnever evaluated
? 0 : -1;
never executed: return masklen <= 128 ? 0 : -1;
0
55 default
never executed: default:
:
never executed: default:
0
56 return
never executed: return -1;
-1;
never executed: return -1;
0
57 }-
58}-
59-
60-
61-
62-
63-
64static int-
65addr_sa_to_xaddr(struct sockaddr *sa, socklen_t slen, struct xaddr *xa)-
66{-
67 struct sockaddr_in *in4 = (struct sockaddr_in *)sa;-
68 struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)sa;-
69-
70 memset(xa, '\0', sizeof(*xa));-
71-
72 switch (sa->sa_family) {-
73 case
executed 31 times by 1 test: case 2 :
Executed by:
  • test_match
executed 31 times by 1 test: case 2 :
Executed by:
  • test_match
31
74 2
executed 31 times by 1 test: case 2 :
Executed by:
  • test_match
31
75 :
executed 31 times by 1 test: case 2 :
Executed by:
  • test_match
31
76 if (slen < (socklen_t)sizeof(*in4)
slen < (socklen_t)sizeof(*in4)Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
)
0-31
77 return
never executed: return -1;
-1;
never executed: return -1;
0
78 xa->af = -
79 2-
80 ;-
81 memcpy(&xa->xa.v4, &in4->sin_addr, sizeof(xa->xa.v4));-
82 break;
executed 31 times by 1 test: break;
Executed by:
  • test_match
31
83 case
never executed: case 10 :
never executed: case 10 :
0
84 10
never executed: case 10 :
0
85 :
never executed: case 10 :
0
86 if (slen < (socklen_t)sizeof(*in6)
slen < (socklen_t)sizeof(*in6)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
87 return
never executed: return -1;
-1;
never executed: return -1;
0
88 xa->af = -
89 10-
90 ;-
91 memcpy(&xa->xa.v6, &in6->sin6_addr, sizeof(xa->xa.v6));-
92-
93 xa->scope_id = in6->sin6_scope_id;-
94-
95 break;
never executed: break;
0
96 default
never executed: default:
:
never executed: default:
0
97 return
never executed: return -1;
-1;
never executed: return -1;
0
98 }-
99-
100 return
executed 31 times by 1 test: return 0;
Executed by:
  • test_match
0;
executed 31 times by 1 test: return 0;
Executed by:
  • test_match
31
101}-
102-
103-
104-
105-
106-
107-
108static int-
109addr_netmask(int af, u_int l, struct xaddr *n)-
110{-
111 int i;-
112-
113 if (masklen_valid(af, l) != 0
masklen_valid(af, l) != 0Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
|| n ==
n == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
114 ((void *)0)
n == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
115 )-
116 return
never executed: return -1;
-1;
never executed: return -1;
0
117-
118 memset(n, '\0', sizeof(*n));-
119 switch (af) {-
120 case
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
30
121 2
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
30
122 :
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
30
123 n->af = -
124 2-
125 ;-
126 if (l == 0
l == 0Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
)
0-30
127 return
never executed: return 0;
0;
never executed: return 0;
0
128 n->xa.v4.s_addr = -
129 __bswap_32 (-
130 (0xffffffff << (32 - l)) & 0xffffffff-
131 )-
132 ;-
133 return
executed 30 times by 1 test: return 0;
Executed by:
  • test_match
0;
executed 30 times by 1 test: return 0;
Executed by:
  • test_match
30
134 case
never executed: case 10 :
never executed: case 10 :
0
135 10
never executed: case 10 :
0
136 :
never executed: case 10 :
0
137 n->af = -
138 10-
139 ;-
140 for (i = 0; i < 4
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
&& l >= 32
l >= 32Description
TRUEnever evaluated
FALSEnever evaluated
; i++, l -= 32)
0
141 n->xa.addr32[i] = 0xffffffffU;
never executed: n->xa.addr32[i] = 0xffffffffU;
0
142 if (i < 4
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
&& l != 0
l != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
143 n->xa.addr32[i] =
never executed: n->xa.addr32[i] = __bswap_32 ( (0xffffffff << (32 - l)) & 0xffffffff ) ;
0
144 __bswap_32 (
never executed: n->xa.addr32[i] = __bswap_32 ( (0xffffffff << (32 - l)) & 0xffffffff ) ;
0
145 (0xffffffff << (32 - l)) & 0xffffffff
never executed: n->xa.addr32[i] = __bswap_32 ( (0xffffffff << (32 - l)) & 0xffffffff ) ;
0
146 )
never executed: n->xa.addr32[i] = __bswap_32 ( (0xffffffff << (32 - l)) & 0xffffffff ) ;
0
147
never executed: n->xa.addr32[i] = __bswap_32 ( (0xffffffff << (32 - l)) & 0xffffffff ) ;
0
148 ;
never executed: n->xa.addr32[i] = __bswap_32 ( (0xffffffff << (32 - l)) & 0xffffffff ) ;
0
149 return
never executed: return 0;
0;
never executed: return 0;
0
150 default
never executed: default:
:
never executed: default:
0
151 return
never executed: return -1;
-1;
never executed: return -1;
0
152 }-
153}-
154-
155-
156-
157-
158-
159static int-
160addr_and(struct xaddr *dst, const struct xaddr *a, const struct xaddr *b)-
161{-
162 int i;-
163-
164 if (dst ==
dst == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
165 ((void *)0)
dst == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
166 || a ==
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
167 ((void *)0)
a == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
168 || b ==
b == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
169 ((void *)0)
b == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
0-30
170 || a->af != b->af
a->af != b->afDescription
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • test_match
)
0-30
171 return
never executed: return -1;
-1;
never executed: return -1;
0
172-
173 memcpy(dst, a, sizeof(*dst));-
174 switch (a->af) {-
175 case
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
30
176 2
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
30
177 :
executed 30 times by 1 test: case 2 :
Executed by:
  • test_match
30
178 dst->xa.v4.s_addr &= b->xa.v4.s_addr;-
179 return
executed 30 times by 1 test: return 0;
Executed by:
  • test_match
0;
executed 30 times by 1 test: return 0;
Executed by:
  • test_match
30
180 case
never executed: case 10 :
never executed: case 10 :
0
181 10
never executed: case 10 :
0
182 :
never executed: case 10 :
0
183 dst->scope_id = a->scope_id;-
184 for (i = 0; i < 4
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
185 dst->xa.addr32[i] &= b->xa.addr32[i];
never executed: dst->xa.addr32[i] &= b->xa.addr32[i];
0
186 return
never executed: return 0;
0;
never executed: return 0;
0
187 default
never executed: default:
:
never executed: default:
0
188 return
never executed: return -1;
-1;
never executed: return -1;
0
189 }-
190}-
191-
192-
193-
194-
195-
196static int-
197addr_cmp(const struct xaddr *a, const struct xaddr *b)-
198{-
199 int i;-
200-
201 if (a->af != b->af
a->af != b->afDescription
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
202 return
never executed: return a->af == 10 ? 1 : -1;
a->af ==
a->af == 10Description
TRUEnever evaluated
FALSEnever evaluated
never executed: return a->af == 10 ? 1 : -1;
0
203 10
a->af == 10Description
TRUEnever evaluated
FALSEnever evaluated
never executed: return a->af == 10 ? 1 : -1;
0
204 ? 1 : -1;
never executed: return a->af == 10 ? 1 : -1;
0
205-
206 switch (a->af) {-
207 case
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
208 2
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
209 :
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
210 if (a->xa.v4.s_addr == b->xa.v4.s_addr
a->xa.v4.s_add...->xa.v4.s_addrDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 8 times by 1 test
Evaluated by:
  • test_match
)
7-8
211 return
executed 7 times by 1 test: return 0;
Executed by:
  • test_match
0;
executed 7 times by 1 test: return 0;
Executed by:
  • test_match
7
212 return
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
8
213 __bswap_32 (
__bswap_32 ( a...xa.v4.s_addr )Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
4-8
214 a->xa.v4.s_addr
__bswap_32 ( a...xa.v4.s_addr )Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
4-8
215 )
__bswap_32 ( a...xa.v4.s_addr )Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
4-8
216 >
__bswap_32 ( a...xa.v4.s_addr )Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
4-8
217 __bswap_32 (
__bswap_32 ( a...xa.v4.s_addr )Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
4-8
218 b->xa.v4.s_addr
__bswap_32 ( a...xa.v4.s_addr )Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
4-8
219 )
__bswap_32 ( a...xa.v4.s_addr )Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
4-8
220 ? 1 : -1;
executed 8 times by 1 test: return __bswap_32 ( a->xa.v4.s_addr ) > __bswap_32 ( b->xa.v4.s_addr ) ? 1 : -1;
Executed by:
  • test_match
8
221 case
never executed: case 10 :
never executed: case 10 :
0
222 10
never executed: case 10 :
0
223 :
never executed: case 10 :
0
224 for (i = 0; i < 16
i < 16Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
225 if (a->xa.addr8[i] - b->xa.addr8[i] != 0
a->xa.addr8[i]....addr8[i] != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
226 return
never executed: return a->xa.addr8[i] > b->xa.addr8[i] ? 1 : -1;
a->xa.addr8[i] > b->xa.addr8[i]
a->xa.addr8[i]...b->xa.addr8[i]Description
TRUEnever evaluated
FALSEnever evaluated
? 1 : -1;
never executed: return a->xa.addr8[i] > b->xa.addr8[i] ? 1 : -1;
0
227 if (a->scope_id == b->scope_id
a->scope_id == b->scope_idDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
228 return
never executed: return 0;
0;
never executed: return 0;
0
229 return
never executed: return a->scope_id > b->scope_id ? 1 : -1;
a->scope_id > b->scope_id
a->scope_id > b->scope_idDescription
TRUEnever evaluated
FALSEnever evaluated
? 1 : -1;
never executed: return a->scope_id > b->scope_id ? 1 : -1;
0
230 default
never executed: default:
:
never executed: default:
0
231 return
never executed: return -1;
-1;
never executed: return -1;
0
232 }-
233}-
234-
235-
236-
237-
238-
239static int-
240addr_pton(const char *p, struct xaddr *n)-
241{-
242 struct addrinfo hints, *ai = -
243 ((void *)0)-
244 ;-
245 int ret = -1;-
246-
247 memset(&hints, '\0', sizeof(hints));-
248 hints.ai_flags = -
249 0x0004-
250 ;-
251-
252 if (p ==
p == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • test_match
0-34
253 ((void *)0)
p == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 34 times by 1 test
Evaluated by:
  • test_match
0-34
254 || getaddrinfo(p,
getaddrinfo(p,...nts, &ai) != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
3-31
255 ((void *)0)
getaddrinfo(p,...nts, &ai) != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
3-31
256 , &hints, &ai) != 0
getaddrinfo(p,...nts, &ai) != 0Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
)
3-31
257 goto
executed 3 times by 1 test: goto out;
Executed by:
  • test_match
out;
executed 3 times by 1 test: goto out;
Executed by:
  • test_match
3
258 if (ai ==
ai == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
0-31
259 ((void *)0)
ai == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
0-31
260 || ai->ai_addr ==
ai->ai_addr == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
0-31
261 ((void *)0)
ai->ai_addr == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
0-31
262 )-
263 goto
never executed: goto out;
out;
never executed: goto out;
0
264 if (n !=
n != ((void *)0)Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-31
265 ((void *)0)
n != ((void *)0)Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-31
266 && addr_sa_to_xaddr(ai->ai_addr, ai->ai_addrlen, n) == -1
addr_sa_to_xad...rlen, n) == -1Description
TRUEnever evaluated
FALSEevaluated 31 times by 1 test
Evaluated by:
  • test_match
)
0-31
267 goto
never executed: goto out;
out;
never executed: goto out;
0
268-
269 ret = 0;-
270 out:
code before this statement executed 31 times by 1 test: out:
Executed by:
  • test_match
31
271 if (ai !=
ai != ((void *)0)Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 3 times by 1 test
Evaluated by:
  • test_match
3-31
272 ((void *)0)
ai != ((void *)0)Description
TRUEevaluated 31 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 3 times by 1 test
Evaluated by:
  • test_match
3-31
273 )-
274 freeaddrinfo(ai);
executed 31 times by 1 test: freeaddrinfo(ai);
Executed by:
  • test_match
31
275 return
executed 34 times by 1 test: return ret;
Executed by:
  • test_match
ret;
executed 34 times by 1 test: return ret;
Executed by:
  • test_match
34
276}-
277-
278-
279-
280-
281-
282static int-
283addr_invert(struct xaddr *n)-
284{-
285 int i;-
286-
287 if (n ==
n == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
0-15
288 ((void *)0)
n == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
0-15
289 )-
290 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
291-
292 switch (n->af) {-
293 case
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
294 2
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
295 :
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
296 n->xa.v4.s_addr = ~n->xa.v4.s_addr;-
297 return
executed 15 times by 1 test: return (0);
Executed by:
  • test_match
(0);
executed 15 times by 1 test: return (0);
Executed by:
  • test_match
15
298 case
never executed: case 10 :
never executed: case 10 :
0
299 10
never executed: case 10 :
0
300 :
never executed: case 10 :
0
301 for (i = 0; i < 4
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
302 n->xa.addr32[i] = ~n->xa.addr32[i];
never executed: n->xa.addr32[i] = ~n->xa.addr32[i];
0
303 return
never executed: return (0);
(0);
never executed: return (0);
0
304 default
never executed: default:
:
never executed: default:
0
305 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
306 }-
307}-
308-
309-
310-
311-
312-
313-
314static int-
315addr_hostmask(int af, u_int l, struct xaddr *n)-
316{-
317 if (addr_netmask(af, l, n) == -1
addr_netmask(af, l, n) == -1Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
|| addr_invert(n) == -1
addr_invert(n) == -1Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
318 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
319 return
executed 15 times by 1 test: return (0);
Executed by:
  • test_match
(0);
executed 15 times by 1 test: return (0);
Executed by:
  • test_match
15
320}-
321-
322-
323-
324-
325-
326static int-
327addr_is_all0s(const struct xaddr *a)-
328{-
329 int i;-
330-
331 switch (a->af) {-
332 case
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
333 2
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
334 :
executed 15 times by 1 test: case 2 :
Executed by:
  • test_match
15
335 return
executed 15 times by 1 test: return (a->xa.v4.s_addr == 0 ? 0 : -1);
Executed by:
  • test_match
(a->xa.v4.s_addr == 0
a->xa.v4.s_addr == 0Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
? 0 : -1);
executed 15 times by 1 test: return (a->xa.v4.s_addr == 0 ? 0 : -1);
Executed by:
  • test_match
0-15
336 case
never executed: case 10 :
never executed: case 10 :
0
337 10
never executed: case 10 :
0
338 :
never executed: case 10 :
;
0
339 for (i = 0; i < 4
i < 4Description
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
340 if (a->xa.addr32[i] != 0
a->xa.addr32[i] != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
341 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
342 return
never executed: return (0);
(0);
never executed: return (0);
0
343 default
never executed: default:
:
never executed: default:
0
344 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
345 }-
346}-
347-
348-
349-
350-
351-
352-
353-
354static int-
355addr_host_is_all0s(const struct xaddr *a, u_int masklen)-
356{-
357 struct xaddr tmp_addr, tmp_mask, tmp_result;-
358-
359 memcpy(&tmp_addr, a, sizeof(tmp_addr));-
360 if (addr_hostmask(a->af, masklen, &tmp_mask) == -1
addr_hostmask(...mp_mask) == -1Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
361 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
362 if (addr_and(&tmp_result, &tmp_addr, &tmp_mask) == -1
addr_and(&tmp_...mp_mask) == -1Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
363 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
364 return
executed 15 times by 1 test: return (addr_is_all0s(&tmp_result));
Executed by:
  • test_match
(addr_is_all0s(&tmp_result));
executed 15 times by 1 test: return (addr_is_all0s(&tmp_result));
Executed by:
  • test_match
15
365}-
366-
367-
368-
369-
370-
371static int-
372addr_pton_cidr(const char *p, struct xaddr *n, u_int *l)-
373{-
374 struct xaddr tmp;-
375 long unsigned int masklen = 999;-
376 char addrbuf[64], *mp, *cp;-
377-
378-
379 if (p ==
p == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
0-19
380 ((void *)0)
p == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
0-19
381 || strlcpy(addrbuf, p, sizeof(addrbuf)) >= sizeof(addrbuf)
strlcpy(addrbu...izeof(addrbuf)Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
)
0-19
382 return
never executed: return -1;
-1;
never executed: return -1;
0
383-
384 if ((
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
mp =
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
385 (__extension__ (__builtin_constant_p (
__builtin_constant_p ( '/' )Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
0-19
386 '/'
__builtin_constant_p ( '/' )Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
0-19
387 )
__builtin_constant_p ( '/' )Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
&& !__builtin_constant_p (
!__builtin_con..._p ( addrbuf )Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
0-19
388 addrbuf
!__builtin_con..._p ( addrbuf )Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
0-19
389 )
!__builtin_con..._p ( addrbuf )Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
&& (
( '/' ) == '\0'Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
0-19
390 '/'
( '/' ) == '\0'Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
0-19
391 ) == '\0'
( '/' ) == '\0'Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
? (char *) __rawmemchr (
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
0-19
392 addrbuf
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
393 ,
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
394 '/'
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
395 ) : __builtin_strchr (
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
396 addrbuf
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
397 ,
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
398 '/'
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
399 )))
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
400 ) !=
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
401 ((void *)0)
(mp = (__exten...!= ((void *)0)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 12 times by 1 test
Evaluated by:
  • test_match
7-12
402 ) {-
403 *mp = '\0';-
404 mp++;-
405 masklen = strtoul(mp, &cp, 10);-
406 if (*
*mp == '\0'Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test_match
mp == '\0'
*mp == '\0'Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test_match
|| *
*cp != '\0'Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test_match
cp != '\0'
*cp != '\0'Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test_match
|| masklen > 128
masklen > 128Description
TRUEnever evaluated
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test_match
)
0-7
407 return
never executed: return -1;
-1;
never executed: return -1;
0
408 }
executed 7 times by 1 test: end of block
Executed by:
  • test_match
7
409-
410 if (addr_pton(addrbuf, &tmp) == -1
addr_pton(addrbuf, &tmp) == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 17 times by 1 test
Evaluated by:
  • test_match
)
2-17
411 return
executed 2 times by 1 test: return -1;
Executed by:
  • test_match
-1;
executed 2 times by 1 test: return -1;
Executed by:
  • test_match
2
412-
413 if (mp ==
mp == ((void *)0)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test_match
7-10
414 ((void *)0)
mp == ((void *)0)Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 7 times by 1 test
Evaluated by:
  • test_match
7-10
415 )-
416 masklen = addr_unicast_masklen(tmp.af);
executed 10 times by 1 test: masklen = addr_unicast_masklen(tmp.af);
Executed by:
  • test_match
10
417 if (masklen_valid(tmp.af, masklen) == -1
masklen_valid(...masklen) == -1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
2-15
418 return
executed 2 times by 1 test: return -2;
Executed by:
  • test_match
-2;
executed 2 times by 1 test: return -2;
Executed by:
  • test_match
2
419 if (addr_host_is_all0s(&tmp, masklen) != 0
addr_host_is_a... masklen) != 0Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
420 return
never executed: return -2;
-2;
never executed: return -2;
0
421-
422 if (n !=
n != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-15
423 ((void *)0)
n != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-15
424 )-
425 memcpy(n, &tmp, sizeof(*n));
executed 15 times by 1 test: memcpy(n, &tmp, sizeof(*n));
Executed by:
  • test_match
15
426 if (l !=
l != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-15
427 ((void *)0)
l != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-15
428 )-
429 *
executed 15 times by 1 test: *l = masklen;
Executed by:
  • test_match
l = masklen;
executed 15 times by 1 test: *l = masklen;
Executed by:
  • test_match
15
430-
431 return
executed 15 times by 1 test: return 0;
Executed by:
  • test_match
0;
executed 15 times by 1 test: return 0;
Executed by:
  • test_match
15
432}-
433-
434static int-
435addr_netmatch(const struct xaddr *host, const struct xaddr *net, u_int masklen)-
436{-
437 struct xaddr tmp_mask, tmp_result;-
438-
439 if (host->af != net->af
host->af != net->afDescription
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
440 return
never executed: return -1;
-1;
never executed: return -1;
0
441-
442 if (addr_netmask(host->af, masklen, &tmp_mask) == -1
addr_netmask(h...mp_mask) == -1Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
443 return
never executed: return -1;
-1;
never executed: return -1;
0
444 if (addr_and(&tmp_result, host, &tmp_mask) == -1
addr_and(&tmp_...mp_mask) == -1Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
0-15
445 return
never executed: return -1;
-1;
never executed: return -1;
0
446 return
executed 15 times by 1 test: return addr_cmp(&tmp_result, net);
Executed by:
  • test_match
addr_cmp(&tmp_result, net);
executed 15 times by 1 test: return addr_cmp(&tmp_result, net);
Executed by:
  • test_match
15
447}-
448int-
449addr_match_list(const char *addr, const char *_list)-
450{-
451 char *list, *cp, *o;-
452 struct xaddr try_addr, match_addr;-
453 u_int masklen, neg;-
454 int ret = 0, r;-
455-
456 if (addr !=
addr != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 2 times by 1 test
Evaluated by:
  • test_match
2-15
457 ((void *)0)
addr != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 2 times by 1 test
Evaluated by:
  • test_match
2-15
458 && addr_pton(addr, &try_addr) != 0
addr_pton(addr...try_addr) != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • test_match
FALSEevaluated 14 times by 1 test
Evaluated by:
  • test_match
) {
1-14
459 debug2("%s: couldn't parse address %.100s", __func__, addr);-
460 return
executed 1 time by 1 test: return 0;
Executed by:
  • test_match
0;
executed 1 time by 1 test: return 0;
Executed by:
  • test_match
1
461 }-
462 if ((
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
o = list =
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
463 (__extension__ (__builtin_constant_p (
__builtin_constant_p ( _list )Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
464 _list
__builtin_constant_p ( _list )Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
465 )
__builtin_constant_p ( _list )Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
&& ((
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
size_t)(const void *)((
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
466 _list
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
467 ) + 1) - (size_t)(const void *)(
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
468 _list
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
469 ) == 1)
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
? (((const
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
char *) (
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
470 _list
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
471 ))[0] == '\0'
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
? (char *) calloc ((size_t) 1, (size_t) 1) : ({ size_t __len = strlen (
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
472 _list
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
473 ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)
__retval != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
) __retval = (char *) memcpy (__retval,
never executed: __retval = (char *) memcpy (__retval, _list , __len);
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
474 _list
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
never executed: __retval = (char *) memcpy (__retval, _list , __len);
0-16
475 , __len);
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
never executed: __retval = (char *) memcpy (__retval, _list , __len);
__retval; })) : __strdup (
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
476 _list
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
477 )))
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
478 ) ==
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
479 ((void *)0)
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • test_match
0-16
480 )-
481 return
never executed: return -1;
-1;
never executed: return -1;
0
482 while ((
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
cp =
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
483 __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
484 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
485 ) && ((size_t)(const void *)((
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
486 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
487 ) + 1) - (size_t)(const void *)(
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
488 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
489 ) == 1) && (__r0 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
490 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
491 ))[0], ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
492 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
493 ))[0] != '\0') ? ((__r1 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
494 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
495 ))[1], ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
496 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
497 ))[1] == '\0') ? __strsep_1c (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
498 &list
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
499 , __r0) : ((__r2 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
500 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
501 ))[2], __r2 == '\0') ? __strsep_2c (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
502 &list
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
503 , __r0, __r1) : (((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
504 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
505 ))[3] == '\0' ? __strsep_3c (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
506 &list
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
507 , __r0, __r1, __r2) : __strsep_g (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
508 &list
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
509 ,
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
510 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
511 )))) : __strsep_g (
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
512 &list
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
513 ,
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
514 ","
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
515 )); })
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
516 ) !=
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
517 ((void *)0)
(cp = __extens...!= ((void *)0)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 10 times by 1 test
Evaluated by:
  • test_match
10-19
518 ) {-
519 neg = *cp == '!';-
520 if (neg
negDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 15 times by 1 test
Evaluated by:
  • test_match
)
4-15
521 cp++;
executed 4 times by 1 test: cp++;
Executed by:
  • test_match
4
522 if (*
*cp == '\0'Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
cp == '\0'
*cp == '\0'Description
TRUEnever evaluated
FALSEevaluated 19 times by 1 test
Evaluated by:
  • test_match
) {
0-19
523 ret = -2;-
524 break;
never executed: break;
0
525 }-
526-
527 r = addr_pton_cidr(cp, &match_addr, &masklen);-
528 if (r == -2
r == -2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 17 times by 1 test
Evaluated by:
  • test_match
) {
2-17
529 debug2("%s: inconsistent mask length for "-
530 "match network \"%.100s\"", __func__, cp);-
531 ret = -2;-
532 break;
executed 2 times by 1 test: break;
Executed by:
  • test_match
2
533 } else if (r == 0
r == 0Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 2 times by 1 test
Evaluated by:
  • test_match
) {
2-15
534 if (addr !=
addr != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-15
535 ((void *)0)
addr != ((void *)0)Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
0-15
536 && addr_netmatch(&try_addr,
addr_netmatch(... masklen) == 0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 8 times by 1 test
Evaluated by:
  • test_match
7-8
537 &match_addr, masklen) == 0
addr_netmatch(... masklen) == 0Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 8 times by 1 test
Evaluated by:
  • test_match
) {
7-8
538 foundit:-
539 if (neg
negDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • test_match
FALSEevaluated 4 times by 1 test
Evaluated by:
  • test_match
) {
4
540 ret = -1;-
541 break;
executed 4 times by 1 test: break;
Executed by:
  • test_match
4
542 }-
543 ret = 1;-
544 }
executed 4 times by 1 test: end of block
Executed by:
  • test_match
4
545 continue;
executed 12 times by 1 test: continue;
Executed by:
  • test_match
12
546 } else {-
547-
548 if (addr !=
addr != ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • test_match
FALSEevaluated 1 time by 1 test
Evaluated by:
  • test_match
1
549 ((void *)0)
addr != ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • test_match
FALSEevaluated 1 time by 1 test
Evaluated by:
  • test_match
1
550 && match_pattern(addr, cp) == 1
match_pattern(addr, cp) == 1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • test_match
FALSEnever evaluated
)
0-1
551 goto
executed 1 time by 1 test: goto foundit;
Executed by:
  • test_match
foundit;
executed 1 time by 1 test: goto foundit;
Executed by:
  • test_match
1
552 }
executed 1 time by 1 test: end of block
Executed by:
  • test_match
1
553 }-
554 free(o);-
555-
556 return
executed 16 times by 1 test: return ret;
Executed by:
  • test_match
ret;
executed 16 times by 1 test: return ret;
Executed by:
  • test_match
16
557}-
558int-
559addr_match_cidr_list(const char *addr, const char *_list)-
560{-
561 char *list, *cp, *o;-
562 struct xaddr try_addr, match_addr;-
563 u_int masklen;-
564 int ret = 0, r;-
565-
566 if (addr !=
addr != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
567 ((void *)0)
addr != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
568 && addr_pton(addr, &try_addr) != 0
addr_pton(addr...try_addr) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
569 debug2("%s: couldn't parse address %.100s", __func__, addr);-
570 return
never executed: return 0;
0;
never executed: return 0;
0
571 }-
572 if ((
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
o = list =
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
573 (__extension__ (__builtin_constant_p (
__builtin_constant_p ( _list )Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
574 _list
__builtin_constant_p ( _list )Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
575 )
__builtin_constant_p ( _list )Description
TRUEnever evaluated
FALSEnever evaluated
&& ((
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
size_t)(const void *)((
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
576 _list
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
577 ) + 1) - (size_t)(const void *)(
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
578 _list
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
579 ) == 1)
((size_t)(cons... _list ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
? (((const
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
char *) (
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
580 _list
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
581 ))[0] == '\0'
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
? (char *) calloc ((size_t) 1, (size_t) 1) : ({ size_t __len = strlen (
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
582 _list
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
583 ) + 1; char *__retval = (char *) malloc (__len); if (__retval != ((void *)0)
__retval != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
) __retval = (char *) memcpy (__retval,
never executed: __retval = (char *) memcpy (__retval, _list , __len);
0
584 _list
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __retval = (char *) memcpy (__retval, _list , __len);
0
585 , __len); __retval; })) : __strdup (
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
586 _list
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
587 )))
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
588 ) ==
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
589 ((void *)0)
(o = list = (_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
590 )-
591 return
never executed: return -1;
-1;
never executed: return -1;
0
592 while ((
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
cp =
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
593 __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
594 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
595 ) && ((size_t)(const void *)((
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
596 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
597 ) + 1) - (size_t)(const void *)(
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
598 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
599 ) == 1) && (__r0 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
600 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
601 ))[0], ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
602 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
603 ))[0] != '\0') ? ((__r1 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
604 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
605 ))[1], ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
606 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
607 ))[1] == '\0') ? __strsep_1c (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
608 &list
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
609 , __r0) : ((__r2 = ((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
610 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
611 ))[2], __r2 == '\0') ? __strsep_2c (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
612 &list
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
613 , __r0, __r1) : (((const char *) (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
614 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
615 ))[3] == '\0' ? __strsep_3c (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
616 &list
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
617 , __r0, __r1, __r2) : __strsep_g (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
618 &list
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
619 ,
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
620 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
621 )))) : __strsep_g (
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
622 &list
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
623 ,
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
624 ","
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
625 )); })
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
626 ) !=
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
627 ((void *)0)
(cp = __extens...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
628 ) {-
629 if (*
*cp == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
cp == '\0'
*cp == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
630 error("%s: empty entry in list \"%.100s\"",-
631 __func__, o);-
632 ret = -1;-
633 break;
never executed: break;
0
634 }-
635 if (strlen(cp) >
strlen(cp) > 46 + 3Description
TRUEnever evaluated
FALSEnever evaluated
0
636 46
strlen(cp) > 46 + 3Description
TRUEnever evaluated
FALSEnever evaluated
0
637 + 3
strlen(cp) > 46 + 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
638 error("%s: list entry \"%.100s\" too long",-
639 __func__, cp);-
640 ret = -1;-
641 break;
never executed: break;
0
642 }-
643-
644 if (-
645 __builtin_strspn (
__builtin_strs... != strlen(cp)Description
TRUEnever evaluated
FALSEnever evaluated
0
646 cp
__builtin_strs... != strlen(cp)Description
TRUEnever evaluated
FALSEnever evaluated
0
647 ,
__builtin_strs... != strlen(cp)Description
TRUEnever evaluated
FALSEnever evaluated
0
648 "0123456789abcdefABCDEF.:/"
__builtin_strs... != strlen(cp)Description
TRUEnever evaluated
FALSEnever evaluated
0
649 )
__builtin_strs... != strlen(cp)Description
TRUEnever evaluated
FALSEnever evaluated
0
650 != strlen(cp)
__builtin_strs... != strlen(cp)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
651 error("%s: list entry \"%.100s\" contains invalid "-
652 "characters", __func__, cp);-
653 ret = -1;-
654 }
never executed: end of block
0
655-
656-
657 r = addr_pton_cidr(cp, &match_addr, &masklen);-
658 if (r == -1
r == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
659 error("Invalid network entry \"%.100s\"", cp);-
660 ret = -1;-
661 break;
never executed: break;
0
662 } else if (r == -2
r == -2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
663 error("Inconsistent mask length for "-
664 "network \"%.100s\"", cp);-
665 ret = -1;-
666 break;
never executed: break;
0
667 } else if (r == 0
r == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& addr !=
addr != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
668 ((void *)0)
addr != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
669 ) {-
670 if (addr_netmatch(&try_addr, &match_addr,
addr_netmatch(... masklen) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
671 masklen) == 0
addr_netmatch(... masklen) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
672 ret = 1;
never executed: ret = 1;
0
673 continue;
never executed: continue;
0
674 }-
675 }
never executed: end of block
0
676 free(o);-
677-
678 return
never executed: return ret;
ret;
never executed: return ret;
0
679}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2