1*13885a66Sdarrenr /* $NetBSD: optprintv6.c,v 1.2 2012/07/22 14:27:36 darrenr Exp $ */
2bc4097aaSchristos
3bc4097aaSchristos /*
4c9d5dc6cSdarrenr * Copyright (C) 2012 by Darren Reed.
5bc4097aaSchristos *
6bc4097aaSchristos * See the IPFILTER.LICENCE file for details on licencing.
7bc4097aaSchristos *
8*13885a66Sdarrenr * Id: optprintv6.c,v 1.1.1.2 2012/07/22 13:44:39 darrenr Exp $
9bc4097aaSchristos */
10bc4097aaSchristos #include "ipf.h"
11bc4097aaSchristos
12bc4097aaSchristos
13bc4097aaSchristos #ifdef USE_INET6
14bc4097aaSchristos
optprintv6(sec,optmsk,optbits)15bc4097aaSchristos void optprintv6(sec, optmsk, optbits)
16bc4097aaSchristos u_short *sec;
17bc4097aaSchristos u_long optmsk, optbits;
18bc4097aaSchristos {
19bc4097aaSchristos u_short secmsk = sec[0], secbits = sec[1];
20bc4097aaSchristos struct ipopt_names *io;
21bc4097aaSchristos char *s;
22bc4097aaSchristos
23c9d5dc6cSdarrenr s = " v6hdr ";
24bc4097aaSchristos for (io = v6ionames; io->on_name; io++)
25bc4097aaSchristos if ((io->on_bit & optmsk) &&
26bc4097aaSchristos ((io->on_bit & optmsk) == (io->on_bit & optbits))) {
27bc4097aaSchristos printf("%s%s", s, io->on_name);
28bc4097aaSchristos s = ",";
29bc4097aaSchristos }
30bc4097aaSchristos
31bc4097aaSchristos if ((optmsk && (optmsk != optbits)) ||
32bc4097aaSchristos (secmsk && (secmsk != secbits))) {
33bc4097aaSchristos s = " ";
34bc4097aaSchristos printf(" not v6hdrs");
35bc4097aaSchristos if (optmsk != optbits) {
36bc4097aaSchristos for (io = v6ionames; io->on_name; io++)
37bc4097aaSchristos if ((io->on_bit & optmsk) &&
38bc4097aaSchristos ((io->on_bit & optmsk) !=
39bc4097aaSchristos (io->on_bit & optbits))) {
40bc4097aaSchristos printf("%s%s", s, io->on_name);
41bc4097aaSchristos s = ",";
42bc4097aaSchristos }
43bc4097aaSchristos }
44bc4097aaSchristos
45bc4097aaSchristos }
46bc4097aaSchristos }
47bc4097aaSchristos #endif
48