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