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