blob: 2ecbf0c19ec46973d8569ce9762a9291d487a97d [file] [log] [blame]
mridge949c5b12006-01-03 23:01:28 +00001/*
2 *
3 * Copyright (c) International Business Machines Corp., 2001
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Wanlong Gao4548c6c2012-10-19 18:03:36 +080017 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
mridge949c5b12006-01-03 23:01:28 +000018 */
19
20/*
21 * Test Name: asapi_02
22 *
23 * Test Description:
24 * These tests are for the "Advanced Sockets API" (RFC 3542)
25 * Verify that in6 and sockaddr fields are present.
26 *
27 * Usage: <for command-line>
28 * asapi_02
29 *
30 * HISTORY
31 * 01/2005 written by David L Stevens
32 *
33 * RESTRICTIONS:
34 * None.
35 *
36 */
37
38#include <stdio.h>
39#include <unistd.h>
40#include <errno.h>
41
42#include <sys/wait.h>
43
44#include <netinet/ip6.h>
45
46#include "test.h"
mridge949c5b12006-01-03 23:01:28 +000047#include "runcc.h"
48
Wanlong Gao354ebb42012-12-07 10:10:04 +080049char *TCID = "asapi_02"; /* Test program identifier. */
mridge949c5b12006-01-03 23:01:28 +000050
51void setup(void), cleanup(void);
52
53enum ttype { EXISTS, ALIAS, VALUE };
54
55struct ftent {
Wanlong Gao354ebb42012-12-07 10:10:04 +080056 char *ft_tname; /* test name */
57 int ft_type; /* test type */
58 char *ft_incl; /* include file list */
59 char *ft_struct; /* structure name */
60 char *ft_field; /* field name */
61 char *ft_offset; /* field offset */
mridge949c5b12006-01-03 23:01:28 +000062 union {
Wanlong Gao354ebb42012-12-07 10:10:04 +080063 char *fu_value; /* field size or value */
64 char *fu_dname; /* #define name */
mridge949c5b12006-01-03 23:01:28 +000065 } ftun;
66#define ft_value ftun.fu_value
67#define ft_dname ftun.fu_dname
68} ftab[] = {
69/* Section 2.2, icmp6_hdr & defines */
Wanlong Gao354ebb42012-12-07 10:10:04 +080070 {
71 "icmp6_hdr icmp6_type", EXISTS, ICMP6_H, "icmp6_hdr",
72 "icmp6_type", "0", {
73 "1"}}, {
74 "icmp6_hdr icmp6_code", EXISTS, ICMP6_H, "icmp6_hdr",
75 "icmp6_code", "1", {
76 "1"}}, {
77 "icmp6_hdr icmp6_cksum", EXISTS, ICMP6_H, "icmp6_hdr",
78 "icmp6_cksum", "2", {
79 "2"}}, {
80 "icmp6_hdr icmp6_un_data32 element", EXISTS, ICMP6_H,
81 "icmp6_hdr", "icmp6_dataun.icmp6_un_data32[0]", "4", {
82 "4"}}, {
83 "icmp6_hdr icmp6_un_data32 array", EXISTS, ICMP6_H, "icmp6_hdr",
84 "icmp6_dataun.icmp6_un_data32", "4", {
85 "4"}}, {
86 "icmp6_hdr icmp6_un_data16 element", EXISTS, ICMP6_H,
87 "icmp6_hdr", "icmp6_dataun.icmp6_un_data16[0]", "4", {
88 "2"}}, {
89 "icmp6_hdr icmp6_un_data16 array", EXISTS, ICMP6_H, "icmp6_hdr",
90 "icmp6_dataun.icmp6_un_data16", "4", {
91 "4"}}, {
92 "icmp6_hdr icmp6_un_data8 element", EXISTS, ICMP6_H,
93 "icmp6_hdr", "icmp6_dataun.icmp6_un_data8[0]", "4", {
94 "1"}}, {
95 "icmp6_hdr icmp6_un_data8 array", EXISTS, ICMP6_H, "icmp6_hdr",
96 "icmp6_dataun.icmp6_un_data8", "4", {
97 "4"}},
mridge949c5b12006-01-03 23:01:28 +000098/* icmp6_hdr definitions */
Wanlong Gao354ebb42012-12-07 10:10:04 +080099 {
100 "icmp6_hdr icmp6_data32 define", ALIAS, ICMP6_H, "icmp6_hdr",
101 "icmp6_dataun.icmp6_un_data32", NULL, {
102 "icmp6_data32"}}, {
103 "icmp6_hdr icmp6_data16 define", ALIAS, ICMP6_H, "icmp6_hdr",
104 "icmp6_dataun.icmp6_un_data16", NULL, {
105 "icmp6_data16"}}, {
106 "icmp6_hdr icmp6_data8 define", ALIAS, ICMP6_H, "icmp6_hdr",
107 "icmp6_dataun.icmp6_un_data8", NULL, {
108 "icmp6_data8"}}, {
109 "icmp6_hdr icmp6_pptr define", ALIAS, ICMP6_H, "icmp6_hdr",
110 "icmp6_dataun.icmp6_un_data32[0]", NULL, {
111 "icmp6_pptr"}}, {
112 "icmp6_hdr icmp6_mtu define", ALIAS, ICMP6_H, "icmp6_hdr",
113 "icmp6_dataun.icmp6_un_data32[0]", NULL, {
114 "icmp6_mtu"}}, {
115 "icmp6_hdr icmp6_id define", ALIAS, ICMP6_H, "icmp6_hdr",
116 "icmp6_dataun.icmp6_un_data16[0]", NULL, {
117 "icmp6_id"}}, {
118 "icmp6_hdr icmp6_seq define", ALIAS, ICMP6_H, "icmp6_hdr",
119 "icmp6_dataun.icmp6_un_data16[1]", NULL, {
120 "icmp6_seq"}}, {
121 "icmp6_hdr icmp6_maxdelay define", ALIAS, ICMP6_H, "icmp6_hdr",
122 "icmp6_dataun.icmp6_un_data16[0]", NULL, {
123 "icmp6_maxdelay"}},
mridge949c5b12006-01-03 23:01:28 +0000124/* Section 2.2.1 ICMPv6 Type and Code Values */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800125 {
126 "ICMP6_DST_UNREACH", VALUE, ICMP6_H, "ICMP6_DST_UNREACH",
127 NULL, NULL, {
128 "1"}}, {
129 "ICMP6_PACKET_TOO_BIG", VALUE, ICMP6_H, "ICMP6_PACKET_TOO_BIG",
130 NULL, NULL, {
131 "2"}}, {
132 "ICMP6_TIME_EXCEEDED", VALUE, ICMP6_H, "ICMP6_TIME_EXCEEDED",
133 NULL, NULL, {
134 "3"}}, {
135 "ICMP6_PARAM_PROB", VALUE, ICMP6_H, "ICMP6_PARAM_PROB",
136 NULL, NULL, {
137 "4"}}, {
138 "ICMP6_INFOMSG_MASK", VALUE, ICMP6_H, "ICMP6_INFOMSG_MASK",
139 NULL, NULL, {
140 "0x80"}}, {
141 "ICMP6_ECHO_REQUEST", VALUE, ICMP6_H, "ICMP6_ECHO_REQUEST",
142 NULL, NULL, {
143 "128"}}, {
144 "ICMP6_ECHO_REPLY", VALUE, ICMP6_H, "ICMP6_ECHO_REPLY",
145 NULL, NULL, {
146 "129"}}, {
147 "ICMP6_DST_UNREACH_NOROUTE", VALUE, ICMP6_H,
148 "ICMP6_DST_UNREACH_NOROUTE", NULL, NULL, {
149 "0"}}, {
150 "ICMP6_DST_UNREACH_ADMIN", VALUE, ICMP6_H,
151 "ICMP6_DST_UNREACH_ADMIN", NULL, NULL, {
152 "1"}}, {
153 "ICMP6_DST_UNREACH_BEYONDSCOPE", VALUE, ICMP6_H,
154 "ICMP6_DST_UNREACH_BEYONDSCOPE", NULL, NULL, {
155 "2"}}, {
156 "ICMP6_DST_UNREACH_ADDR", VALUE, ICMP6_H,
157 "ICMP6_DST_UNREACH_ADDR", NULL, NULL, {
158 "3"}}, {
159 "ICMP6_DST_UNREACH_NOPORT", VALUE, ICMP6_H,
160 "ICMP6_DST_UNREACH_NOPORT", NULL, NULL, {
161 "4"}}, {
162 "ICMP6_TIME_EXCEED_TRANSIT", VALUE, ICMP6_H,
163 "ICMP6_TIME_EXCEED_TRANSIT", NULL, NULL, {
164 "0"}}, {
165 "ICMP6_TIME_EXCEED_REASSEMBLY", VALUE, ICMP6_H,
166 "ICMP6_TIME_EXCEED_REASSEMBLY", NULL, NULL, {
167 "1"}}, {
168 "ICMP6_PARAMPROB_HEADER", VALUE, ICMP6_H,
169 "ICMP6_PARAMPROB_HEADER", NULL, NULL, {
170 "0"}}, {
171 "ICMP6_PARAMPROB_NEXTHEADER", VALUE, ICMP6_H,
172 "ICMP6_PARAMPROB_NEXTHEADER", NULL, NULL, {
173 "1"}}, {
174 "ICMP6_PARAMPROB_OPTION", VALUE, ICMP6_H,
175 "ICMP6_PARAMPROB_OPTION", NULL, NULL, {
176 "2"}},
mridge949c5b12006-01-03 23:01:28 +0000177/* section 2.2.2, Neighbor Discovery */
Wanlong Gao354ebb42012-12-07 10:10:04 +0800178 {
179 "ND_ROUTER_SOLICIT", VALUE, ICMP6_H, "ND_ROUTER_SOLICIT",
180 NULL, NULL, {
181 "133"}}, {
182 "ND_ROUTER_ADVERT", VALUE, ICMP6_H, "ND_ROUTER_ADVERT",
183 NULL, NULL, {
184 "134"}}, {
185 "ND_NEIGHBOR_SOLICIT", VALUE, ICMP6_H, "ND_NEIGHBOR_SOLICIT",
186 NULL, NULL, {
187 "135"}}, {
188 "ND_NEIGHBOR_ADVERT", VALUE, ICMP6_H, "ND_NEIGHBOR_ADVERT",
189 NULL, NULL, {
190 "136"}}, {
191 "ND_REDIRECT", VALUE, ICMP6_H, "ND_REDIRECT", NULL, NULL, {
192 "137"}}, {
193 "nd_router_solicit nd_rs_hdr", EXISTS, ICMP6_H,
194 "nd_router_solicit", "nd_rs_hdr", "0", {
195 "sizeof(struct icmp6_hdr)"}}, {
196 "nd_router_solicit nd_rs_type define", ALIAS, ICMP6_H,
197 "nd_router_solicit", "nd_rs_hdr.icmp6_type", NULL, {
198 "nd_rs_type"}}, {
199 "nd_router_solicit nd_rs_code define", ALIAS, ICMP6_H,
200 "nd_router_solicit", "nd_rs_hdr.icmp6_code", NULL, {
201 "nd_rs_code"}}, {
202 "nd_router_solicit nd_rs_cksum define", ALIAS, ICMP6_H,
203 "nd_router_solicit", "nd_rs_hdr.icmp6_cksum", NULL, {
204 "nd_rs_cksum"}}, {
205 "nd_router_solicit nd_rs_reserved define", ALIAS, ICMP6_H,
206 "nd_router_solicit", "nd_rs_hdr.icmp6_data32[0]", NULL, {
207 "nd_rs_reserved"}}, {
208 "nd_router_advert nd_ra_hdr", EXISTS, ICMP6_H,
209 "nd_router_advert", "nd_ra_hdr", "0", {
210 "sizeof(struct icmp6_hdr)"}}, {
211 "nd_router_advert nd_ra_reachable", EXISTS, ICMP6_H,
212 "nd_router_advert", "nd_ra_reachable",
213 "sizeof(struct icmp6_hdr)", {
214 "4"}}, {
215 "nd_router_advert nd_ra_retransmit", EXISTS, ICMP6_H,
216 "nd_router_advert", "nd_ra_retransmit",
217 "sizeof(struct icmp6_hdr)+4", {
218 "4"}}, {
219 "nd_router_advert nd_ra_type define", ALIAS, ICMP6_H,
220 "nd_router_advert", "nd_ra_hdr.icmp6_type", NULL, {
221 "nd_ra_type"}}, {
222 "nd_router_advert nd_ra_code define", ALIAS, ICMP6_H,
223 "nd_router_advert", "nd_ra_hdr.icmp6_code", NULL, {
224 "nd_ra_code"}}, {
225 "nd_router_advert nd_ra_cksum define", ALIAS, ICMP6_H,
226 "nd_router_advert", "nd_ra_hdr.icmp6_cksum", NULL, {
227 "nd_ra_cksum"}}, {
228 "nd_router_advert nd_ra_curhoplimit define", ALIAS, ICMP6_H,
229 "nd_router_advert", "nd_ra_hdr.icmp6_data8[0]", NULL, {
230 "nd_ra_curhoplimit"}}, {
231 "nd_router_advert nd_ra_flags_reserved define", ALIAS, ICMP6_H,
232 "nd_router_advert", "nd_ra_hdr.icmp6_data8[1]", NULL, {
233 "nd_ra_flags_reserved"}}, {
234 "ND_RA_FLAG_MANAGED", VALUE, ICMP6_H, "ND_RA_FLAG_MANAGED",
235 NULL, NULL, {
236 "0x80"}}, {
237 "ND_RA_FLAG_OTHER", VALUE, ICMP6_H, "ND_RA_FLAG_OTHER",
238 NULL, NULL, {
239 "0x40"}}, {
240 "nd_router_advert nd_ra_router_lifetime define", ALIAS, ICMP6_H,
241 "nd_router_advert", "nd_ra_hdr.icmp6_data16[1]", NULL, {
242 "nd_ra_router_lifetime"}}, {
243 "nd_neighbor_solicit nd_ns_hdr", EXISTS, ICMP6_H,
244 "nd_neighbor_solicit", "nd_ns_hdr", "0", {
245 "sizeof(struct icmp6_hdr)"}}, {
246 "nd_neighbor_solicit nd_ns_target", EXISTS, ICMP6_H,
247 "nd_neighbor_solicit", "nd_ns_target",
248 "sizeof(struct icmp6_hdr)", {
249 "sizeof(struct in6_addr)"}}, {
250 "nd_neighbor_solicit nd_ns_type define", ALIAS, ICMP6_H,
251 "nd_neighbor_solicit", "nd_ns_hdr.icmp6_type", NULL, {
252 "nd_ns_type"}}, {
253 "nd_neighbor_solicit nd_ns_code define", ALIAS, ICMP6_H,
254 "nd_neighbor_solicit", "nd_ns_hdr.icmp6_code", NULL, {
255 "nd_ns_code"}}, {
256 "nd_neighbor_solicit nd_ns_cksum define", ALIAS, ICMP6_H,
257 "nd_neighbor_solicit", "nd_ns_hdr.icmp6_cksum", NULL, {
258 "nd_ns_cksum"}}, {
259 "nd_neighbor_solicit nd_ns_reserved define", ALIAS, ICMP6_H,
260 "nd_neighbor_solicit", "nd_ns_hdr.icmp6_data32[0]", NULL, {
261 "nd_ns_reserved"}}, {
262 "nd_neighbor_advert nd_na_hdr", EXISTS, ICMP6_H,
263 "nd_neighbor_advert", "nd_na_hdr", "0", {
264 "sizeof(struct icmp6_hdr)"}}, {
265 "nd_neighbor_advert nd_na_target", EXISTS, ICMP6_H,
266 "nd_neighbor_advert", "nd_na_target",
267 "sizeof(struct icmp6_hdr)", {
268 "sizeof(struct in6_addr)"}}, {
269 "nd_neighbor_advert nd_na_type define", ALIAS, ICMP6_H,
270 "nd_neighbor_advert", "nd_na_hdr.icmp6_type", NULL, {
271 "nd_na_type"}}, {
272 "nd_neighbor_advert nd_na_code define", ALIAS, ICMP6_H,
273 "nd_neighbor_advert", "nd_na_hdr.icmp6_code", NULL, {
274 "nd_na_code"}}, {
275 "nd_neighbor_advert nd_na_cksum define", ALIAS, ICMP6_H,
276 "nd_neighbor_advert", "nd_na_hdr.icmp6_cksum", NULL, {
277 "nd_na_cksum"}}, {
278 "nd_neighbor_advert nd_na_flags_reserved define", ALIAS,
279 ICMP6_H, "nd_neighbor_advert", "nd_na_hdr.icmp6_data32[0]",
280 NULL, {
281 "nd_na_flags_reserved"}}, {
282 "ND_NA_FLAG_ROUTER", VALUE, ICMP6_H, "ND_NA_FLAG_ROUTER",
283 NULL, NULL, {
284 "htonl(0x80000000)"}}, {
285 "ND_NA_FLAG_SOLICITED", VALUE, ICMP6_H, "ND_NA_FLAG_SOLICITED",
286 NULL, NULL, {
287 "htonl(0x40000000)"}}, {
288 "ND_NA_FLAG_OVERRIDE", VALUE, ICMP6_H, "ND_NA_FLAG_OVERRIDE",
289 NULL, NULL, {
290 "htonl(0x20000000)"}}, {
291 "nd_redirect nd_rd_hdr", EXISTS, ICMP6_H, "nd_redirect",
292 "nd_rd_hdr", "0", {
293 "sizeof(struct icmp6_hdr)"}}, {
294 "nd_redirect nd_rd_target", EXISTS, ICMP6_H,
295 "nd_redirect", "nd_rd_target", "sizeof(struct icmp6_hdr)", {
296 "sizeof(struct in6_addr)"}}, {
297 "nd_redirect nd_rd_dst", EXISTS, ICMP6_H, "nd_redirect",
298 "nd_rd_dst",
299 "sizeof(struct icmp6_hdr)+sizeof(struct in6_addr)", {
300 "sizeof(struct in6_addr)"}}, {
301 "nd_redirect nd_rd_type define", ALIAS, ICMP6_H,
302 "nd_neighbor_advert", "nd_na_hdr.icmp6_data32[0]", NULL, {
303 "nd_na_flags_reserved"}}, {
304 "nd_opt_hdr nd_rd_hdr", EXISTS, ICMP6_H, "nd_opt_hdr",
305 "nd_opt_type", "0", {
306 "1"}}, {
307 "nd_opt_hdr nd_rd_hdr", EXISTS, ICMP6_H, "nd_opt_hdr",
308 "nd_opt_len", "1", {
309 "1"}}, {
310 "ND_OPT_SOURCE_LINKADDR", VALUE, ICMP6_H,
311 "ND_OPT_SOURCE_LINKADDR", NULL, NULL, {
312 "1"}}, {
313 "ND_OPT_TARGET_LINKADDR", VALUE, ICMP6_H,
314 "ND_OPT_TARGET_LINKADDR", NULL, NULL, {
315 "2"}}, {
316 "ND_OPT_PREFIX_INFORMATION", VALUE, ICMP6_H,
317 "ND_OPT_PREFIX_INFORMATION", NULL, NULL, {
318 "3"}}, {
319 "ND_OPT_REDIRECTED_HEADER", VALUE, ICMP6_H,
320 "ND_OPT_REDIRECTED_HEADER", NULL, NULL, {
321 "4"}}, {
322 "ND_OPT_MTU", VALUE, ICMP6_H, "ND_OPT_MTU", NULL, NULL, {
323 "5"}}, {
324 "nd_opt_prefix_info nd_opt_pi_type", EXISTS, ICMP6_H,
325 "nd_opt_prefix_info", "nd_opt_pi_type", "0", {
326 "1"}}, {
327 "nd_opt_prefix_info nd_opt_pi_len", EXISTS, ICMP6_H,
328 "nd_opt_prefix_info", "nd_opt_pi_len", "1", {
329 "1"}}, {
330 "nd_opt_prefix_info nd_opt_pi_prefix_len", EXISTS, ICMP6_H,
331 "nd_opt_prefix_info", "nd_opt_pi_prefix_len", "2", {
332 "1"}}, {
333 "nd_opt_prefix_info nd_opt_pi_flags_reserved", EXISTS, ICMP6_H,
334 "nd_opt_prefix_info", "nd_opt_pi_flags_reserved", "3", {
335 "1"}}, {
336 "nd_opt_prefix_info nd_opt_pi_valid_time", EXISTS, ICMP6_H,
337 "nd_opt_prefix_info", "nd_opt_pi_valid_time", "4", {
338 "4"}}, {
339 "nd_opt_prefix_info nd_opt_pi_preferred_time", EXISTS, ICMP6_H,
340 "nd_opt_prefix_info", "nd_opt_pi_preferred_time", "8", {
341 "4"}}, {
342 "nd_opt_prefix_info nd_opt_pi_reserved2", EXISTS, ICMP6_H,
343 "nd_opt_prefix_info", "nd_opt_pi_reserved2", "12", {
344 "4"}}, {
345 "nd_opt_prefix_info nd_opt_pi_prefix", EXISTS, ICMP6_H,
346 "nd_opt_prefix_info", "nd_opt_pi_prefix", "16", {
347 "sizeof(struct in6_addr)"}}, {
348 "ND_OPT_PI_FLAG_ONLINK", VALUE, ICMP6_H,
349 "ND_OPT_PI_FLAG_ONLINK", NULL, NULL, {
350 "0x80"}}, {
351 "ND_OPT_PI_FLAG_AUTO", VALUE, ICMP6_H, "ND_OPT_PI_FLAG_AUTO",
352 NULL, NULL, {
353 "0x40"}}, {
354 "nd_opt_rd_hdr nd_opt_rh_type", EXISTS, ICMP6_H,
355 "nd_opt_rd_hdr", "nd_opt_rh_type", "0", {
356 "1"}}, {
357 "nd_opt_rd_hdr nd_opt_rh_len", EXISTS, ICMP6_H, "nd_opt_rd_hdr",
358 "nd_opt_rh_len", "1", {
359 "1"}}, {
360 "nd_opt_rd_hdr nd_opt_rh_reserved1", EXISTS, ICMP6_H,
361 "nd_opt_rd_hdr", "nd_opt_rh_reserved1", "2", {
362 "2"}}, {
363 "nd_opt_rd_hdr nd_opt_rh_reserved2", EXISTS, ICMP6_H,
364 "nd_opt_rd_hdr", "nd_opt_rh_reserved2", "4", {
365 "4"}}, {
366 "nd_opt_mtu nd_opt_mtu_type", EXISTS, ICMP6_H, "nd_opt_mtu",
367 "nd_opt_mtu_type", "0", {
368 "1"}}, {
369 "nd_opt_mtu nd_opt_mtu_len", EXISTS, ICMP6_H, "nd_opt_mtu",
370 "nd_opt_mtu_len", "1", {
371 "1"}}, {
372 "nd_opt_mtu nd_opt_mtu_reserved", EXISTS, ICMP6_H, "nd_opt_mtu",
373 "nd_opt_mtu_reserved", "2", {
374 "2"}}, {
375 "nd_opt_mtu nd_opt_mtu_mtu", EXISTS, ICMP6_H, "nd_opt_mtu",
376 "nd_opt_mtu_mtu", "4", {
377"4"}},};
mridge949c5b12006-01-03 23:01:28 +0000378
379#define FTCOUNT (sizeof(ftab)/sizeof(ftab[0]))
380
381int TST_TOTAL = FTCOUNT;
382
Wanlong Gao354ebb42012-12-07 10:10:04 +0800383int main(int argc, char *argv[])
mridge949c5b12006-01-03 23:01:28 +0000384{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800385 int i, lc;
Cyril Hrubis0b9589f2014-05-27 17:40:33 +0200386 const char *msg;
mridge949c5b12006-01-03 23:01:28 +0000387
388 /* Parse standard options given to run the test. */
Garrett Cooperdf3eb162010-11-28 22:44:32 -0800389 msg = parse_opts(argc, argv, NULL, NULL);
390 if (msg != NULL) {
Garrett Cooper53740502010-12-16 00:04:01 -0800391 tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
mridge949c5b12006-01-03 23:01:28 +0000392 }
393
394 setup();
395
396 for (lc = 0; TEST_LOOPING(lc); ++lc) {
Wanlong Gao354ebb42012-12-07 10:10:04 +0800397 for (i = 0; i < FTCOUNT; ++i) {
mridge949c5b12006-01-03 23:01:28 +0000398 switch (ftab[i].ft_type) {
399 case EXISTS:
400 structcheck(ftab[i].ft_tname, ftab[i].ft_incl,
Wanlong Gao354ebb42012-12-07 10:10:04 +0800401 ftab[i].ft_struct, ftab[i].ft_field,
402 ftab[i].ft_offset,
403 ftab[i].ft_value);
mridge949c5b12006-01-03 23:01:28 +0000404 break;
405 case ALIAS:
406 aliascheck(ftab[i].ft_tname, ftab[i].ft_incl,
Wanlong Gao354ebb42012-12-07 10:10:04 +0800407 ftab[i].ft_struct, ftab[i].ft_field,
408 ftab[i].ft_dname);
mridge949c5b12006-01-03 23:01:28 +0000409 break;
410 case VALUE:
411 valuecheck(ftab[i].ft_tname, ftab[i].ft_incl,
Wanlong Gao354ebb42012-12-07 10:10:04 +0800412 ftab[i].ft_struct, ftab[i].ft_dname);
mridge949c5b12006-01-03 23:01:28 +0000413 break;
414 default:
415 tst_resm(TBROK, "invalid type %d",
Wanlong Gao354ebb42012-12-07 10:10:04 +0800416 ftab[i].ft_type);
mridge949c5b12006-01-03 23:01:28 +0000417 break;
418 }
419 }
420 }
421
422 cleanup();
Garrett Cooper2c282152010-12-16 00:55:50 -0800423
424 tst_exit();
mridge949c5b12006-01-03 23:01:28 +0000425}
426
Wanlong Gao354ebb42012-12-07 10:10:04 +0800427void setup(void)
mridge949c5b12006-01-03 23:01:28 +0000428{
Wanlong Gao354ebb42012-12-07 10:10:04 +0800429 TEST_PAUSE; /* if -P option specified */
mridge949c5b12006-01-03 23:01:28 +0000430}
431
Wanlong Gao354ebb42012-12-07 10:10:04 +0800432void cleanup(void)
mridge949c5b12006-01-03 23:01:28 +0000433{
Chris Dearmanec6edca2012-10-17 19:54:01 -0700434}