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