Home | History | Annotate | Line # | Download | only in netinet
ip_fil_compat.c revision 1.1
      1 /*	$NetBSD: ip_fil_compat.c,v 1.1 2012/03/23 20:36:55 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (C) 2002-2003 by Darren Reed.
      5  *
      6  * See the IPFILTER.LICENCE file for details on licencing.
      7  */
      8 #if defined(KERNEL) || defined(_KERNEL)
      9 # undef KERNEL
     10 # undef _KERNEL
     11 # define        KERNEL	1
     12 # define        _KERNEL	1
     13 #endif
     14 #if defined(__osf__)
     15 # define _PROTO_NET_H_
     16 #endif
     17 #include <sys/param.h>
     18 #include <sys/errno.h>
     19 #include <sys/types.h>
     20 #include <sys/time.h>
     21 #include <sys/file.h>
     22 #if __FreeBSD_version >= 220000 && defined(_KERNEL)
     23 # include <sys/fcntl.h>
     24 # include <sys/filio.h>
     25 #else
     26 # include <sys/ioctl.h>
     27 #endif
     28 #if !defined(_KERNEL)
     29 # include <string.h>
     30 # define _KERNEL
     31 # ifdef __OpenBSD__
     32 struct file;
     33 # endif
     34 # include <sys/uio.h>
     35 # undef _KERNEL
     36 #endif
     37 #include <sys/socket.h>
     38 #if (defined(__osf__) || defined(AIX) || defined(__hpux) || defined(__sgi)) && defined(_KERNEL)
     39 # include "radix_ipf_local.h"
     40 # define _RADIX_H_
     41 #endif
     42 #include <net/if.h>
     43 #if defined(__FreeBSD__)
     44 #  include <sys/cdefs.h>
     45 #  include <sys/proc.h>
     46 #endif
     47 #if defined(_KERNEL)
     48 # include <sys/systm.h>
     49 # if !defined(__SVR4) && !defined(__svr4__)
     50 #  include <sys/mbuf.h>
     51 # endif
     52 #endif
     53 #include <netinet/in.h>
     54 
     55 #include "netinet/ip_compat.h"
     56 #include "netinet/ip_fil.h"
     57 #include "netinet/ip_pool.h"
     58 #include "netinet/ip_htable.h"
     59 #include "netinet/ip_lookup.h"
     60 #include "netinet/ip_nat.h"
     61 #include "netinet/ip_state.h"
     62 #include "netinet/ip_proxy.h"
     63 #include "netinet/ip_auth.h"
     64 /* END OF INCLUDES */
     65 
     66 /*
     67  * NetBSD has moved to 64bit time_t for all architectures.
     68  * For some, such as sparc64, there is no change because long is already
     69  * 64bit, but for others (i386), there is...
     70  */
     71 #ifdef IPFILTER_COMPAT
     72 
     73 # ifdef __NetBSD__
     74 typedef struct timeval_l {
     75 	long	tv_sec;
     76 	long	tv_usec;
     77 } timeval_l_t;
     78 # endif
     79 
     80 /* ------------------------------------------------------------------------ */
     81 
     82 typedef struct tcpinfo4 {
     83 	u_short		ts_sport;
     84 	u_short		ts_dport;
     85 	tcpdata_t	ts_data[2];
     86 } tcpinfo4_t;
     87 
     88 static void ipf_v5tcpinfoto4 __P((tcpinfo_t *, tcpinfo4_t *));
     89 
     90 static void
     91 ipf_v5tcpinfoto4(v5, v4)
     92 	tcpinfo_t *v5;
     93 	tcpinfo4_t *v4;
     94 {
     95 	v4->ts_sport = v5->ts_sport;
     96 	v4->ts_dport = v5->ts_dport;
     97 	v4->ts_data[0] = v5->ts_data[0];
     98 	v4->ts_data[1] = v5->ts_data[1];
     99 }
    100 
    101 typedef struct	fr_ip4	{
    102 	u_32_t	fi_v:4;
    103 	u_32_t	fi_xx:4;
    104 	u_32_t	fi_tos:8;
    105 	u_32_t	fi_ttl:8;
    106 	u_32_t	fi_p:8;
    107 	u_32_t	fi_optmsk;
    108 	i6addr_t fi_src;
    109 	i6addr_t fi_dst;
    110 	u_short	ofi_secmsk;
    111 	u_short	ofi_auth;
    112 	u_32_t	fi_flx;
    113 	u_32_t	fi_tcpmsk;
    114 	u_32_t	fi_res1;
    115 } frip4_t;
    116 
    117 typedef struct	frpcmp4	{
    118 	int	frp_cmp;
    119 	u_short	frp_port;
    120 	u_short	frp_top;
    121 } frpcmp4_t;
    122 
    123 typedef	struct	frtuc4	{
    124 	u_char	ftu_tcpfm;
    125 	u_char	ftu_tcpf;
    126 	frpcmp4_t	ftu_src;
    127 	frpcmp4_t	ftu_dst;
    128 } frtuc4_t;
    129 
    130 typedef	struct	fripf4	{
    131 	frip4_t fri_ip;
    132 	frip4_t fri_mip;
    133 
    134 	u_short	fri_icmpm;
    135 	u_short	fri_icmp;
    136 
    137 	frtuc4_t	fri_tuc;
    138 	int	fri_satype;
    139 	int	fri_datype;
    140 	int	fri_sifpidx;
    141 	int	fri_difpidx;
    142 } fripf4_t;
    143 
    144 typedef struct frdest_4 {
    145 	void		*fd_ifp;
    146 	i6addr_t	ofd_ip6;
    147 	char		fd_ifname[LIFNAMSIZ];
    148 } frdest_4_t;
    149 
    150 /* ------------------------------------------------------------------------ */
    151 
    152 /* 5.1.0 new release (current)
    153  * 4.1.34 changed the size of the time structure used for pps
    154  * 4.1.16 moved the location of fr_flineno
    155  * 4.1.0 base version
    156  */
    157 typedef	struct	frentry_4_1_34 {
    158 	ipfmutex_t	fr_lock;
    159 	struct	frentry	*fr_next;
    160 	struct	frentry	**fr_grp;
    161 	struct	ipscan	*fr_isc;
    162 	void	*fr_ifas[4];
    163 	void	*fr_ptr;	/* for use with fr_arg */
    164 	char	*fr_comment;	/* text comment for rule */
    165 	int	fr_ref;		/* reference count - for grouping */
    166 	int	fr_statecnt;	/* state count - for limit rules */
    167 	int	fr_flineno;	/* line number from conf file */
    168 	U_QUAD_T	fr_hits;
    169 	U_QUAD_T	fr_bytes;
    170 	union {
    171 		struct timeval	frp_lastpkt;
    172 		char	frp_bytes[12];
    173 	} fr_lpu;
    174 	int		fr_curpps;
    175 	union	{
    176 		void		*fru_data;
    177 		char		*fru_caddr;
    178 		fripf4_t	*fru_ipf;
    179 		frentfunc_t	fru_func;
    180 	} fr_dun;
    181 	ipfunc_t fr_func; 	/* call this function */
    182 	int	fr_dsize;
    183 	int	fr_pps;
    184 	int	fr_statemax;	/* max reference count */
    185 	u_32_t	fr_type;
    186 	u_32_t	fr_flags;	/* per-rule flags && options (see below) */
    187 	u_32_t	fr_logtag;	/* user defined log tag # */
    188 	u_32_t	fr_collect;	/* collection number */
    189 	u_int	fr_arg;		/* misc. numeric arg for rule */
    190 	u_int	fr_loglevel;	/* syslog log facility + priority */
    191 	u_int	fr_age[2];	/* non-TCP timeouts */
    192 	u_char	fr_v;
    193 	u_char	fr_icode;	/* return ICMP code */
    194 	char	fr_group[FR_GROUPLEN];	/* group to which this rule belongs */
    195 	char	fr_grhead[FR_GROUPLEN];	/* group # which this rule starts */
    196 	ipftag_t fr_nattag;
    197 	char	fr_ifnames[4][LIFNAMSIZ];
    198 	char	fr_isctag[16];
    199 	frdest_4_t fr_tifs[2];	/* "to"/"reply-to" interface */
    200 	frdest_4_t fr_dif;	/* duplicate packet interface */
    201 	u_int	fr_cksum;	/* checksum on filter rules for performance */
    202 } frentry_4_1_34_t;
    203 
    204 typedef	struct	frentry_4_1_16 {
    205 	ipfmutex_t	fr_lock;
    206 	struct	frentry	*fr_next;
    207 	struct	frentry	**fr_grp;
    208 	struct	ipscan	*fr_isc;
    209 	void	*fr_ifas[4];
    210 	void	*fr_ptr;
    211 	char	*fr_comment;
    212 	int	fr_ref;
    213 	int	fr_statecnt;
    214 	int	fr_flineno;
    215 	U_QUAD_T	fr_hits;
    216 	U_QUAD_T	fr_bytes;
    217 	union {
    218 #ifdef __NetBSD__
    219 		timeval_l_t	frp_lastpkt;
    220 #else
    221 		struct timeval	frp_lastpkt;
    222 #endif
    223 	} fr_lpu;
    224 	int		fr_curpps;
    225 	union	{
    226 		void		*fru_data;
    227 		caddr_t		fru_caddr;
    228 		fripf4_t	*fru_ipf;
    229 		frentfunc_t	fru_func;
    230 	} fr_dun;
    231 	ipfunc_t fr_func;
    232 	int	fr_dsize;
    233 	int	fr_pps;
    234 	int	fr_statemax;
    235 	u_32_t	fr_type;
    236 	u_32_t	fr_flags;
    237 	u_32_t	fr_logtag;
    238 	u_32_t	fr_collect;
    239 	u_int	fr_arg;
    240 	u_int	fr_loglevel;
    241 	u_int	fr_age[2];
    242 	u_char	fr_v;
    243 	u_char	fr_icode;
    244 	char	fr_group[FR_GROUPLEN];
    245 	char	fr_grhead[FR_GROUPLEN];
    246 	ipftag_t fr_nattag;
    247 	char	fr_ifnames[4][LIFNAMSIZ];
    248 	char	fr_isctag[16];
    249 	frdest_4_t fr_tifs[2];
    250 	frdest_4_t fr_dif;
    251 	u_int	fr_cksum;
    252 } frentry_4_1_16_t;
    253 
    254 typedef	struct	frentry_4_1_0 {
    255 	ipfmutex_t	fr_lock;
    256 	struct	frentry	*fr_next;
    257 	struct	frentry	**fr_grp;
    258 	struct	ipscan	*fr_isc;
    259 	void	*fr_ifas[4];
    260 	void	*fr_ptr;
    261 	char	*fr_comment;
    262 	int	fr_ref;
    263 	int	fr_statecnt;
    264 	U_QUAD_T	fr_hits;
    265 	U_QUAD_T	fr_bytes;
    266 	union {
    267 #ifdef __NetBSD__
    268 		timeval_l_t	frp_lastpkt;
    269 #else
    270 		struct timeval	frp_lastpkt;
    271 #endif
    272 	} fr_lpu;
    273 	int		fr_curpps;
    274 
    275 	union	{
    276 		void		*fru_data;
    277 		caddr_t		fru_caddr;
    278 		fripf4_t	*fru_ipf;
    279 		frentfunc_t	fru_func;
    280 	} fr_dun;
    281 	/*
    282 	 * Fields after this may not change whilst in the kernel.
    283 	 */
    284 	ipfunc_t fr_func;
    285 	int	fr_dsize;
    286 	int	fr_pps;
    287 	int	fr_statemax;
    288 	int	fr_flineno;
    289 	u_32_t	fr_type;
    290 	u_32_t	fr_flags;
    291 	u_32_t	fr_logtag;
    292 	u_32_t	fr_collect;
    293 	u_int	fr_arg;
    294 	u_int	fr_loglevel;
    295 	u_int	fr_age[2];
    296 	u_char	fr_v;
    297 	u_char	fr_icode;
    298 	char	fr_group[FR_GROUPLEN];
    299 	char	fr_grhead[FR_GROUPLEN];
    300 	ipftag_t fr_nattag;
    301 	char	fr_ifnames[4][LIFNAMSIZ];
    302 	char	fr_isctag[16];
    303 	frdest_4_t fr_tifs[2];
    304 	frdest_4_t fr_dif;
    305 	u_int	fr_cksum;
    306 } frentry_4_1_0_t;
    307 
    308 /* ------------------------------------------------------------------------ */
    309 
    310 /*
    311  * 5.1.0  new release (current)
    312  * 4.1.32 removed both fin_state and fin_nat, added fin_pktnum
    313  * 4.1.24 added fin_cksum
    314  * 4.1.23 added fin_exthdr
    315  * 4.1.11 added fin_ifname
    316  * 4.1.4  added fin_hbuf
    317  */
    318 typedef	struct	fr_info_4_1_32 {
    319 	void	*fin_ifp;		/* interface packet is `on' */
    320 	frip4_t	fin_fi;		/* IP Packet summary */
    321 	union	{
    322 		u_short	fid_16[2];	/* TCP/UDP ports, ICMP code/type */
    323 		u_32_t	fid_32;
    324 	} fin_dat;
    325 	int	fin_out;		/* in or out ? 1 == out, 0 == in */
    326 	int	fin_rev;		/* state only: 1 = reverse */
    327 	u_short	fin_hlen;		/* length of IP header in bytes */
    328 	u_char	ofin_tcpf;		/* TCP header flags (SYN, ACK, etc) */
    329 	u_char	fin_icode;		/* ICMP error to return */
    330 	u_32_t	fin_rule;		/* rule # last matched */
    331 	char	fin_group[FR_GROUPLEN];	/* group number, -1 for none */
    332 	struct	frentry *fin_fr;	/* last matching rule */
    333 	void	*fin_dp;		/* start of data past IP header */
    334 	int	fin_dlen;		/* length of data portion of packet */
    335 	int	fin_plen;
    336 	int	fin_ipoff;		/* # bytes from buffer start to hdr */
    337 	u_short	fin_id;			/* IP packet id field */
    338 	u_short	fin_off;
    339 	int	fin_depth;		/* Group nesting depth */
    340 	int	fin_error;		/* Error code to return */
    341 	int	fin_cksum;		/* -1 bad, 1 good, 0 not done */
    342 	u_int	fin_pktnum;
    343 	void	*fin_nattag;
    344 	void	*fin_exthdr;
    345 	ip_t	*ofin_ip;
    346 	mb_t	**fin_mp;		/* pointer to pointer to mbuf */
    347 	mb_t	*fin_m;			/* pointer to mbuf */
    348 #ifdef	MENTAT
    349 	mb_t	*fin_qfm;		/* pointer to mblk where pkt starts */
    350 	void	*fin_qpi;
    351 	char	fin_ifname[LIFNAMSIZ];
    352 #endif
    353 #ifdef	__sgi
    354 	void	*fin_hbuf;
    355 #endif
    356 } fr_info_4_1_32_t;
    357 
    358 typedef struct  fr_info_4_1_24 {
    359 	void    *fin_ifp;
    360 	frip4_t fin_fi;
    361 	union   {
    362 		u_short fid_16[2];
    363 		u_32_t  fid_32;
    364 	} fin_dat;
    365 	int     fin_out;
    366 	int     fin_rev;
    367 	u_short fin_hlen;
    368 	u_char  ofin_tcpf;
    369 	u_char  fin_icode;
    370 	u_32_t  fin_rule;
    371 	char    fin_group[FR_GROUPLEN];
    372 	struct  frentry *fin_fr;
    373 	void    *fin_dp;
    374 	int     fin_dlen;
    375 	int     fin_plen;
    376 	int     fin_ipoff;
    377 	u_short fin_id;
    378 	u_short fin_off;
    379 	int     fin_depth;
    380 	int     fin_error;
    381 	int     fin_cksum;
    382 	void	*fin_state;
    383 	void	*fin_nat;
    384 	void    *fin_nattag;
    385 	void    *fin_exthdr;
    386 	ip_t    *ofin_ip;
    387 	mb_t    **fin_mp;
    388 	mb_t    *fin_m;
    389 #ifdef  MENTAT
    390 	mb_t    *fin_qfm;
    391 	void    *fin_qpi;
    392 	char    fin_ifname[LIFNAMSIZ];
    393 #endif
    394 #ifdef  __sgi
    395 	void    *fin_hbuf;
    396 #endif
    397 } fr_info_4_1_24_t;
    398 
    399 typedef struct  fr_info_4_1_23 {
    400 	void    *fin_ifp;
    401 	frip4_t fin_fi;
    402 	union   {
    403 		u_short fid_16[2];
    404 		u_32_t  fid_32;
    405 	} fin_dat;
    406 	int     fin_out;
    407 	int     fin_rev;
    408 	u_short fin_hlen;
    409 	u_char  ofin_tcpf;
    410 	u_char  fin_icode;
    411 	u_32_t  fin_rule;
    412 	char    fin_group[FR_GROUPLEN];
    413 	struct  frentry *fin_fr;
    414 	void    *fin_dp;
    415 	int     fin_dlen;
    416 	int     fin_plen;
    417 	int     fin_ipoff;
    418 	u_short fin_id;
    419 	u_short fin_off;
    420 	int     fin_depth;
    421 	int     fin_error;
    422 	void	*fin_state;
    423 	void	*fin_nat;
    424 	void    *fin_nattag;
    425 	void    *fin_exthdr;
    426 	ip_t    *ofin_ip;
    427 	mb_t    **fin_mp;
    428 	mb_t    *fin_m;
    429 #ifdef  MENTAT
    430 	mb_t    *fin_qfm;
    431 	void    *fin_qpi;
    432 	char    fin_ifname[LIFNAMSIZ];
    433 #endif
    434 #ifdef  __sgi
    435 	void    *fin_hbuf;
    436 #endif
    437 } fr_info_4_1_23_t;
    438 
    439 typedef struct  fr_info_4_1_11 {
    440 	void    *fin_ifp;
    441 	frip4_t fin_fi;
    442 	union   {
    443 		u_short fid_16[2];
    444 		u_32_t  fid_32;
    445 	} fin_dat;
    446 	int     fin_out;
    447 	int     fin_rev;
    448 	u_short fin_hlen;
    449 	u_char  ofin_tcpf;
    450 	u_char  fin_icode;
    451 	u_32_t  fin_rule;
    452 	char    fin_group[FR_GROUPLEN];
    453 	struct  frentry *fin_fr;
    454 	void    *fin_dp;
    455 	int     fin_dlen;
    456 	int     fin_plen;
    457 	int     fin_ipoff;
    458 	u_short fin_id;
    459 	u_short fin_off;
    460 	int     fin_depth;
    461 	int     fin_error;
    462 	void	*fin_state;
    463 	void	*fin_nat;
    464 	void    *fin_nattag;
    465 	ip_t    *ofin_ip;
    466 	mb_t    **fin_mp;
    467 	mb_t    *fin_m;
    468 #ifdef  MENTAT
    469 	mb_t    *fin_qfm;
    470 	void    *fin_qpi;
    471 	char    fin_ifname[LIFNAMSIZ];
    472 #endif
    473 #ifdef  __sgi
    474 	void    *fin_hbuf;
    475 #endif
    476 } fr_info_4_1_11_t;
    477 
    478 /* ------------------------------------------------------------------------ */
    479 
    480 typedef	struct	filterstats_4_1 {
    481 	u_long	fr_pass;	/* packets allowed */
    482 	u_long	fr_block;	/* packets denied */
    483 	u_long	fr_nom;		/* packets which don't match any rule */
    484 	u_long	fr_short;	/* packets which are short */
    485 	u_long	fr_ppkl;	/* packets allowed and logged */
    486 	u_long	fr_bpkl;	/* packets denied and logged */
    487 	u_long	fr_npkl;	/* packets unmatched and logged */
    488 	u_long	fr_pkl;		/* packets logged */
    489 	u_long	fr_skip;	/* packets to be logged but buffer full */
    490 	u_long	fr_ret;		/* packets for which a return is sent */
    491 	u_long	fr_acct;	/* packets for which counting was performed */
    492 	u_long	fr_bnfr;	/* bad attempts to allocate fragment state */
    493 	u_long	fr_nfr;		/* new fragment state kept */
    494 	u_long	fr_cfr;		/* add new fragment state but complete pkt */
    495 	u_long	fr_bads;	/* bad attempts to allocate packet state */
    496 	u_long	fr_ads;		/* new packet state kept */
    497 	u_long	fr_chit;	/* cached hit */
    498 	u_long	fr_tcpbad;	/* TCP checksum check failures */
    499 	u_long	fr_pull[2];	/* good and bad pullup attempts */
    500 	u_long	fr_badsrc;	/* source received doesn't match route */
    501 	u_long	fr_badttl;	/* TTL in packet doesn't reach minimum */
    502 	u_long	fr_bad;		/* bad IP packets to the filter */
    503 	u_long	fr_ipv6;	/* IPv6 packets in/out */
    504 	u_long	fr_ppshit;	/* dropped because of pps ceiling */
    505 	u_long	fr_ipud;	/* IP id update failures */
    506 } filterstats_4_1_t;
    507 
    508 /*
    509  * 5.1.0  new release (current)
    510  * 4.1.33 changed the size of f_locks from IPL_LOGMAX to IPL_LOGSIZE
    511  */
    512 typedef	struct	friostat_4_1_33	{
    513 	struct	filterstats_4_1	of_st[2];
    514 	struct	frentry	*f_ipf[2][2];
    515 	struct	frentry	*f_acct[2][2];
    516 	struct	frentry	*f_ipf6[2][2];
    517 	struct	frentry	*f_acct6[2][2];
    518 	struct	frentry	*f_auth;
    519 	struct	frgroup	*f_groups[IPL_LOGSIZE][2];
    520 	u_long	f_froute[2];
    521 	u_long	f_ticks;
    522 	int	f_locks[IPL_LOGSIZE];
    523 	size_t	f_kmutex_sz;
    524 	size_t	f_krwlock_sz;
    525 	int	f_defpass;	/* default pass - from fr_pass */
    526 	int	f_active;	/* 1 or 0 - active rule set */
    527 	int	f_running;	/* 1 if running, else 0 */
    528 	int	f_logging;	/* 1 if enabled, else 0 */
    529 	int	f_features;
    530 	char	f_version[32];	/* version string */
    531 } friostat_4_1_33_t;
    532 
    533 typedef struct friostat_4_1_0	{
    534 	struct filterstats_4_1 of_st[2];
    535 	struct frentry	*f_ipf[2][2];
    536 	struct frentry	*f_acct[2][2];
    537 	struct frentry	*f_ipf6[2][2];
    538 	struct frentry	*f_acct6[2][2];
    539 	struct frentry	*f_auth;
    540 	struct frgroup	*f_groups[IPL_LOGSIZE][2];
    541 	u_long	f_froute[2];
    542 	u_long	f_ticks;
    543 	int	f_locks[IPL_LOGMAX];
    544 	size_t	f_kmutex_sz;
    545 	size_t	f_krwlock_sz;
    546 	int	f_defpass;
    547 	int	f_active;
    548 	int	f_running;
    549 	int	f_logging;
    550 	int	f_features;
    551 	char	f_version[32];
    552 } friostat_4_1_0_t;
    553 
    554 /* ------------------------------------------------------------------------ */
    555 
    556 /*
    557  * 5.1.0  new release (current)
    558  * 4.1.14 added in_lock
    559  */
    560 typedef	struct	ipnat_4_1_14	{
    561 	ipfmutex_t	in_lock;
    562 	struct	ipnat	*in_next;		/* NAT rule list next */
    563 	struct	ipnat	*in_rnext;		/* rdr rule hash next */
    564 	struct	ipnat	**in_prnext;		/* prior rdr next ptr */
    565 	struct	ipnat	*in_mnext;		/* map rule hash next */
    566 	struct	ipnat	**in_pmnext;		/* prior map next ptr */
    567 	struct	ipftq	*in_tqehead[2];
    568 	void		*in_ifps[2];
    569 	void		*in_apr;
    570 	char		*in_comment;
    571 	i6addr_t	in_next6;
    572 	u_long		in_space;
    573 	u_long		in_hits;
    574 	u_int		in_use;
    575 	u_int		in_hv;
    576 	int		in_flineno;		/* conf. file line number */
    577 	u_short		in_pnext;
    578 	u_char		in_v;
    579 	u_char		in_xxx;
    580 	/* From here to the end is covered by IPN_CMPSIZ */
    581 	u_32_t		in_flags;
    582 	u_32_t		in_mssclamp;		/* if != 0 clamp MSS to this */
    583 	u_int		in_age[2];
    584 	int		in_redir;		/* see below for values */
    585 	int		in_p;			/* protocol. */
    586 	i6addr_t	in_in[2];
    587 	i6addr_t	in_out[2];
    588 	i6addr_t	in_src[2];
    589 	frtuc4_t	in_tuc;
    590 	u_short		in_port[2];
    591 	u_short		in_ppip;		/* ports per IP. */
    592 	u_short		in_ippip;		/* IP #'s per IP# */
    593 	char		in_ifnames[2][LIFNAMSIZ];
    594 	char		in_plabel[APR_LABELLEN];	/* proxy label. */
    595 	ipftag_t	in_tag;
    596 } ipnat_4_1_14_t;
    597 
    598 typedef	struct	ipnat_4_1_0	{
    599 	struct	ipnat	*in_next;
    600 	struct	ipnat	*in_rnext;
    601 	struct	ipnat	**in_prnext;
    602 	struct	ipnat	*in_mnext;
    603 	struct	ipnat	**in_pmnext;
    604 	struct	ipftq	*in_tqehead[2];
    605 	void		*in_ifps[2];
    606 	void		*in_apr;
    607 	char		*in_comment;
    608 	i6addr_t	in_next6;
    609 	u_long		in_space;
    610 	u_long		in_hits;
    611 	u_int		in_use;
    612 	u_int		in_hv;
    613 	int		in_flineno;
    614 	u_short		in_pnext;
    615 	u_char		in_v;
    616 	u_char		in_xxx;
    617 	u_32_t		in_flags;
    618 	u_32_t		in_mssclamp;
    619 	u_int		in_age[2];
    620 	int		in_redir;
    621 	int		in_p;
    622 	i6addr_t	in_in[2];
    623 	i6addr_t	in_out[2];
    624 	i6addr_t	in_src[2];
    625 	frtuc4_t	in_tuc;
    626 	u_short		in_port[2];
    627 	u_short		in_ppip;
    628 	u_short		in_ippip;
    629 	char		in_ifnames[2][LIFNAMSIZ];
    630 	char		in_plabel[APR_LABELLEN];
    631 	ipftag_t	in_tag;
    632 } ipnat_4_1_0_t;
    633 
    634 /* ------------------------------------------------------------------------ */
    635 
    636 typedef	struct	natlookup_4_1_1 {
    637 	struct	in_addr	onl_inip;
    638 	struct	in_addr	onl_outip;
    639 	struct	in_addr	onl_realip;
    640 	int	nl_flags;
    641 	u_short	nl_inport;
    642 	u_short	nl_outport;
    643 	u_short	nl_realport;
    644 } natlookup_4_1_1_t;
    645 
    646 /* ------------------------------------------------------------------------ */
    647 
    648 /*
    649  * 4.1.25 added nat_seqnext (current)
    650  * 4.1.14 added nat_redir
    651  * 4.1.3  moved nat_rev
    652  * 4.1.2  added nat_rev
    653  */
    654 typedef	struct	nat_4_1_25	{
    655 	ipfmutex_t	nat_lock;
    656 	struct	nat_4_1_25	*nat_next;
    657 	struct	nat_4_1_25	**nat_pnext;
    658 	struct	nat_4_1_25	*nat_hnext[2];
    659 	struct	nat_4_1_25	**nat_phnext[2];
    660 	struct	hostmap	*nat_hm;
    661 	void		*nat_data;
    662 	struct	nat_4_1_25	**nat_me;
    663 	struct	ipstate	*nat_state;
    664 	struct	ap_session	*nat_aps;
    665 	frentry_t	*nat_fr;
    666 	struct	ipnat_4_1_14	*nat_ptr;
    667 	void		*nat_ifps[2];
    668 	void		*nat_sync;
    669 	ipftqent_t	nat_tqe;
    670 	u_32_t		nat_flags;
    671 	u_32_t		nat_sumd[2];
    672 	u_32_t		nat_ipsumd;
    673 	u_32_t		nat_mssclamp;
    674 	i6addr_t	nat_inip6;
    675 	i6addr_t	nat_outip6;
    676 	i6addr_t	nat_oip6;
    677 	U_QUAD_T	nat_pkts[2];
    678 	U_QUAD_T	nat_bytes[2];
    679 	union	{
    680 		udpinfo_t	nat_unu;
    681 		tcpinfo4_t	nat_unt;
    682 		icmpinfo_t	nat_uni;
    683 		greinfo_t	nat_ugre;
    684 	} nat_un;
    685 	u_short		nat_oport;
    686 	u_short		nat_use;
    687 	u_char		nat_p;
    688 	int		nat_dir;
    689 	int		nat_ref;
    690 	int		nat_hv[2];
    691 	char		nat_ifnames[2][LIFNAMSIZ];
    692 	int		nat_rev;
    693 	int		nat_redir;
    694 	u_32_t		nat_seqnext[2];
    695 } nat_4_1_25_t;
    696 
    697 typedef	struct	nat_4_1_14	{
    698 	ipfmutex_t	nat_lock;
    699 	struct	nat	*nat_next;
    700 	struct	nat	**nat_pnext;
    701 	struct	nat	*nat_hnext[2];
    702 	struct	nat	**nat_phnext[2];
    703 	struct	hostmap	*nat_hm;
    704 	void		*nat_data;
    705 	struct	nat	**nat_me;
    706 	struct	ipstate	*nat_state;
    707 	struct	ap_session	*nat_aps;
    708 	frentry_t	*nat_fr;
    709 	struct	ipnat	*nat_ptr;
    710 	void		*nat_ifps[2];
    711 	void		*nat_sync;
    712 	ipftqent_t	nat_tqe;
    713 	u_32_t		nat_flags;
    714 	u_32_t		nat_sumd[2];
    715 	u_32_t		nat_ipsumd;
    716 	u_32_t		nat_mssclamp;
    717 	i6addr_t	nat_inip6;
    718 	i6addr_t	nat_outip6;
    719 	i6addr_t	nat_oip6;
    720 	U_QUAD_T	nat_pkts[2];
    721 	U_QUAD_T	nat_bytes[2];
    722 	union	{
    723 		udpinfo_t	nat_unu;
    724 		tcpinfo4_t	nat_unt;
    725 		icmpinfo_t	nat_uni;
    726 		greinfo_t	nat_ugre;
    727 	} nat_un;
    728 	u_short		nat_oport;
    729 	u_short		nat_use;
    730 	u_char		nat_p;
    731 	int		nat_dir;
    732 	int		nat_ref;
    733 	int		nat_hv[2];
    734 	char		nat_ifnames[2][LIFNAMSIZ];
    735 	int		nat_rev;
    736 	int		nat_redir;
    737 } nat_4_1_14_t;
    738 
    739 typedef	struct	nat_4_1_3	{
    740 	ipfmutex_t	nat_lock;
    741 	struct	nat	*nat_next;
    742 	struct	nat	**nat_pnext;
    743 	struct	nat	*nat_hnext[2];
    744 	struct	nat	**nat_phnext[2];
    745 	struct	hostmap	*nat_hm;
    746 	void		*nat_data;
    747 	struct	nat	**nat_me;
    748 	struct	ipstate	*nat_state;
    749 	struct	ap_session	*nat_aps;
    750 	frentry_t	*nat_fr;
    751 	struct	ipnat	*nat_ptr;
    752 	void		*nat_ifps[2];
    753 	void		*nat_sync;
    754 	ipftqent_t	nat_tqe;
    755 	u_32_t		nat_flags;
    756 	u_32_t		nat_sumd[2];
    757 	u_32_t		nat_ipsumd;
    758 	u_32_t		nat_mssclamp;
    759 	i6addr_t	nat_inip6;
    760 	i6addr_t	nat_outip6;
    761 	i6addr_t	nat_oip6;
    762 	U_QUAD_T	nat_pkts[2];
    763 	U_QUAD_T	nat_bytes[2];
    764 	union	{
    765 		udpinfo_t	nat_unu;
    766 		tcpinfo4_t	nat_unt;
    767 		icmpinfo_t	nat_uni;
    768 		greinfo_t	nat_ugre;
    769 	} nat_un;
    770 	u_short		nat_oport;
    771 	u_short		nat_use;
    772 	u_char		nat_p;
    773 	int		nat_dir;
    774 	int		nat_ref;
    775 	int		nat_hv[2];
    776 	char		nat_ifnames[2][LIFNAMSIZ];
    777 	int		nat_rev;
    778 } nat_4_1_3_t;
    779 
    780 
    781 
    782 typedef struct  nat_save_4_1_34    {
    783 	void			*ipn_next;
    784 	struct	nat_4_1_25	ipn_nat;
    785 	struct	ipnat_4_1_14	ipn_ipnat;
    786 	struct	frentry_4_1_34 	ipn_fr;
    787 	int			ipn_dsize;
    788 	char			ipn_data[4];
    789 } nat_save_4_1_34_t;
    790 
    791 typedef	struct	nat_save_4_1_16	{
    792 	void		*ipn_next;
    793 	nat_4_1_14_t	ipn_nat;
    794 	ipnat_t		ipn_ipnat;
    795 	frentry_4_1_16_t	ipn_fr;
    796 	int		ipn_dsize;
    797 	char		ipn_data[4];
    798 } nat_save_4_1_16_t;
    799 
    800 typedef	struct	nat_save_4_1_14	{
    801 	void		*ipn_next;
    802 	nat_4_1_14_t	ipn_nat;
    803 	ipnat_t		ipn_ipnat;
    804 	frentry_4_1_0_t	ipn_fr;
    805 	int		ipn_dsize;
    806 	char		ipn_data[4];
    807 } nat_save_4_1_14_t;
    808 
    809 typedef	struct	nat_save_4_1_3	{
    810 	void		*ipn_next;
    811 	nat_4_1_3_t	ipn_nat;
    812 	ipnat_4_1_0_t	ipn_ipnat;
    813 	frentry_4_1_0_t	ipn_fr;
    814 	int		ipn_dsize;
    815 	char		ipn_data[4];
    816 } nat_save_4_1_3_t;
    817 
    818 /* ------------------------------------------------------------------------ */
    819 
    820 /*
    821  * 5.1.0  new release (current)
    822  * 4.1.32 added ns_uncreate
    823  * 4.1.27 added ns_orphans
    824  * 4.1.16 added ns_ticks
    825  */
    826 typedef	struct	natstat_4_1_32	{
    827 	u_long	ns_mapped[2];
    828 	u_long	ns_rules;
    829 	u_long	ns_added;
    830 	u_long	ns_expire;
    831 	u_long	ns_inuse;
    832 	u_long	ns_logged;
    833 	u_long	ns_logfail;
    834 	u_long	ns_memfail;
    835 	u_long	ns_badnat;
    836 	u_long	ns_addtrpnt;
    837 	nat_t	**ns_table[2];
    838 	hostmap_t **ns_maptable;
    839 	ipnat_t	*ns_list;
    840 	void	*ns_apslist;
    841 	u_int	ns_wilds;
    842 	u_int	ns_nattab_sz;
    843 	u_int	ns_nattab_max;
    844 	u_int	ns_rultab_sz;
    845 	u_int	ns_rdrtab_sz;
    846 	u_int	ns_trpntab_sz;
    847 	u_int	ns_hostmap_sz;
    848 	nat_t	*ns_instances;
    849 	hostmap_t *ns_maplist;
    850 	u_long	*ns_bucketlen[2];
    851 	u_long	ns_ticks;
    852 	u_int	ns_orphans;
    853 	u_long	ns_uncreate[2][2];
    854 } natstat_4_1_32_t;
    855 
    856 typedef struct  natstat_4_1_27 {
    857 	u_long	ns_mapped[2];
    858 	u_long	ns_rules;
    859 	u_long	ns_added;
    860 	u_long	ns_expire;
    861 	u_long	ns_inuse;
    862 	u_long	ns_logged;
    863 	u_long	ns_logfail;
    864 	u_long	ns_memfail;
    865 	u_long	ns_badnat;
    866 	u_long	ns_addtrpnt;
    867 	nat_t	**ns_table[2];
    868 	hostmap_t **ns_maptable;
    869 	ipnat_t *ns_list;
    870 	void    *ns_apslist;
    871 	u_int   ns_wilds;
    872 	u_int   ns_nattab_sz;
    873 	u_int   ns_nattab_max;
    874 	u_int   ns_rultab_sz;
    875 	u_int   ns_rdrtab_sz;
    876 	u_int   ns_trpntab_sz;
    877 	u_int   ns_hostmap_sz;
    878 	nat_t   *ns_instances;
    879 	hostmap_t *ns_maplist;
    880 	u_long  *ns_bucketlen[2];
    881 	u_long  ns_ticks;
    882 	u_int   ns_orphans;
    883 } natstat_4_1_27_t;
    884 
    885 typedef struct  natstat_4_1_16 {
    886 	u_long	ns_mapped[2];
    887 	u_long	ns_rules;
    888 	u_long	ns_added;
    889 	u_long	ns_expire;
    890 	u_long	ns_inuse;
    891 	u_long	ns_logged;
    892 	u_long	ns_logfail;
    893 	u_long	ns_memfail;
    894 	u_long	ns_badnat;
    895 	u_long	ns_addtrpnt;
    896 	nat_t	**ns_table[2];
    897 	hostmap_t **ns_maptable;
    898 	ipnat_t *ns_list;
    899 	void    *ns_apslist;
    900 	u_int   ns_wilds;
    901 	u_int   ns_nattab_sz;
    902 	u_int   ns_nattab_max;
    903 	u_int   ns_rultab_sz;
    904 	u_int   ns_rdrtab_sz;
    905 	u_int   ns_trpntab_sz;
    906 	u_int   ns_hostmap_sz;
    907 	nat_t   *ns_instances;
    908 	hostmap_t *ns_maplist;
    909 	u_long  *ns_bucketlen[2];
    910 	u_long  ns_ticks;
    911 } natstat_4_1_16_t;
    912 
    913 typedef struct  natstat_4_1_0 {
    914 	u_long	ns_mapped[2];
    915 	u_long	ns_rules;
    916 	u_long	ns_added;
    917 	u_long	ns_expire;
    918 	u_long	ns_inuse;
    919 	u_long	ns_logged;
    920 	u_long	ns_logfail;
    921 	u_long	ns_memfail;
    922 	u_long	ns_badnat;
    923 	u_long	ns_addtrpnt;
    924 	nat_t	**ns_table[2];
    925 	hostmap_t **ns_maptable;
    926 	ipnat_t *ns_list;
    927 	void    *ns_apslist;
    928 	u_int   ns_wilds;
    929 	u_int   ns_nattab_sz;
    930 	u_int   ns_nattab_max;
    931 	u_int   ns_rultab_sz;
    932 	u_int   ns_rdrtab_sz;
    933 	u_int   ns_trpntab_sz;
    934 	u_int   ns_hostmap_sz;
    935 	nat_t   *ns_instances;
    936 	hostmap_t *ns_maplist;
    937 	u_long  *ns_bucketlen[2];
    938 } natstat_4_1_0_t;
    939 
    940 /* ------------------------------------------------------------------------ */
    941 
    942 /*
    943  * 5.1.0  new release (current)
    944  * 4.1.32 fra_info:removed both fin_state & fin_nat, added fin_pktnum
    945  * 4.1.29 added fra_flx
    946  * 4.1.24 fra_info:added fin_cksum
    947  * 4.1.23 fra_info:added fin_exthdr
    948  * 4.1.11 fra_info:added fin_ifname
    949  * 4.1.4  fra_info:added fin_hbuf
    950  */
    951 
    952 typedef struct  frauth_4_1_32 {
    953 	int	fra_age;
    954 	int	fra_len;
    955 	int	fra_index;
    956 	u_32_t	fra_pass;
    957 	fr_info_4_1_32_t	fra_info;
    958 	char	*fra_buf;
    959 	u_32_t	fra_flx;
    960 #ifdef	MENTAT
    961 	queue_t	*fra_q;
    962 	mb_t	*fra_m;
    963 #endif
    964 } frauth_4_1_32_t;
    965 
    966 typedef struct  frauth_4_1_29 {
    967 	int	fra_age;
    968 	int	fra_len;
    969 	int	fra_index;
    970 	u_32_t	fra_pass;
    971 	fr_info_4_1_24_t	fra_info;
    972 	char	*fra_buf;
    973 	u_32_t	fra_flx;
    974 #ifdef	MENTAT
    975 	queue_t	*fra_q;
    976 	mb_t	*fra_m;
    977 #endif
    978 } frauth_4_1_29_t;
    979 
    980 typedef struct  frauth_4_1_24 {
    981 	int	fra_age;
    982 	int	fra_len;
    983 	int	fra_index;
    984 	u_32_t	fra_pass;
    985 	fr_info_4_1_24_t	fra_info;
    986 	char	*fra_buf;
    987 #ifdef	MENTAT
    988 	queue_t	*fra_q;
    989 	mb_t	*fra_m;
    990 #endif
    991 } frauth_4_1_24_t;
    992 
    993 typedef struct  frauth_4_1_23 {
    994 	int	fra_age;
    995 	int	fra_len;
    996 	int	fra_index;
    997 	u_32_t	fra_pass;
    998 	fr_info_4_1_23_t	fra_info;
    999 	char	*fra_buf;
   1000 #ifdef	MENTAT
   1001 	queue_t	*fra_q;
   1002 	mb_t	*fra_m;
   1003 #endif
   1004 } frauth_4_1_23_t;
   1005 
   1006 typedef struct  frauth_4_1_11 {
   1007 	int	fra_age;
   1008 	int	fra_len;
   1009 	int	fra_index;
   1010 	u_32_t	fra_pass;
   1011 	fr_info_4_1_11_t	fra_info;
   1012 	char	*fra_buf;
   1013 #ifdef	MENTAT
   1014 	queue_t	*fra_q;
   1015 	mb_t	*fra_m;
   1016 #endif
   1017 } frauth_4_1_11_t;
   1018 
   1019 /* ------------------------------------------------------------------------ */
   1020 
   1021 /*
   1022  * 5.1.0  new release (current)
   1023  * 4.1.16 removed is_nat
   1024  */
   1025 typedef struct ipstate_4_1_16 {
   1026 	ipfmutex_t	is_lock;
   1027 	struct	ipstate	*is_next;
   1028 	struct	ipstate	**is_pnext;
   1029 	struct	ipstate	*is_hnext;
   1030 	struct	ipstate	**is_phnext;
   1031 	struct	ipstate	**is_me;
   1032 	void		*is_ifp[4];
   1033 	void		*is_sync;
   1034 	frentry_t	*is_rule;
   1035 	struct	ipftq	*is_tqehead[2];
   1036 	struct	ipscan	*is_isc;
   1037 	U_QUAD_T	is_pkts[4];
   1038 	U_QUAD_T	is_bytes[4];
   1039 	U_QUAD_T	is_icmppkts[4];
   1040 	struct	ipftqent is_sti;
   1041 	u_int	is_frage[2];
   1042 	int	is_ref;			/* reference count */
   1043 	int	is_isninc[2];
   1044 	u_short	is_sumd[2];
   1045 	i6addr_t	is_src;
   1046 	i6addr_t	is_dst;
   1047 	u_int	is_pass;
   1048 	u_char	is_p;			/* Protocol */
   1049 	u_char	is_v;
   1050 	u_32_t	is_hv;
   1051 	u_32_t	is_tag;
   1052 	u_32_t	is_opt[2];		/* packet options set */
   1053 	u_32_t	is_optmsk[2];		/*    "      "    mask */
   1054 	u_short	is_sec;			/* security options set */
   1055 	u_short	is_secmsk;		/*    "        "    mask */
   1056 	u_short	is_auth;		/* authentication options set */
   1057 	u_short	is_authmsk;		/*    "              "    mask */
   1058 	union {
   1059 		icmpinfo_t	is_ics;
   1060 		tcpinfo4_t	is_ts;
   1061 		udpinfo_t	is_us;
   1062 		greinfo_t	is_ug;
   1063 	} is_ps;
   1064 	u_32_t	is_flags;
   1065 	int	is_flx[2][2];
   1066 	u_32_t	is_rulen;		/* rule number when created */
   1067 	u_32_t	is_s0[2];
   1068 	u_short	is_smsk[2];
   1069 	char	is_group[FR_GROUPLEN];
   1070 	char	is_sbuf[2][16];
   1071 	char	is_ifname[4][LIFNAMSIZ];
   1072 } ipstate_4_1_16_t;
   1073 
   1074 typedef struct ipstate_4_1_0 {
   1075 	ipfmutex_t	is_lock;
   1076 	struct	ipstate	*is_next;
   1077 	struct	ipstate	**is_pnext;
   1078 	struct	ipstate	*is_hnext;
   1079 	struct	ipstate	**is_phnext;
   1080 	struct	ipstate	**is_me;
   1081 	void		*is_ifp[4];
   1082 	void		*is_sync;
   1083 	void		*is_nat[2];
   1084 	frentry_t	*is_rule;
   1085 	struct	ipftq	*is_tqehead[2];
   1086 	struct	ipscan	*is_isc;
   1087 	U_QUAD_T	is_pkts[4];
   1088 	U_QUAD_T	is_bytes[4];
   1089 	U_QUAD_T	is_icmppkts[4];
   1090 	struct	ipftqent is_sti;
   1091 	u_int	is_frage[2];
   1092 	int	is_ref;
   1093 	int	is_isninc[2];
   1094 	u_short	is_sumd[2];
   1095 	i6addr_t	is_src;
   1096 	i6addr_t	is_dst;
   1097 	u_int	is_pass;
   1098 	u_char	is_p;
   1099 	u_char	is_v;
   1100 	u_32_t	is_hv;
   1101 	u_32_t	is_tag;
   1102 	u_32_t	is_opt[2];
   1103 	u_32_t	is_optmsk[2];
   1104 	u_short	is_sec;
   1105 	u_short	is_secmsk;
   1106 	u_short	is_auth;
   1107 	u_short	is_authmsk;
   1108 	union {
   1109 		icmpinfo_t	is_ics;
   1110 		tcpinfo4_t	is_ts;
   1111 		udpinfo_t	is_us;
   1112 		greinfo_t	is_ug;
   1113 	} is_ps;
   1114 	u_32_t	is_flags;
   1115 	int	is_flx[2][2];
   1116 	u_32_t	is_rulen;
   1117 	u_32_t	is_s0[2];
   1118 	u_short	is_smsk[2];
   1119 	char	is_group[FR_GROUPLEN];
   1120 	char	is_sbuf[2][16];
   1121 	char	is_ifname[4][LIFNAMSIZ];
   1122 } ipstate_4_1_0_t;
   1123 
   1124 typedef	struct	ipstate_save_4_1_34	{
   1125 	void	*ips_next;
   1126 	struct	ipstate_4_1_16	ips_is;
   1127 	struct	frentry_4_1_34	ips_fr;
   1128 } ipstate_save_4_1_34_t;
   1129 
   1130 typedef	struct	ipstate_save_4_1_16	{
   1131 	void		*ips_next;
   1132 	ipstate_4_1_0_t	ips_is;
   1133 	frentry_4_1_16_t	ips_fr;
   1134 } ipstate_save_4_1_16_t;
   1135 
   1136 typedef	struct	ipstate_save_4_1_0	{
   1137 	void		*ips_next;
   1138 	ipstate_4_1_0_t	ips_is;
   1139 	frentry_4_1_0_t	ips_fr;
   1140 } ipstate_save_4_1_0_t;
   1141 
   1142 /* ------------------------------------------------------------------------ */
   1143 
   1144 /*
   1145  * 5.1.0  new release (current)
   1146  * 4.1.21 added iss_tcptab
   1147  */
   1148 typedef	struct	ips_stat_4_1_21 {
   1149 	u_long	iss_hits;
   1150 	u_long	iss_miss;
   1151 	u_long	iss_max;
   1152 	u_long	iss_maxref;
   1153 	u_long	iss_tcp;
   1154 	u_long	iss_udp;
   1155 	u_long	iss_icmp;
   1156 	u_long	iss_nomem;
   1157 	u_long	iss_expire;
   1158 	u_long	iss_fin;
   1159 	u_long	iss_active;
   1160 	u_long	iss_logged;
   1161 	u_long	iss_logfail;
   1162 	u_long	iss_inuse;
   1163 	u_long	iss_wild;
   1164 	u_long	iss_killed;
   1165 	u_long	iss_ticks;
   1166 	u_long	iss_bucketfull;
   1167 	int	iss_statesize;
   1168 	int	iss_statemax;
   1169 	ipstate_t **iss_table;
   1170 	ipstate_t *iss_list;
   1171 	u_long	*iss_bucketlen;
   1172 	ipftq_t	*iss_tcptab;
   1173 } ips_stat_4_1_21_t;
   1174 
   1175 typedef	struct	ips_stat_4_1_0 {
   1176 	u_long	iss_hits;
   1177 	u_long	iss_miss;
   1178 	u_long	iss_max;
   1179 	u_long	iss_maxref;
   1180 	u_long	iss_tcp;
   1181 	u_long	iss_udp;
   1182 	u_long	iss_icmp;
   1183 	u_long	iss_nomem;
   1184 	u_long	iss_expire;
   1185 	u_long	iss_fin;
   1186 	u_long	iss_active;
   1187 	u_long	iss_logged;
   1188 	u_long	iss_logfail;
   1189 	u_long	iss_inuse;
   1190 	u_long	iss_wild;
   1191 	u_long	iss_killed;
   1192 	u_long	iss_ticks;
   1193 	u_long	iss_bucketfull;
   1194 	int	iss_statesize;
   1195 	int	iss_statemax;
   1196 	ipstate_t **iss_table;
   1197 	ipstate_t *iss_list;
   1198 	u_long	*iss_bucketlen;
   1199 } ips_stat_4_1_0_t;
   1200 
   1201 /* ------------------------------------------------------------------------ */
   1202 
   1203 typedef	struct	ipfrstat_4_1_1 {
   1204 	u_long	ifs_exists;	/* add & already exists */
   1205 	u_long	ifs_nomem;
   1206 	u_long	ifs_new;
   1207 	u_long	ifs_hits;
   1208 	u_long	ifs_expire;
   1209 	u_long	ifs_inuse;
   1210 	u_long	ifs_retrans0;
   1211 	u_long	ifs_short;
   1212 	struct	ipfr	**ifs_table;
   1213 	struct	ipfr	**ifs_nattab;
   1214 } ipfrstat_4_1_1_t;
   1215 
   1216 /* ------------------------------------------------------------------------ */
   1217 static int ipf_addfrstr __P((char *, int, char *, int));
   1218 static void ipf_v4iptov5 __P((frip4_t *, fr_ip_t *));
   1219 static void ipf_v5iptov4 __P((fr_ip_t *, frip4_t *));
   1220 static void ipfv4tuctov5 __P((frtuc4_t *, frtuc_t *));
   1221 static void ipfv5tuctov4 __P((frtuc_t *, frtuc4_t *));
   1222 static int ipf_v4fripftov5 __P((fripf4_t *, char *));
   1223 static void ipf_v5fripftov4 __P((fripf_t *, fripf4_t *));
   1224 static int fr_frflags4to5 __P((u_32_t));
   1225 static int fr_frflags5to4 __P((u_32_t));
   1226 
   1227 static void friostat_current_to_4_1_0 __P((void *, friostat_4_1_0_t *, int));
   1228 static void friostat_current_to_4_1_33 __P((void *, friostat_4_1_33_t *, int));
   1229 static void ipstate_current_to_4_1_0 __P((void *, ipstate_4_1_0_t *));
   1230 static void ipstate_current_to_4_1_16 __P((void *, ipstate_4_1_16_t *));
   1231 static void ipnat_current_to_4_1_0 __P((void *, ipnat_4_1_0_t *));
   1232 static void ipnat_current_to_4_1_14 __P((void *, ipnat_4_1_14_t *));
   1233 static void frauth_current_to_4_1_11 __P((void *, frauth_4_1_11_t *));
   1234 static void frauth_current_to_4_1_23 __P((void *, frauth_4_1_23_t *));
   1235 static void frauth_current_to_4_1_24 __P((void *, frauth_4_1_24_t *));
   1236 static void frauth_current_to_4_1_29 __P((void *, frauth_4_1_29_t *));
   1237 static void frentry_current_to_4_1_0 __P((void *, frentry_4_1_0_t *));
   1238 static void frentry_current_to_4_1_16 __P((void *, frentry_4_1_16_t *));
   1239 static void frentry_current_to_4_1_34 __P((void *, frentry_4_1_34_t *));
   1240 static void fr_info_current_to_4_1_11 __P((void *, fr_info_4_1_11_t *));
   1241 static void fr_info_current_to_4_1_23 __P((void *, fr_info_4_1_23_t *));
   1242 static void fr_info_current_to_4_1_24 __P((void *, fr_info_4_1_24_t *));
   1243 static void nat_save_current_to_4_1_3 __P((void *, nat_save_4_1_3_t *));
   1244 static void nat_save_current_to_4_1_14 __P((void *, nat_save_4_1_14_t *));
   1245 static void nat_save_current_to_4_1_16 __P((void *, nat_save_4_1_16_t *));
   1246 static void ipstate_save_current_to_4_1_0 __P((void *, ipstate_save_4_1_0_t *));
   1247 static void ipstate_save_current_to_4_1_16 __P((void *, ipstate_save_4_1_16_t *));
   1248 static void ips_stat_current_to_4_1_0 __P((void *, ips_stat_4_1_0_t *));
   1249 static void ips_stat_current_to_4_1_21 __P((void *, ips_stat_4_1_21_t *));
   1250 static void natstat_current_to_4_1_0 __P((void *, natstat_4_1_0_t *));
   1251 static void natstat_current_to_4_1_16 __P((void *, natstat_4_1_16_t *));
   1252 static void natstat_current_to_4_1_27 __P((void *, natstat_4_1_27_t *));
   1253 static void natstat_current_to_4_1_32 __P((void *, natstat_4_1_32_t *));
   1254 static void nat_current_to_4_1_3 __P((void *, nat_4_1_3_t *));
   1255 static void nat_current_to_4_1_14 __P((void *, nat_4_1_14_t *));
   1256 static void nat_current_to_4_1_25 __P((void *, nat_4_1_25_t *));
   1257 
   1258 static void friostat_4_1_0_to_current __P((friostat_4_1_0_t *, void *));
   1259 static void friostat_4_1_33_to_current __P((friostat_4_1_33_t *, void *));
   1260 static void ipnat_4_1_0_to_current __P((ipnat_4_1_0_t *, void *, int));
   1261 static void ipnat_4_1_14_to_current __P((ipnat_4_1_14_t *, void *, int));
   1262 static void frauth_4_1_11_to_current __P((frauth_4_1_11_t *, void *));
   1263 static void frauth_4_1_23_to_current __P((frauth_4_1_23_t *, void *));
   1264 static void frauth_4_1_24_to_current __P((frauth_4_1_24_t *, void *));
   1265 static void frauth_4_1_29_to_current __P((frauth_4_1_29_t *, void *));
   1266 static void frauth_4_1_32_to_current __P((frauth_4_1_32_t *, void *));
   1267 static void frentry_4_1_0_to_current __P((ipf_main_softc_t *, frentry_4_1_0_t *, void *, int));
   1268 static void frentry_4_1_16_to_current __P((ipf_main_softc_t *, frentry_4_1_16_t *, void *, int));
   1269 static void frentry_4_1_34_to_current __P((ipf_main_softc_t *, frentry_4_1_34_t *, void *, int));
   1270 static void fr_info_4_1_11_to_current __P((fr_info_4_1_11_t *, void *));
   1271 static void fr_info_4_1_23_to_current __P((fr_info_4_1_23_t *, void *));
   1272 static void fr_info_4_1_24_to_current __P((fr_info_4_1_24_t *, void *));
   1273 static void fr_info_4_1_32_to_current __P((fr_info_4_1_32_t *, void *));
   1274 static void nat_save_4_1_3_to_current __P((ipf_main_softc_t *, nat_save_4_1_3_t *, void *));
   1275 static void nat_save_4_1_14_to_current __P((ipf_main_softc_t *, nat_save_4_1_14_t *, void *));
   1276 static void nat_save_4_1_16_to_current __P((ipf_main_softc_t *, nat_save_4_1_16_t *, void *));
   1277 
   1278 /* ------------------------------------------------------------------------ */
   1279 /* In this section is a series of short routines that deal with translating */
   1280 /* the smaller data structures used above as their internal changes make    */
   1281 /* them inappropriate for simple assignment.                                */
   1282 /* ------------------------------------------------------------------------ */
   1283 
   1284 
   1285 static int
   1286 ipf_addfrstr(char *names, int namelen, char *str, int maxlen)
   1287 {
   1288 	char *t;
   1289 	int i;
   1290 
   1291 	for (i = maxlen, t = str; (*t != '\0') && (i > 0); i--) {
   1292 		names[namelen++] = *t++;
   1293 	}
   1294 	names[namelen++] = '\0';
   1295 	return namelen;
   1296 }
   1297 
   1298 
   1299 static void
   1300 ipf_v4iptov5(v4, v5)
   1301 	frip4_t *v4;
   1302 	fr_ip_t *v5;
   1303 {
   1304 	v5->fi_v = v4->fi_v;
   1305 	v5->fi_p = v4->fi_p;
   1306 	v5->fi_xx = v4->fi_xx;
   1307 	v5->fi_tos = v4->fi_tos;
   1308 	v5->fi_ttl = v4->fi_ttl;
   1309 	v5->fi_p = v4->fi_p;
   1310 	v5->fi_optmsk = v4->fi_optmsk;
   1311 	v5->fi_src = v4->fi_src;
   1312 	v5->fi_dst = v4->fi_dst;
   1313 	v5->fi_secmsk = v4->ofi_secmsk;
   1314 	v5->fi_auth = v4->ofi_auth;
   1315 	v5->fi_flx = v4->fi_flx;
   1316 	v5->fi_tcpmsk = v4->fi_tcpmsk;
   1317 }
   1318 
   1319 static void
   1320 ipf_v5iptov4(v5, v4)
   1321 	fr_ip_t *v5;
   1322 	frip4_t *v4;
   1323 {
   1324 	v4->fi_v = v5->fi_v;
   1325 	v4->fi_p = v5->fi_p;
   1326 	v4->fi_xx = v5->fi_xx;
   1327 	v4->fi_tos = v5->fi_tos;
   1328 	v4->fi_ttl = v5->fi_ttl;
   1329 	v4->fi_p = v5->fi_p;
   1330 	v4->fi_optmsk = v5->fi_optmsk;
   1331 	v4->fi_src = v5->fi_src;
   1332 	v4->fi_dst = v5->fi_dst;
   1333 	v4->ofi_secmsk = v5->fi_secmsk;
   1334 	v4->ofi_auth = v5->fi_auth;
   1335 	v4->fi_flx = v5->fi_flx;
   1336 	v4->fi_tcpmsk = v5->fi_tcpmsk;
   1337 }
   1338 
   1339 
   1340 static void
   1341 ipfv4tuctov5(v4, v5)
   1342 	frtuc4_t *v4;
   1343 	frtuc_t *v5;
   1344 {
   1345 	v5->ftu_src.frp_cmp = v4->ftu_src.frp_cmp;
   1346 	v5->ftu_src.frp_port = v4->ftu_src.frp_port;
   1347 	v5->ftu_src.frp_top = v4->ftu_src.frp_top;
   1348 	v5->ftu_dst.frp_cmp = v4->ftu_dst.frp_cmp;
   1349 	v5->ftu_dst.frp_port = v4->ftu_dst.frp_port;
   1350 	v5->ftu_dst.frp_top = v4->ftu_dst.frp_top;
   1351 }
   1352 
   1353 
   1354 static void
   1355 ipfv5tuctov4(v5, v4)
   1356 	frtuc_t *v5;
   1357 	frtuc4_t *v4;
   1358 {
   1359 	v4->ftu_src.frp_cmp = v5->ftu_src.frp_cmp;
   1360 	v4->ftu_src.frp_port = v5->ftu_src.frp_port;
   1361 	v4->ftu_src.frp_top = v5->ftu_src.frp_top;
   1362 	v4->ftu_dst.frp_cmp = v5->ftu_dst.frp_cmp;
   1363 	v4->ftu_dst.frp_port = v5->ftu_dst.frp_port;
   1364 	v4->ftu_dst.frp_top = v5->ftu_dst.frp_top;
   1365 }
   1366 
   1367 
   1368 static int
   1369 ipf_v4fripftov5(frp4, dst)
   1370 	fripf4_t *frp4;
   1371 	char *dst;
   1372 {
   1373 	fripf_t *frp;
   1374 
   1375 	frp = (fripf_t *)dst;
   1376 
   1377 	ipf_v4iptov5(&frp4->fri_ip, &frp->fri_ip);
   1378 	ipf_v4iptov5(&frp4->fri_mip, &frp->fri_mip);
   1379 	frp->fri_icmpm = frp4->fri_icmpm;
   1380 	frp->fri_icmp = frp4->fri_icmp;
   1381 	frp->fri_tuc.ftu_tcpfm = frp4->fri_tuc.ftu_tcpfm;
   1382 	frp->fri_tuc.ftu_tcpf = frp4->fri_tuc.ftu_tcpf;
   1383 	ipfv4tuctov5(&frp4->fri_tuc, &frp->fri_tuc);
   1384 	frp->fri_satype = frp4->fri_satype;
   1385 	frp->fri_datype = frp4->fri_datype;
   1386 	frp->fri_sifpidx = frp4->fri_sifpidx;
   1387 	frp->fri_difpidx = frp4->fri_difpidx;
   1388 	return 0;
   1389 }
   1390 
   1391 
   1392 static void
   1393 ipf_v5fripftov4(frp, frp4)
   1394 	fripf_t *frp;
   1395 	fripf4_t *frp4;
   1396 {
   1397 
   1398 	ipf_v5iptov4(&frp->fri_ip, &frp4->fri_ip);
   1399 	ipf_v5iptov4(&frp->fri_mip, &frp4->fri_mip);
   1400 	frp4->fri_icmpm = frp->fri_icmpm;
   1401 	frp4->fri_icmp = frp->fri_icmp;
   1402 	frp4->fri_tuc.ftu_tcpfm = frp->fri_tuc.ftu_tcpfm;
   1403 	frp4->fri_tuc.ftu_tcpf = frp->fri_tuc.ftu_tcpf;
   1404 	ipfv5tuctov4(&frp->fri_tuc, &frp4->fri_tuc);
   1405 	frp4->fri_satype = frp->fri_satype;
   1406 	frp4->fri_datype = frp->fri_datype;
   1407 	frp4->fri_sifpidx = frp->fri_sifpidx;
   1408 	frp4->fri_difpidx = frp->fri_difpidx;
   1409 }
   1410 
   1411 
   1412 /* ------------------------------------------------------------------------ */
   1413 /* ipf_in_compat is the first of two service routines. It is responsible for*/
   1414 /* converting data structures from user space into what's required by the   */
   1415 /* kernel module.                                                           */
   1416 /* ------------------------------------------------------------------------ */
   1417 int
   1418 ipf_in_compat(softc, obj, ptr, size)
   1419 	ipf_main_softc_t *softc;
   1420 	ipfobj_t *obj;
   1421 	void *ptr;
   1422 	int size;
   1423 {
   1424 	int error;
   1425 	int sz;
   1426 
   1427 	IPFERROR(140000);
   1428 	error = EINVAL;
   1429 
   1430 	switch (obj->ipfo_type)
   1431 	{
   1432 	default :
   1433 		break;
   1434 
   1435 	case IPFOBJ_FRENTRY :
   1436 		if (obj->ipfo_rev >= 4013400) {
   1437 			frentry_4_1_34_t *old;
   1438 
   1439 			KMALLOC(old, frentry_4_1_34_t *);
   1440 			if (old == NULL) {
   1441 				IPFERROR(140001);
   1442 				error = ENOMEM;
   1443 				break;
   1444 			}
   1445 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1446 			if (error == 0) {
   1447 				if (old->fr_type != FR_T_NONE &&
   1448 				    old->fr_type != FR_T_IPF) {
   1449 					IPFERROR(140002);
   1450 					error = EINVAL;
   1451 					KFREE(old);
   1452 					break;
   1453 				}
   1454 				frentry_4_1_34_to_current(softc, old,
   1455 							  ptr, size);
   1456 			} else {
   1457 				IPFERROR(140003);
   1458 			}
   1459 			KFREE(old);
   1460 		} else if (obj->ipfo_rev >= 4011600) {
   1461 			frentry_4_1_16_t *old;
   1462 
   1463 			KMALLOC(old, frentry_4_1_16_t *);
   1464 			if (old == NULL) {
   1465 				IPFERROR(140004);
   1466 				error = ENOMEM;
   1467 				break;
   1468 			}
   1469 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1470 			if (error == 0) {
   1471 				if (old->fr_type != FR_T_NONE &&
   1472 				    old->fr_type != FR_T_IPF) {
   1473 					IPFERROR(140005);
   1474 					error = EINVAL;
   1475 					KFREE(old);
   1476 					break;
   1477 				}
   1478 				frentry_4_1_16_to_current(softc, old,
   1479 							  ptr, size);
   1480 			} else {
   1481 				IPFERROR(140006);
   1482 			}
   1483 			KFREE(old);
   1484 		} else {
   1485 			frentry_4_1_0_t *old;
   1486 
   1487 			KMALLOC(old, frentry_4_1_0_t *);
   1488 			if (old == NULL) {
   1489 				IPFERROR(140007);
   1490 				error = ENOMEM;
   1491 				break;
   1492 			}
   1493 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1494 			if (error == 0) {
   1495 				if (old->fr_type != FR_T_NONE &&
   1496 				    old->fr_type != FR_T_IPF) {
   1497 					IPFERROR(140008);
   1498 					error = EINVAL;
   1499 					KFREE(old);
   1500 					break;
   1501 				}
   1502 				frentry_4_1_0_to_current(softc, old, ptr, size);
   1503 			} else {
   1504 				IPFERROR(140009);
   1505 			}
   1506 			KFREE(old);
   1507 		}
   1508 		break;
   1509 
   1510 	case IPFOBJ_IPFSTAT :
   1511 		if (obj->ipfo_rev >= 4013300) {
   1512 			friostat_4_1_33_t *old;
   1513 
   1514 			KMALLOC(old, friostat_4_1_33_t *);
   1515 			if (old == NULL) {
   1516 				IPFERROR(140010);
   1517 				error = ENOMEM;
   1518 				break;
   1519 			}
   1520 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1521 			if (error == 0) {
   1522 				friostat_4_1_33_to_current(old, ptr);
   1523 			} else {
   1524 				IPFERROR(140011);
   1525 			}
   1526 		} else {
   1527 			friostat_4_1_0_t *old;
   1528 
   1529 			KMALLOC(old, friostat_4_1_0_t *);
   1530 			if (old == NULL) {
   1531 				IPFERROR(140012);
   1532 				error = ENOMEM;
   1533 				break;
   1534 			}
   1535 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1536 			if (error == 0) {
   1537 				friostat_4_1_0_to_current(old, ptr);
   1538 			} else {
   1539 				IPFERROR(140013);
   1540 			}
   1541 		}
   1542 		break;
   1543 
   1544 	case IPFOBJ_IPFINFO :	/* unused */
   1545 		break;
   1546 
   1547 	case IPFOBJ_IPNAT :
   1548 		if (obj->ipfo_rev >= 4011400) {
   1549 			ipnat_4_1_14_t *old;
   1550 
   1551 			KMALLOC(old, ipnat_4_1_14_t *);
   1552 			if (old == NULL) {
   1553 				IPFERROR(140014);
   1554 				error = ENOMEM;
   1555 				break;
   1556 			}
   1557 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1558 			if (error == 0) {
   1559 				ipnat_4_1_14_to_current(old, ptr, size);
   1560 			} else {
   1561 				IPFERROR(140015);
   1562 			}
   1563 			KFREE(old);
   1564 		} else {
   1565 			ipnat_4_1_0_t *old;
   1566 
   1567 			KMALLOC(old, ipnat_4_1_0_t *);
   1568 			if (old == NULL) {
   1569 				IPFERROR(140016);
   1570 				error = ENOMEM;
   1571 				break;
   1572 			}
   1573 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1574 			if (error == 0) {
   1575 				ipnat_4_1_0_to_current(old, ptr, size);
   1576 			} else {
   1577 				IPFERROR(140017);
   1578 			}
   1579 			KFREE(old);
   1580 		}
   1581 		break;
   1582 
   1583 	case IPFOBJ_NATSTAT :
   1584 		/*
   1585 		 * Statistics are not copied in.
   1586 		 */
   1587 		break;
   1588 
   1589 	case IPFOBJ_NATSAVE :
   1590 		if (obj->ipfo_rev >= 4011600) {
   1591 			nat_save_4_1_16_t *old16;
   1592 
   1593 			KMALLOC(old16, nat_save_4_1_16_t *);
   1594 			if (old16 == NULL) {
   1595 				IPFERROR(140018);
   1596 				error = ENOMEM;
   1597 				break;
   1598 			}
   1599 			error = COPYIN(obj->ipfo_ptr, old16, sizeof(*old16));
   1600 			if (error == 0) {
   1601 				nat_save_4_1_16_to_current(softc, old16, ptr);
   1602 			} else {
   1603 				IPFERROR(140019);
   1604 			}
   1605 			KFREE(old16);
   1606 		} else if (obj->ipfo_rev >= 4011400) {
   1607 			nat_save_4_1_14_t *old14;
   1608 
   1609 			KMALLOC(old14, nat_save_4_1_14_t *);
   1610 			if (old14 == NULL) {
   1611 				IPFERROR(140020);
   1612 				error = ENOMEM;
   1613 				break;
   1614 			}
   1615 			error = COPYIN(obj->ipfo_ptr, old14, sizeof(*old14));
   1616 			if (error == 0) {
   1617 				nat_save_4_1_14_to_current(softc, old14, ptr);
   1618 			} else {
   1619 				IPFERROR(140021);
   1620 			}
   1621 			KFREE(old14);
   1622 		} else if (obj->ipfo_rev >= 4010300) {
   1623 			nat_save_4_1_3_t *old3;
   1624 
   1625 			KMALLOC(old3, nat_save_4_1_3_t *);
   1626 			if (old3 == NULL) {
   1627 				IPFERROR(140022);
   1628 				error = ENOMEM;
   1629 				break;
   1630 			}
   1631 			error = COPYIN(obj->ipfo_ptr, old3, sizeof(*old3));
   1632 			if (error == 0) {
   1633 				nat_save_4_1_3_to_current(softc, old3, ptr);
   1634 			} else {
   1635 				IPFERROR(140023);
   1636 			}
   1637 			KFREE(old3);
   1638 		}
   1639 		break;
   1640 
   1641 	case IPFOBJ_STATESAVE :
   1642 		if (obj->ipfo_rev >= 4013400) {
   1643 			ipstate_save_4_1_34_t *old;
   1644 
   1645 			KMALLOC(old, ipstate_save_4_1_34_t *);
   1646 			if (old == NULL) {
   1647 				IPFERROR(140024);
   1648 				error = ENOMEM;
   1649 				break;
   1650 			}
   1651 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1652 			if (error != 0) {
   1653 				IPFERROR(140025);
   1654 			}
   1655 			KFREE(old);
   1656 		} else if (obj->ipfo_rev >= 4011600) {
   1657 			ipstate_save_4_1_16_t *old;
   1658 
   1659 			KMALLOC(old, ipstate_save_4_1_16_t *);
   1660 			if (old == NULL) {
   1661 				IPFERROR(140026);
   1662 				error = ENOMEM;
   1663 				break;
   1664 			}
   1665 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1666 			if (error != 0) {
   1667 				IPFERROR(140027);
   1668 			}
   1669 			KFREE(old);
   1670 		} else {
   1671 			ipstate_save_4_1_0_t *old;
   1672 
   1673 			KMALLOC(old, ipstate_save_4_1_0_t *);
   1674 			if (old == NULL) {
   1675 				IPFERROR(140028);
   1676 				error = ENOMEM;
   1677 				break;
   1678 			}
   1679 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1680 			if (error != 0) {
   1681 				IPFERROR(140029);
   1682 			}
   1683 			KFREE(old);
   1684 		}
   1685 		break;
   1686 
   1687 	case IPFOBJ_IPSTATE :
   1688 		/*
   1689 		 * This structure is not copied in by itself.
   1690 		 */
   1691 		break;
   1692 
   1693 	case IPFOBJ_STATESTAT :
   1694 		/*
   1695 		 * Statistics are not copied in.
   1696 		 */
   1697 		break;
   1698 
   1699 	case IPFOBJ_FRAUTH :
   1700 		if (obj->ipfo_rev >= 4013200) {
   1701 			frauth_4_1_32_t *old32;
   1702 
   1703 			KMALLOC(old32, frauth_4_1_32_t *);
   1704 			if (old32 == NULL) {
   1705 				IPFERROR(140030);
   1706 				error = ENOMEM;
   1707 				break;
   1708 			}
   1709 			error = COPYIN(obj->ipfo_ptr, old32, sizeof(*old32));
   1710 			if (error == 0) {
   1711 				frauth_4_1_32_to_current(old32, ptr);
   1712 			} else {
   1713 				IPFERROR(140031);
   1714 			}
   1715 			KFREE(old32);
   1716 		} else if (obj->ipfo_rev >= 4012900) {
   1717 			frauth_4_1_29_t *old29;
   1718 
   1719 			KMALLOC(old29, frauth_4_1_29_t *);
   1720 			if (old29 == NULL) {
   1721 				IPFERROR(140032);
   1722 				error = ENOMEM;
   1723 				break;
   1724 			}
   1725 			error = COPYIN(obj->ipfo_ptr, old29, sizeof(*old29));
   1726 			if (error == 0) {
   1727 				frauth_4_1_29_to_current(old29, ptr);
   1728 			} else {
   1729 				IPFERROR(140033);
   1730 			}
   1731 			KFREE(old29);
   1732 		} else if (obj->ipfo_rev >= 4012400) {
   1733 			frauth_4_1_24_t *old24;
   1734 
   1735 			KMALLOC(old24, frauth_4_1_24_t *);
   1736 			if (old24 == NULL) {
   1737 				IPFERROR(140034);
   1738 				error = ENOMEM;
   1739 				break;
   1740 			}
   1741 			error = COPYIN(obj->ipfo_ptr, old24, sizeof(*old24));
   1742 			if (error == 0) {
   1743 				frauth_4_1_24_to_current(old24, ptr);
   1744 			} else {
   1745 				IPFERROR(140035);
   1746 			}
   1747 			KFREE(old24);
   1748 		} else if (obj->ipfo_rev >= 4012300) {
   1749 			frauth_4_1_23_t *old23;
   1750 
   1751 			KMALLOC(old23, frauth_4_1_23_t *);
   1752 			if (old23 == NULL) {
   1753 				IPFERROR(140036);
   1754 				error = ENOMEM;
   1755 				break;
   1756 			}
   1757 			error = COPYIN(obj->ipfo_ptr, old23, sizeof(*old23));
   1758 			if (error == 0)
   1759 				frauth_4_1_23_to_current(old23, ptr);
   1760 			KFREE(old23);
   1761 		} else if (obj->ipfo_rev >= 4011100) {
   1762 			frauth_4_1_11_t *old11;
   1763 
   1764 			KMALLOC(old11, frauth_4_1_11_t *);
   1765 			if (old11 == NULL) {
   1766 				IPFERROR(140037);
   1767 				error = ENOMEM;
   1768 				break;
   1769 			}
   1770 			error = COPYIN(obj->ipfo_ptr, old11, sizeof(*old11));
   1771 			if (error == 0) {
   1772 				frauth_4_1_11_to_current(old11, ptr);
   1773 			} else {
   1774 				IPFERROR(140038);
   1775 			}
   1776 			KFREE(old11);
   1777 		}
   1778 		break;
   1779 
   1780 	case IPFOBJ_NAT :
   1781 		if (obj->ipfo_rev >= 4011400) {
   1782 			sz = sizeof(nat_4_1_14_t);
   1783 		} else if (obj->ipfo_rev >= 4010300) {
   1784 			sz = sizeof(nat_4_1_3_t);
   1785 		} else {
   1786 			break;
   1787 		}
   1788 		bzero(ptr, sizeof(nat_t));
   1789 		error = COPYIN(obj->ipfo_ptr, ptr, sz);
   1790 		if (error != 0) {
   1791 			IPFERROR(140039);
   1792 		}
   1793 		break;
   1794 
   1795 	case IPFOBJ_FRIPF :
   1796 		if (obj->ipfo_rev < 5000000) {
   1797 			fripf4_t *old;
   1798 
   1799 			KMALLOC(old, fripf4_t *);
   1800 			if (old == NULL) {
   1801 				IPFERROR(140040);
   1802 				error = ENOMEM;
   1803 				break;
   1804 			}
   1805 			error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
   1806 			if (error == 0) {
   1807 				ipf_v4fripftov5(old, ptr);
   1808 			} else {
   1809 				IPFERROR(140041);
   1810 			}
   1811 			KFREE(old);
   1812 		}
   1813 		break;
   1814 	}
   1815 
   1816 	return error;
   1817 }
   1818 /* ------------------------------------------------------------------------ */
   1819 
   1820 
   1821 /*
   1822  * flags is v4 flags, returns v5 flags.
   1823  */
   1824 static int
   1825 fr_frflags4to5(flags)
   1826 	u_32_t flags;
   1827 {
   1828 	u_32_t nflags = 0;
   1829 
   1830 	switch (flags & 0xf) {
   1831 	case 0x0 :
   1832 		nflags |= FR_CALL;
   1833 		break;
   1834 	case 0x1 :
   1835 		nflags |= FR_BLOCK;
   1836 		break;
   1837 	case 0x2 :
   1838 		nflags |= FR_PASS;
   1839 		break;
   1840 	case 0x3 :
   1841 		nflags |= FR_AUTH;
   1842 		break;
   1843 	case 0x4 :
   1844 		nflags |= FR_PREAUTH;
   1845 		break;
   1846 	case 0x5 :
   1847 		nflags |= FR_ACCOUNT;
   1848 		break;
   1849 	case 0x6 :
   1850 		nflags |= FR_SKIP;
   1851 		break;
   1852 	default :
   1853 		break;
   1854 	}
   1855 
   1856 	if (flags & 0x00010)
   1857 		nflags |= FR_LOG;
   1858 	if (flags & 0x00020)
   1859 		nflags |= FR_CALLNOW;
   1860 	if (flags & 0x00080)
   1861 		nflags |= FR_NOTSRCIP;
   1862 	if (flags & 0x00040)
   1863 		nflags |= FR_NOTDSTIP;
   1864 	if (flags & 0x00100)
   1865 		nflags |= FR_QUICK;
   1866 	if (flags & 0x00200)
   1867 		nflags |= FR_KEEPFRAG;
   1868 	if (flags & 0x00400)
   1869 		nflags |= FR_KEEPSTATE;
   1870 	if (flags & 0x00800)
   1871 		nflags |= FR_FASTROUTE;
   1872 	if (flags & 0x01000)
   1873 		nflags |= FR_RETRST;
   1874 	if (flags & 0x02000)
   1875 		nflags |= FR_RETICMP;
   1876 	if (flags & 0x03000)
   1877 		nflags |= FR_FAKEICMP;
   1878 	if (flags & 0x04000)
   1879 		nflags |= FR_OUTQUE;
   1880 	if (flags & 0x08000)
   1881 		nflags |= FR_INQUE;
   1882 	if (flags & 0x10000)
   1883 		nflags |= FR_LOGBODY;
   1884 	if (flags & 0x20000)
   1885 		nflags |= FR_LOGFIRST;
   1886 	if (flags & 0x40000)
   1887 		nflags |= FR_LOGORBLOCK;
   1888 	if (flags & 0x100000)
   1889 		nflags |= FR_FRSTRICT;
   1890 	if (flags & 0x200000)
   1891 		nflags |= FR_STSTRICT;
   1892 	if (flags & 0x400000)
   1893 		nflags |= FR_NEWISN;
   1894 	if (flags & 0x800000)
   1895 		nflags |= FR_NOICMPERR;
   1896 	if (flags & 0x1000000)
   1897 		nflags |= FR_STATESYNC;
   1898 	if (flags & 0x8000000)
   1899 		nflags |= FR_NOMATCH;
   1900 	if (flags & 0x40000000)
   1901 		nflags |= FR_COPIED;
   1902 	if (flags & 0x80000000)
   1903 		nflags |= FR_INACTIVE;
   1904 
   1905 	return nflags;
   1906 }
   1907 
   1908 static void
   1909 frentry_4_1_34_to_current(softc, old, current, size)
   1910 	ipf_main_softc_t *softc;
   1911 	frentry_4_1_34_t *old;
   1912 	void *current;
   1913 	int size;
   1914 {
   1915 	frentry_t *fr = (frentry_t *)current;
   1916 
   1917 	fr->fr_comment = -1;
   1918 	fr->fr_ref = old->fr_ref;
   1919 	fr->fr_statecnt = old->fr_statecnt;
   1920 	fr->fr_hits = old->fr_hits;
   1921 	fr->fr_bytes = old->fr_bytes;
   1922 	fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
   1923 	fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
   1924 	bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
   1925 	fr->fr_func = old->fr_func;
   1926 	fr->fr_dsize = old->fr_dsize;
   1927 	fr->fr_pps = old->fr_pps;
   1928 	fr->fr_statemax = old->fr_statemax;
   1929 	fr->fr_flineno = old->fr_flineno;
   1930 	fr->fr_type = old->fr_type;
   1931 	fr->fr_flags = fr_frflags4to5(old->fr_flags);
   1932 	fr->fr_logtag = old->fr_logtag;
   1933 	fr->fr_collect = old->fr_collect;
   1934 	fr->fr_arg = old->fr_arg;
   1935 	fr->fr_loglevel = old->fr_loglevel;
   1936 	fr->fr_age[0] = old->fr_age[0];
   1937 	fr->fr_age[1] = old->fr_age[1];
   1938 	fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
   1939 	fr->fr_tifs[0].fd_type = FRD_NORMAL;
   1940 	fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
   1941 	fr->fr_tifs[1].fd_type = FRD_NORMAL;
   1942 	fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
   1943 	fr->fr_dif.fd_type = FRD_NORMAL;
   1944 	if (old->fr_v == 4)
   1945 		fr->fr_family = AF_INET;
   1946 	if (old->fr_v == 6)
   1947 		fr->fr_family = AF_INET6;
   1948 	fr->fr_icode = old->fr_icode;
   1949 	fr->fr_cksum = old->fr_cksum;
   1950 	fr->fr_namelen = 0;
   1951 	fr->fr_ifnames[0] = -1;
   1952 	fr->fr_ifnames[1] = -1;
   1953 	fr->fr_ifnames[2] = -1;
   1954 	fr->fr_ifnames[3] = -1;
   1955 	fr->fr_dif.fd_name = -1;
   1956 	fr->fr_tifs[0].fd_name = -1;
   1957 	fr->fr_tifs[1].fd_name = -1;
   1958 	fr->fr_group = -1;
   1959 	fr->fr_grhead = -1;
   1960 	fr->fr_icmphead = -1;
   1961 	if (size == 0) {
   1962 		fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
   1963 		fr->fr_size += sizeof(fripf_t) + 16;
   1964 		fr->fr_size += 9;	/* room for \0's */
   1965 	} else {
   1966 		char *names = fr->fr_names;
   1967 		int nlen = fr->fr_namelen;
   1968 
   1969 		fr->fr_size = size;
   1970 		if (old->fr_ifnames[0][0] != '\0') {
   1971 			fr->fr_ifnames[0] = nlen;
   1972 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
   1973 					    LIFNAMSIZ);
   1974 		}
   1975 		if (old->fr_ifnames[1][0] != '\0') {
   1976 			fr->fr_ifnames[1] = nlen;
   1977 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
   1978 					    LIFNAMSIZ);
   1979 		}
   1980 		if (old->fr_ifnames[2][0] != '\0') {
   1981 			fr->fr_ifnames[2] = nlen;
   1982 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
   1983 					    LIFNAMSIZ);
   1984 		}
   1985 		if (old->fr_ifnames[3][0] != '\0') {
   1986 			fr->fr_ifnames[3] = nlen;
   1987 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
   1988 					    LIFNAMSIZ);
   1989 		}
   1990 		if (old->fr_tifs[0].fd_ifname[0] != '\0') {
   1991 			fr->fr_tifs[0].fd_name = nlen;
   1992 			nlen = ipf_addfrstr(names, nlen,
   1993 					    old->fr_tifs[0].fd_ifname,
   1994 					    LIFNAMSIZ);
   1995 		}
   1996 		if (old->fr_tifs[1].fd_ifname[0] != '\0') {
   1997 			fr->fr_tifs[1].fd_name = nlen;
   1998 			nlen = ipf_addfrstr(names, nlen,
   1999 					    old->fr_tifs[1].fd_ifname,
   2000 					    LIFNAMSIZ);
   2001 		}
   2002 		if (old->fr_dif.fd_ifname[0] != '\0') {
   2003 			fr->fr_dif.fd_name = nlen;
   2004 			nlen = ipf_addfrstr(names, nlen,
   2005 					    old->fr_dif.fd_ifname, LIFNAMSIZ);
   2006 		}
   2007 		if (old->fr_group[0] != '\0') {
   2008 			fr->fr_group = nlen;
   2009 			nlen = ipf_addfrstr(names, nlen,
   2010 					    old->fr_group, LIFNAMSIZ);
   2011 		}
   2012 		if (old->fr_grhead[0] != '\0') {
   2013 			fr->fr_grhead = nlen;
   2014 			nlen = ipf_addfrstr(names, nlen,
   2015 					    old->fr_grhead, LIFNAMSIZ);
   2016 		}
   2017 		fr->fr_namelen = nlen;
   2018 
   2019 		if (old->fr_type == FR_T_IPF) {
   2020 			int offset = fr->fr_namelen;
   2021 			ipfobj_t obj;
   2022 			int error;
   2023 
   2024 			obj.ipfo_type = IPFOBJ_FRIPF;
   2025 			obj.ipfo_rev = 4010100;
   2026 			obj.ipfo_ptr = old->fr_data;
   2027 
   2028 			if ((offset & 7) != 0)
   2029 				offset += 8 - (offset & 7);
   2030 			error = ipf_in_compat(softc, &obj,
   2031 					      fr->fr_names + offset, 0);
   2032 			if (error == 0) {
   2033 				fr->fr_data = fr->fr_names + offset;
   2034 				fr->fr_dsize = sizeof(fripf_t);
   2035 			}
   2036 		}
   2037 	}
   2038 }
   2039 
   2040 static void
   2041 frentry_4_1_16_to_current(softc, old, current, size)
   2042 	ipf_main_softc_t *softc;
   2043 	frentry_4_1_16_t *old;
   2044 	void *current;
   2045 	int size;
   2046 {
   2047 	frentry_t *fr = (frentry_t *)current;
   2048 
   2049 	fr->fr_comment = -1;
   2050 	fr->fr_ref = old->fr_ref;
   2051 	fr->fr_statecnt = old->fr_statecnt;
   2052 	fr->fr_hits = old->fr_hits;
   2053 	fr->fr_bytes = old->fr_bytes;
   2054 	fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
   2055 	fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
   2056 	bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
   2057 	fr->fr_func = old->fr_func;
   2058 	fr->fr_dsize = old->fr_dsize;
   2059 	fr->fr_pps = old->fr_pps;
   2060 	fr->fr_statemax = old->fr_statemax;
   2061 	fr->fr_flineno = old->fr_flineno;
   2062 	fr->fr_type = old->fr_type;
   2063 	fr->fr_flags = fr_frflags4to5(old->fr_flags);
   2064 	fr->fr_logtag = old->fr_logtag;
   2065 	fr->fr_collect = old->fr_collect;
   2066 	fr->fr_arg = old->fr_arg;
   2067 	fr->fr_loglevel = old->fr_loglevel;
   2068 	fr->fr_age[0] = old->fr_age[0];
   2069 	fr->fr_age[1] = old->fr_age[1];
   2070 	fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
   2071 	fr->fr_tifs[0].fd_type = FRD_NORMAL;
   2072 	fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
   2073 	fr->fr_tifs[1].fd_type = FRD_NORMAL;
   2074 	fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
   2075 	fr->fr_dif.fd_type = FRD_NORMAL;
   2076 	if (old->fr_v == 4)
   2077 		fr->fr_family = AF_INET;
   2078 	if (old->fr_v == 6)
   2079 		fr->fr_family = AF_INET6;
   2080 	fr->fr_icode = old->fr_icode;
   2081 	fr->fr_cksum = old->fr_cksum;
   2082 	fr->fr_namelen = 0;
   2083 	fr->fr_ifnames[0] = -1;
   2084 	fr->fr_ifnames[1] = -1;
   2085 	fr->fr_ifnames[2] = -1;
   2086 	fr->fr_ifnames[3] = -1;
   2087 	fr->fr_dif.fd_name = -1;
   2088 	fr->fr_tifs[0].fd_name = -1;
   2089 	fr->fr_tifs[1].fd_name = -1;
   2090 	fr->fr_group = -1;
   2091 	fr->fr_grhead = -1;
   2092 	fr->fr_icmphead = -1;
   2093 	if (size == 0) {
   2094 		fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
   2095 		fr->fr_size += 9;	/* room for \0's */
   2096 	} else {
   2097 		char *names = fr->fr_names;
   2098 		int nlen = fr->fr_namelen;
   2099 
   2100 		fr->fr_size = size;
   2101 		if (old->fr_ifnames[0][0] != '\0') {
   2102 			fr->fr_ifnames[0] = nlen;
   2103 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
   2104 					    LIFNAMSIZ);
   2105 		}
   2106 		if (old->fr_ifnames[1][0] != '\0') {
   2107 			fr->fr_ifnames[1] = nlen;
   2108 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
   2109 					    LIFNAMSIZ);
   2110 		}
   2111 		if (old->fr_ifnames[2][0] != '\0') {
   2112 			fr->fr_ifnames[2] = nlen;
   2113 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
   2114 					    LIFNAMSIZ);
   2115 		}
   2116 		if (old->fr_ifnames[3][0] != '\0') {
   2117 			fr->fr_ifnames[3] = nlen;
   2118 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
   2119 					    LIFNAMSIZ);
   2120 		}
   2121 		if (old->fr_tifs[0].fd_ifname[0] != '\0') {
   2122 			fr->fr_tifs[0].fd_name = nlen;
   2123 			nlen = ipf_addfrstr(names, nlen,
   2124 					    old->fr_tifs[0].fd_ifname,
   2125 					    LIFNAMSIZ);
   2126 		}
   2127 		if (old->fr_tifs[1].fd_ifname[0] != '\0') {
   2128 			fr->fr_tifs[1].fd_name = nlen;
   2129 			nlen = ipf_addfrstr(names, nlen,
   2130 					    old->fr_tifs[1].fd_ifname,
   2131 					    LIFNAMSIZ);
   2132 		}
   2133 		if (old->fr_dif.fd_ifname[0] != '\0') {
   2134 			fr->fr_dif.fd_name = nlen;
   2135 			nlen = ipf_addfrstr(names, nlen,
   2136 					    old->fr_dif.fd_ifname, LIFNAMSIZ);
   2137 		}
   2138 		if (old->fr_group[0] != '\0') {
   2139 			fr->fr_group = nlen;
   2140 			nlen = ipf_addfrstr(names, nlen,
   2141 					    old->fr_group, LIFNAMSIZ);
   2142 		}
   2143 		if (old->fr_grhead[0] != '\0') {
   2144 			fr->fr_grhead = nlen;
   2145 			nlen = ipf_addfrstr(names, nlen,
   2146 					    old->fr_grhead, LIFNAMSIZ);
   2147 		}
   2148 		fr->fr_namelen = nlen;
   2149 
   2150 		if (old->fr_type == FR_T_IPF) {
   2151 			int offset = fr->fr_namelen;
   2152 			ipfobj_t obj;
   2153 			int error;
   2154 
   2155 			obj.ipfo_type = IPFOBJ_FRIPF;
   2156 			obj.ipfo_rev = 4010100;
   2157 			obj.ipfo_ptr = old->fr_data;
   2158 
   2159 			if ((offset & 7) != 0)
   2160 				offset += 8 - (offset & 7);
   2161 			error = ipf_in_compat(softc, &obj,
   2162 					      fr->fr_names + offset, 0);
   2163 			if (error == 0) {
   2164 				fr->fr_data = fr->fr_names + offset;
   2165 				fr->fr_dsize = sizeof(fripf_t);
   2166 			}
   2167 		}
   2168 	}
   2169 }
   2170 
   2171 
   2172 static void
   2173 frentry_4_1_0_to_current(softc, old, current, size)
   2174 	ipf_main_softc_t *softc;
   2175 	frentry_4_1_0_t *old;
   2176 	void *current;
   2177 	int size;
   2178 {
   2179 	frentry_t *fr = (frentry_t *)current;
   2180 
   2181 	fr->fr_size = sizeof(*fr);
   2182 	fr->fr_comment = -1;
   2183 	fr->fr_ref = old->fr_ref;
   2184 	fr->fr_statecnt = old->fr_statecnt;
   2185 	fr->fr_hits = old->fr_hits;
   2186 	fr->fr_bytes = old->fr_bytes;
   2187 	fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
   2188 	fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
   2189 	bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
   2190 	fr->fr_func = old->fr_func;
   2191 	fr->fr_dsize = old->fr_dsize;
   2192 	fr->fr_pps = old->fr_pps;
   2193 	fr->fr_statemax = old->fr_statemax;
   2194 	fr->fr_flineno = old->fr_flineno;
   2195 	fr->fr_type = old->fr_type;
   2196 	fr->fr_flags = fr_frflags4to5(old->fr_flags);
   2197 	fr->fr_logtag = old->fr_logtag;
   2198 	fr->fr_collect = old->fr_collect;
   2199 	fr->fr_arg = old->fr_arg;
   2200 	fr->fr_loglevel = old->fr_loglevel;
   2201 	fr->fr_age[0] = old->fr_age[0];
   2202 	fr->fr_age[1] = old->fr_age[1];
   2203 	fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
   2204 	fr->fr_tifs[0].fd_type = FRD_NORMAL;
   2205 	fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
   2206 	fr->fr_tifs[1].fd_type = FRD_NORMAL;
   2207 	fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
   2208 	fr->fr_dif.fd_type = FRD_NORMAL;
   2209 	if (old->fr_v == 4)
   2210 		fr->fr_family = AF_INET;
   2211 	if (old->fr_v == 6)
   2212 		fr->fr_family = AF_INET6;
   2213 	fr->fr_icode = old->fr_icode;
   2214 	fr->fr_cksum = old->fr_cksum;
   2215 	fr->fr_namelen = 0;
   2216 	fr->fr_ifnames[0] = -1;
   2217 	fr->fr_ifnames[1] = -1;
   2218 	fr->fr_ifnames[2] = -1;
   2219 	fr->fr_ifnames[3] = -1;
   2220 	fr->fr_dif.fd_name = -1;
   2221 	fr->fr_tifs[0].fd_name = -1;
   2222 	fr->fr_tifs[1].fd_name = -1;
   2223 	fr->fr_group = -1;
   2224 	fr->fr_grhead = -1;
   2225 	fr->fr_icmphead = -1;
   2226 	if (size == 0) {
   2227 		fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
   2228 		fr->fr_size += 9;	/* room for \0's */
   2229 	} else {
   2230 		char *names = fr->fr_names;
   2231 		int nlen = fr->fr_namelen;
   2232 
   2233 		fr->fr_size = size;
   2234 		if (old->fr_ifnames[0][0] != '\0') {
   2235 			fr->fr_ifnames[0] = nlen;
   2236 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
   2237 					    LIFNAMSIZ);
   2238 		}
   2239 		if (old->fr_ifnames[1][0] != '\0') {
   2240 			fr->fr_ifnames[1] = nlen;
   2241 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
   2242 					    LIFNAMSIZ);
   2243 		}
   2244 		if (old->fr_ifnames[2][0] != '\0') {
   2245 			fr->fr_ifnames[2] = nlen;
   2246 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
   2247 					    LIFNAMSIZ);
   2248 		}
   2249 		if (old->fr_ifnames[3][0] != '\0') {
   2250 			fr->fr_ifnames[3] = nlen;
   2251 			nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
   2252 					    LIFNAMSIZ);
   2253 		}
   2254 		if (old->fr_tifs[0].fd_ifname[0] != '\0') {
   2255 			fr->fr_tifs[0].fd_name = nlen;
   2256 			nlen = ipf_addfrstr(names, nlen,
   2257 					    old->fr_tifs[0].fd_ifname,
   2258 					    LIFNAMSIZ);
   2259 		}
   2260 		if (old->fr_tifs[1].fd_ifname[0] != '\0') {
   2261 			fr->fr_tifs[1].fd_name = nlen;
   2262 			nlen = ipf_addfrstr(names, nlen,
   2263 					    old->fr_tifs[1].fd_ifname,
   2264 					    LIFNAMSIZ);
   2265 		}
   2266 		if (old->fr_dif.fd_ifname[0] != '\0') {
   2267 			fr->fr_dif.fd_name = nlen;
   2268 			nlen = ipf_addfrstr(names, nlen,
   2269 					    old->fr_dif.fd_ifname, LIFNAMSIZ);
   2270 		}
   2271 		if (old->fr_group[0] != '\0') {
   2272 			fr->fr_group = nlen;
   2273 			nlen = ipf_addfrstr(names, nlen,
   2274 					    old->fr_group, LIFNAMSIZ);
   2275 		}
   2276 		if (old->fr_grhead[0] != '\0') {
   2277 			fr->fr_grhead = nlen;
   2278 			nlen = ipf_addfrstr(names, nlen,
   2279 					    old->fr_grhead, LIFNAMSIZ);
   2280 		}
   2281 		fr->fr_namelen = nlen;
   2282 
   2283 		if (old->fr_type == FR_T_IPF) {
   2284 			int offset = fr->fr_namelen;
   2285 			ipfobj_t obj;
   2286 			int error;
   2287 
   2288 			obj.ipfo_type = IPFOBJ_FRIPF;
   2289 			obj.ipfo_rev = 4010100;
   2290 			obj.ipfo_ptr = old->fr_data;
   2291 
   2292 			if ((offset & 7) != 0)
   2293 				offset += 8 - (offset & 7);
   2294 				offset += 8 - (offset & 7);
   2295 			error = ipf_in_compat(softc, &obj,
   2296 					      fr->fr_names + offset, 0);
   2297 			if (error == 0) {
   2298 				fr->fr_data = fr->fr_names + offset;
   2299 				fr->fr_dsize = sizeof(fripf_t);
   2300 			}
   2301 		}
   2302 	}
   2303 }
   2304 
   2305 
   2306 static void
   2307 friostat_4_1_33_to_current(old, current)
   2308 	friostat_4_1_33_t *old;
   2309 	void *current;
   2310 {
   2311 	friostat_t *fiop = (friostat_t *)current;
   2312 
   2313 	bcopy(&old->of_st[0], &fiop->f_st[0].fr_pass, sizeof(old->of_st[0]));
   2314 	bcopy(&old->of_st[1], &fiop->f_st[1].fr_pass, sizeof(old->of_st[1]));
   2315 
   2316 	fiop->f_ipf[0][0] = old->f_ipf[0][0];
   2317 	fiop->f_ipf[0][1] = old->f_ipf[0][1];
   2318 	fiop->f_ipf[1][0] = old->f_ipf[1][0];
   2319 	fiop->f_ipf[1][1] = old->f_ipf[1][1];
   2320 	fiop->f_acct[0][0] = old->f_acct[0][0];
   2321 	fiop->f_acct[0][1] = old->f_acct[0][1];
   2322 	fiop->f_acct[1][0] = old->f_acct[1][0];
   2323 	fiop->f_acct[1][1] = old->f_acct[1][1];
   2324 	fiop->f_auth = fiop->f_auth;
   2325 	bcopy(&old->f_groups, &fiop->f_groups, sizeof(old->f_groups));
   2326 	bcopy(&old->f_froute, &fiop->f_froute, sizeof(old->f_froute));
   2327 	fiop->f_ticks = old->f_ticks;
   2328 	bcopy(&old->f_locks, &fiop->f_locks, sizeof(old->f_locks));
   2329 	fiop->f_defpass = old->f_defpass;
   2330 	fiop->f_active = old->f_active;
   2331 	fiop->f_running = old->f_running;
   2332 	fiop->f_logging = old->f_logging;
   2333 	fiop->f_features = old->f_features;
   2334 	bcopy(old->f_version, fiop->f_version, sizeof(old->f_version));
   2335 }
   2336 
   2337 
   2338 static void
   2339 friostat_4_1_0_to_current(old, current)
   2340 	friostat_4_1_0_t *old;
   2341 	void *current;
   2342 {
   2343 	friostat_t *fiop = (friostat_t *)current;
   2344 
   2345 	bcopy(&old->of_st[0], &fiop->f_st[0].fr_pass, sizeof(old->of_st[0]));
   2346 	bcopy(&old->of_st[1], &fiop->f_st[1].fr_pass, sizeof(old->of_st[1]));
   2347 
   2348 	fiop->f_ipf[0][0] = old->f_ipf[0][0];
   2349 	fiop->f_ipf[0][1] = old->f_ipf[0][1];
   2350 	fiop->f_ipf[1][0] = old->f_ipf[1][0];
   2351 	fiop->f_ipf[1][1] = old->f_ipf[1][1];
   2352 	fiop->f_acct[0][0] = old->f_acct[0][0];
   2353 	fiop->f_acct[0][1] = old->f_acct[0][1];
   2354 	fiop->f_acct[1][0] = old->f_acct[1][0];
   2355 	fiop->f_acct[1][1] = old->f_acct[1][1];
   2356 	fiop->f_auth = fiop->f_auth;
   2357 	bcopy(&old->f_groups, &fiop->f_groups, sizeof(old->f_groups));
   2358 	bcopy(&old->f_froute, &fiop->f_froute, sizeof(old->f_froute));
   2359 	fiop->f_ticks = old->f_ticks;
   2360 	bcopy(&old->f_locks, &fiop->f_locks, sizeof(old->f_locks));
   2361 	fiop->f_defpass = old->f_defpass;
   2362 	fiop->f_active = old->f_active;
   2363 	fiop->f_running = old->f_running;
   2364 	fiop->f_logging = old->f_logging;
   2365 	fiop->f_features = old->f_features;
   2366 	bcopy(old->f_version, fiop->f_version, sizeof(old->f_version));
   2367 }
   2368 
   2369 
   2370 static void
   2371 ipnat_4_1_14_to_current(old, current, size)
   2372 	ipnat_4_1_14_t *old;
   2373 	void *current;
   2374 	int size;
   2375 {
   2376 	ipnat_t *np = (ipnat_t *)current;
   2377 
   2378 	np->in_space = old->in_space;
   2379 	np->in_hv[0] = old->in_hv;
   2380 	np->in_hv[1] = old->in_hv;
   2381 	np->in_flineno = old->in_flineno;
   2382 	if (old->in_redir == NAT_REDIRECT)
   2383 		np->in_dpnext = old->in_pnext;
   2384 	else
   2385 		np->in_spnext = old->in_pnext;
   2386 	np->in_v[0] = old->in_v;
   2387 	np->in_v[1] = old->in_v;
   2388 	np->in_flags = old->in_flags;
   2389 	np->in_mssclamp = old->in_mssclamp;
   2390 	np->in_age[0] = old->in_age[0];
   2391 	np->in_age[1] = old->in_age[1];
   2392 	np->in_redir = old->in_redir;
   2393 	np->in_pr[0] = old->in_p;
   2394 	np->in_pr[1] = old->in_p;
   2395 	if (np->in_redir == NAT_REDIRECT) {
   2396 		np->in_ndst.na_nextaddr = old->in_next6;
   2397 		np->in_ndst.na_addr[0] = old->in_in[0];
   2398 		np->in_ndst.na_addr[1] = old->in_in[1];
   2399 		np->in_ndst.na_atype = FRI_NORMAL;
   2400 		np->in_odst.na_addr[0] = old->in_out[0];
   2401 		np->in_odst.na_addr[1] = old->in_out[1];
   2402 		np->in_odst.na_atype = FRI_NORMAL;
   2403 		np->in_osrc.na_addr[0] = old->in_src[0];
   2404 		np->in_osrc.na_addr[1] = old->in_src[1];
   2405 		np->in_osrc.na_atype = FRI_NORMAL;
   2406 	} else {
   2407 		np->in_nsrc.na_nextaddr = old->in_next6;
   2408 		np->in_nsrc.na_addr[0] = old->in_out[0];
   2409 		np->in_nsrc.na_addr[1] = old->in_out[1];
   2410 		np->in_nsrc.na_atype = FRI_NORMAL;
   2411 		np->in_osrc.na_addr[0] = old->in_in[0];
   2412 		np->in_osrc.na_addr[1] = old->in_in[1];
   2413 		np->in_osrc.na_atype = FRI_NORMAL;
   2414 		np->in_odst.na_addr[0] = old->in_src[0];
   2415 		np->in_odst.na_addr[1] = old->in_src[1];
   2416 		np->in_odst.na_atype = FRI_NORMAL;
   2417 	}
   2418 	ipfv4tuctov5(&old->in_tuc, &np->in_tuc);
   2419 	if (np->in_redir == NAT_REDIRECT) {
   2420 		np->in_dpmin = old->in_port[0];
   2421 		np->in_dpmax = old->in_port[1];
   2422 	} else {
   2423 		np->in_spmin = old->in_port[0];
   2424 		np->in_spmax = old->in_port[1];
   2425 	}
   2426 	np->in_ppip = old->in_ppip;
   2427 	np->in_ippip = old->in_ippip;
   2428 	np->in_tag = old->in_tag;
   2429 
   2430 	np->in_namelen = 0;
   2431 	np->in_plabel = -1;
   2432 	np->in_ifnames[0] = -1;
   2433 	np->in_ifnames[1] = -1;
   2434 
   2435 	if (size == 0) {
   2436 		np->in_size = sizeof(*np);
   2437 		np->in_size += LIFNAMSIZ * 2 + APR_LABELLEN;
   2438 		np->in_size += 3;
   2439 	} else {
   2440 		int nlen = np->in_namelen;
   2441 		char *names = np->in_names;
   2442 
   2443 		if (old->in_ifnames[0][0] != '\0') {
   2444 			np->in_ifnames[0] = nlen;
   2445 			nlen = ipf_addfrstr(names, nlen, old->in_ifnames[0],
   2446 					    LIFNAMSIZ);
   2447 		}
   2448 		if (old->in_ifnames[1][0] != '\0') {
   2449 			np->in_ifnames[0] = nlen;
   2450 			nlen = ipf_addfrstr(names, nlen, old->in_ifnames[1],
   2451 					    LIFNAMSIZ);
   2452 		}
   2453 		if (old->in_plabel[0] != '\0') {
   2454 			np->in_plabel = nlen;
   2455 			nlen = ipf_addfrstr(names, nlen, old->in_plabel,
   2456 					    LIFNAMSIZ);
   2457 		}
   2458 		np->in_namelen = nlen;
   2459 		np->in_size = size;
   2460 	}
   2461 }
   2462 
   2463 
   2464 static void
   2465 ipnat_4_1_0_to_current(old, current, size)
   2466 	ipnat_4_1_0_t *old;
   2467 	void *current;
   2468 	int size;
   2469 {
   2470 	ipnat_t *np = (ipnat_t *)current;
   2471 
   2472 	np->in_space = old->in_space;
   2473 	np->in_hv[0] = old->in_hv;
   2474 	np->in_hv[1] = old->in_hv;
   2475 	np->in_flineno = old->in_flineno;
   2476 	if (old->in_redir == NAT_REDIRECT)
   2477 		np->in_dpnext = old->in_pnext;
   2478 	else
   2479 		np->in_spnext = old->in_pnext;
   2480 	np->in_v[0] = old->in_v;
   2481 	np->in_v[1] = old->in_v;
   2482 	np->in_flags = old->in_flags;
   2483 	np->in_mssclamp = old->in_mssclamp;
   2484 	np->in_age[0] = old->in_age[0];
   2485 	np->in_age[1] = old->in_age[1];
   2486 	np->in_redir = old->in_redir;
   2487 	np->in_pr[0] = old->in_p;
   2488 	np->in_pr[1] = old->in_p;
   2489 	if (np->in_redir == NAT_REDIRECT) {
   2490 		np->in_ndst.na_nextaddr = old->in_next6;
   2491 		bcopy(&old->in_in, &np->in_ndst.na_addr, sizeof(old->in_in));
   2492 		bcopy(&old->in_out, &np->in_odst.na_addr, sizeof(old->in_out));
   2493 		bcopy(&old->in_src, &np->in_osrc.na_addr, sizeof(old->in_src));
   2494 	} else {
   2495 		np->in_nsrc.na_nextaddr = old->in_next6;
   2496 		bcopy(&old->in_in, &np->in_osrc.na_addr, sizeof(old->in_in));
   2497 		bcopy(&old->in_out, &np->in_nsrc.na_addr, sizeof(old->in_out));
   2498 		bcopy(&old->in_src, &np->in_odst.na_addr, sizeof(old->in_src));
   2499 	}
   2500 	ipfv4tuctov5(&old->in_tuc, &np->in_tuc);
   2501 	if (np->in_redir == NAT_REDIRECT) {
   2502 		np->in_dpmin = old->in_port[0];
   2503 		np->in_dpmax = old->in_port[1];
   2504 	} else {
   2505 		np->in_spmin = old->in_port[0];
   2506 		np->in_spmax = old->in_port[1];
   2507 	}
   2508 	np->in_ppip = old->in_ppip;
   2509 	np->in_ippip = old->in_ippip;
   2510 	bcopy(&old->in_tag, &np->in_tag, sizeof(np->in_tag));
   2511 
   2512 	np->in_namelen = 0;
   2513 	np->in_plabel = -1;
   2514 	np->in_ifnames[0] = -1;
   2515 	np->in_ifnames[1] = -1;
   2516 
   2517 	if (size == 0) {
   2518 		np->in_size = sizeof(*np);
   2519 		np->in_size += LIFNAMSIZ * 2 + APR_LABELLEN;
   2520 		np->in_size += 3;
   2521 	} else {
   2522 		int nlen = np->in_namelen;
   2523 		char *names = np->in_names;
   2524 
   2525 		if (old->in_ifnames[0][0] != '\0') {
   2526 			np->in_ifnames[0] = nlen;
   2527 			nlen = ipf_addfrstr(names, nlen, old->in_ifnames[0],
   2528 					    LIFNAMSIZ);
   2529 		}
   2530 		if (old->in_ifnames[1][0] != '\0') {
   2531 			np->in_ifnames[0] = nlen;
   2532 			nlen = ipf_addfrstr(names, nlen, old->in_ifnames[1],
   2533 					    LIFNAMSIZ);
   2534 		}
   2535 		if (old->in_plabel[0] != '\0') {
   2536 			np->in_plabel = nlen;
   2537 			nlen = ipf_addfrstr(names, nlen, old->in_plabel,
   2538 					    LIFNAMSIZ);
   2539 		}
   2540 		np->in_namelen = nlen;
   2541 		np->in_size = size;
   2542 	}
   2543 }
   2544 
   2545 
   2546 static void
   2547 frauth_4_1_32_to_current(old, current)
   2548 	frauth_4_1_32_t *old;
   2549 	void *current;
   2550 {
   2551 	frauth_t *fra = (frauth_t *)current;
   2552 
   2553 	fra->fra_age = old->fra_age;
   2554 	fra->fra_len = old->fra_len;
   2555 	fra->fra_index = old->fra_index;
   2556 	fra->fra_pass = old->fra_pass;
   2557 	fr_info_4_1_32_to_current(&old->fra_info, &fra->fra_info);
   2558 	fra->fra_buf = old->fra_buf;
   2559 	fra->fra_flx = old->fra_flx;
   2560 #ifdef	MENTAT
   2561 	fra->fra_q = old->fra_q;
   2562 	fra->fra_m = old->fra_m;
   2563 #endif
   2564 }
   2565 
   2566 
   2567 static void
   2568 frauth_4_1_29_to_current(old, current)
   2569 	frauth_4_1_29_t *old;
   2570 	void *current;
   2571 {
   2572 	frauth_t *fra = (frauth_t *)current;
   2573 
   2574 	fra->fra_age = old->fra_age;
   2575 	fra->fra_len = old->fra_len;
   2576 	fra->fra_index = old->fra_index;
   2577 	fra->fra_pass = old->fra_pass;
   2578 	fr_info_4_1_24_to_current(&old->fra_info, &fra->fra_info);
   2579 	fra->fra_buf = old->fra_buf;
   2580 	fra->fra_flx = old->fra_flx;
   2581 #ifdef	MENTAT
   2582 	fra->fra_q = old->fra_q;
   2583 	fra->fra_m = old->fra_m;
   2584 #endif
   2585 }
   2586 
   2587 
   2588 static void
   2589 frauth_4_1_24_to_current(old, current)
   2590 	frauth_4_1_24_t *old;
   2591 	void *current;
   2592 {
   2593 	frauth_t *fra = (frauth_t *)current;
   2594 
   2595 	fra->fra_age = old->fra_age;
   2596 	fra->fra_len = old->fra_len;
   2597 	fra->fra_index = old->fra_index;
   2598 	fra->fra_pass = old->fra_pass;
   2599 	fr_info_4_1_24_to_current(&old->fra_info, &fra->fra_info);
   2600 	fra->fra_buf = old->fra_buf;
   2601 #ifdef	MENTAT
   2602 	fra->fra_q = old->fra_q;
   2603 	fra->fra_m = old->fra_m;
   2604 #endif
   2605 }
   2606 
   2607 
   2608 static void
   2609 frauth_4_1_23_to_current(old, current)
   2610 	frauth_4_1_23_t *old;
   2611 	void *current;
   2612 {
   2613 	frauth_t *fra = (frauth_t *)current;
   2614 
   2615 	fra->fra_age = old->fra_age;
   2616 	fra->fra_len = old->fra_len;
   2617 	fra->fra_index = old->fra_index;
   2618 	fra->fra_pass = old->fra_pass;
   2619 	fr_info_4_1_23_to_current(&old->fra_info, &fra->fra_info);
   2620 	fra->fra_buf = old->fra_buf;
   2621 #ifdef	MENTAT
   2622 	fra->fra_q = old->fra_q;
   2623 	fra->fra_m = old->fra_m;
   2624 #endif
   2625 }
   2626 
   2627 
   2628 static void
   2629 frauth_4_1_11_to_current(old, current)
   2630 	frauth_4_1_11_t *old;
   2631 	void *current;
   2632 {
   2633 	frauth_t *fra = (frauth_t *)current;
   2634 
   2635 	fra->fra_age = old->fra_age;
   2636 	fra->fra_len = old->fra_len;
   2637 	fra->fra_index = old->fra_index;
   2638 	fra->fra_pass = old->fra_pass;
   2639 	fr_info_4_1_11_to_current(&old->fra_info, &fra->fra_info);
   2640 	fra->fra_buf = old->fra_buf;
   2641 #ifdef	MENTAT
   2642 	fra->fra_q = old->fra_q;
   2643 	fra->fra_m = old->fra_m;
   2644 #endif
   2645 }
   2646 
   2647 
   2648 static void
   2649 fr_info_4_1_32_to_current(old, current)
   2650 	fr_info_4_1_32_t *old;
   2651 	void *current;
   2652 {
   2653 	fr_info_t *fin = (fr_info_t *)current;
   2654 
   2655 	fin->fin_ifp = old->fin_ifp;
   2656 	ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
   2657 	bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
   2658 	fin->fin_out = old->fin_out;
   2659 	fin->fin_rev = old->fin_rev;
   2660 	fin->fin_hlen = old->fin_hlen;
   2661 	fin->fin_tcpf = old->ofin_tcpf;
   2662 	fin->fin_icode = old->fin_icode;
   2663 	fin->fin_rule = old->fin_rule;
   2664 	bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
   2665 	fin->fin_fr = old->fin_fr;
   2666 	fin->fin_dp = old->fin_dp;
   2667 	fin->fin_dlen = old->fin_dlen;
   2668 	fin->fin_plen = old->fin_plen;
   2669 	fin->fin_ipoff = old->fin_ipoff;
   2670 	fin->fin_id = old->fin_id;
   2671 	fin->fin_off = old->fin_off;
   2672 	fin->fin_depth = old->fin_depth;
   2673 	fin->fin_error = old->fin_error;
   2674 	fin->fin_cksum = old->fin_cksum;
   2675 	fin->fin_nattag = old->fin_nattag;
   2676 	fin->fin_ip = old->ofin_ip;
   2677 	fin->fin_mp = old->fin_mp;
   2678 	fin->fin_m = old->fin_m;
   2679 #ifdef  MENTAT
   2680 	fin->fin_qfm = old->fin_qfm;
   2681 	fin->fin_qpi = old->fin_qpi;
   2682 #endif
   2683 #ifdef  __sgi
   2684 	fin->fin_hbuf = old->fin_hbuf;
   2685 #endif
   2686 }
   2687 
   2688 
   2689 static void
   2690 fr_info_4_1_24_to_current(old, current)
   2691 	fr_info_4_1_24_t *old;
   2692 	void *current;
   2693 {
   2694 	fr_info_t *fin = (fr_info_t *)current;
   2695 
   2696 	fin->fin_ifp = old->fin_ifp;
   2697 	ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
   2698 	bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
   2699 	fin->fin_out = old->fin_out;
   2700 	fin->fin_rev = old->fin_rev;
   2701 	fin->fin_hlen = old->fin_hlen;
   2702 	fin->fin_tcpf = old->ofin_tcpf;
   2703 	fin->fin_icode = old->fin_icode;
   2704 	fin->fin_rule = old->fin_rule;
   2705 	bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
   2706 	fin->fin_fr = old->fin_fr;
   2707 	fin->fin_dp = old->fin_dp;
   2708 	fin->fin_dlen = old->fin_dlen;
   2709 	fin->fin_plen = old->fin_plen;
   2710 	fin->fin_ipoff = old->fin_ipoff;
   2711 	fin->fin_id = old->fin_id;
   2712 	fin->fin_off = old->fin_off;
   2713 	fin->fin_depth = old->fin_depth;
   2714 	fin->fin_error = old->fin_error;
   2715 	fin->fin_cksum = old->fin_cksum;
   2716 	fin->fin_nattag = old->fin_nattag;
   2717 	fin->fin_ip = old->ofin_ip;
   2718 	fin->fin_mp = old->fin_mp;
   2719 	fin->fin_m = old->fin_m;
   2720 #ifdef  MENTAT
   2721 	fin->fin_qfm = old->fin_qfm;
   2722 	fin->fin_qpi = old->fin_qpi;
   2723 #endif
   2724 #ifdef  __sgi
   2725 	fin->fin_hbuf = old->fin_hbuf;
   2726 #endif
   2727 }
   2728 
   2729 
   2730 static void
   2731 fr_info_4_1_23_to_current(old, current)
   2732 	fr_info_4_1_23_t *old;
   2733 	void *current;
   2734 {
   2735 	fr_info_t *fin = (fr_info_t *)current;
   2736 
   2737 	fin->fin_ifp = old->fin_ifp;
   2738 	ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
   2739 	bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
   2740 	fin->fin_out = old->fin_out;
   2741 	fin->fin_rev = old->fin_rev;
   2742 	fin->fin_hlen = old->fin_hlen;
   2743 	fin->fin_tcpf = old->ofin_tcpf;
   2744 	fin->fin_icode = old->fin_icode;
   2745 	fin->fin_rule = old->fin_rule;
   2746 	bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
   2747 	fin->fin_fr = old->fin_fr;
   2748 	fin->fin_dp = old->fin_dp;
   2749 	fin->fin_dlen = old->fin_dlen;
   2750 	fin->fin_plen = old->fin_plen;
   2751 	fin->fin_ipoff = old->fin_ipoff;
   2752 	fin->fin_id = old->fin_id;
   2753 	fin->fin_off = old->fin_off;
   2754 	fin->fin_depth = old->fin_depth;
   2755 	fin->fin_error = old->fin_error;
   2756 	fin->fin_nattag = old->fin_nattag;
   2757 	fin->fin_ip = old->ofin_ip;
   2758 	fin->fin_mp = old->fin_mp;
   2759 	fin->fin_m = old->fin_m;
   2760 #ifdef  MENTAT
   2761 	fin->fin_qfm = old->fin_qfm;
   2762 	fin->fin_qpi = old->fin_qpi;
   2763 #endif
   2764 #ifdef  __sgi
   2765 	fin->fin_hbuf = fin->fin_hbuf;
   2766 #endif
   2767 }
   2768 
   2769 
   2770 static void
   2771 fr_info_4_1_11_to_current(old, current)
   2772 	fr_info_4_1_11_t *old;
   2773 	void *current;
   2774 {
   2775 	fr_info_t *fin = (fr_info_t *)current;
   2776 
   2777 	fin->fin_ifp = old->fin_ifp;
   2778 	ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
   2779 	bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
   2780 	fin->fin_out = old->fin_out;
   2781 	fin->fin_rev = old->fin_rev;
   2782 	fin->fin_hlen = old->fin_hlen;
   2783 	fin->fin_tcpf = old->ofin_tcpf;
   2784 	fin->fin_icode = old->fin_icode;
   2785 	fin->fin_rule = old->fin_rule;
   2786 	bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
   2787 	fin->fin_fr = old->fin_fr;
   2788 	fin->fin_dp = old->fin_dp;
   2789 	fin->fin_dlen = old->fin_dlen;
   2790 	fin->fin_plen = old->fin_plen;
   2791 	fin->fin_ipoff = old->fin_ipoff;
   2792 	fin->fin_id = old->fin_id;
   2793 	fin->fin_off = old->fin_off;
   2794 	fin->fin_depth = old->fin_depth;
   2795 	fin->fin_error = old->fin_error;
   2796 	fin->fin_nattag = old->fin_nattag;
   2797 	fin->fin_ip = old->ofin_ip;
   2798 	fin->fin_mp = old->fin_mp;
   2799 	fin->fin_m = old->fin_m;
   2800 #ifdef  MENTAT
   2801 	fin->fin_qfm = old->fin_qfm;
   2802 	fin->fin_qpi = old->fin_qpi;
   2803 #endif
   2804 #ifdef  __sgi
   2805 	fin->fin_hbuf = fin->fin_hbuf;
   2806 #endif
   2807 }
   2808 
   2809 
   2810 static void
   2811 nat_4_1_3_to_current(nat_4_1_3_t *old, nat_t *current)
   2812 {
   2813 	bzero((void *)current, sizeof(*current));
   2814 	bcopy((void *)old, (void *)current, sizeof(*old));
   2815 }
   2816 
   2817 
   2818 static void
   2819 nat_4_1_14_to_current(nat_4_1_14_t *old, nat_t *current)
   2820 {
   2821 	bzero((void *)current, sizeof(*current));
   2822 	bcopy((void *)old, (void *)current, sizeof(*old));
   2823 }
   2824 
   2825 
   2826 static void
   2827 nat_save_4_1_16_to_current(softc, old, current)
   2828 	ipf_main_softc_t *softc;
   2829 	nat_save_4_1_16_t *old;
   2830 	void *current;
   2831 {
   2832 	nat_save_t *nats = (nat_save_t *)current;
   2833 
   2834 	nats->ipn_next = old->ipn_next;
   2835 	nat_4_1_14_to_current(&old->ipn_nat, &nats->ipn_nat);
   2836 	bcopy(&old->ipn_ipnat, &nats->ipn_ipnat, sizeof(old->ipn_ipnat));
   2837 	frentry_4_1_16_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
   2838 	nats->ipn_dsize = old->ipn_dsize;
   2839 	bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
   2840 }
   2841 
   2842 
   2843 static void
   2844 nat_save_4_1_14_to_current(softc, old, current)
   2845 	ipf_main_softc_t *softc;
   2846 	nat_save_4_1_14_t *old;
   2847 	void *current;
   2848 {
   2849 	nat_save_t *nats = (nat_save_t *)current;
   2850 
   2851 	nats->ipn_next = old->ipn_next;
   2852 	nat_4_1_14_to_current(&old->ipn_nat, &nats->ipn_nat);
   2853 	bcopy(&old->ipn_ipnat, &nats->ipn_ipnat, sizeof(old->ipn_ipnat));
   2854 	frentry_4_1_0_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
   2855 	nats->ipn_dsize = old->ipn_dsize;
   2856 	bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
   2857 }
   2858 
   2859 
   2860 static void
   2861 nat_save_4_1_3_to_current(softc, old, current)
   2862 	ipf_main_softc_t *softc;
   2863 	nat_save_4_1_3_t *old;
   2864 	void *current;
   2865 {
   2866 	nat_save_t *nats = (nat_save_t *)current;
   2867 
   2868 	nats->ipn_next = old->ipn_next;
   2869 	nat_4_1_3_to_current(&old->ipn_nat, &nats->ipn_nat);
   2870 	ipnat_4_1_0_to_current(&old->ipn_ipnat, &nats->ipn_ipnat, 0);
   2871 	frentry_4_1_0_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
   2872 	nats->ipn_dsize = old->ipn_dsize;
   2873 	bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
   2874 }
   2875 
   2876 
   2877 static void
   2878 natstat_current_to_4_1_32(current, old)
   2879 	void *current;
   2880 	natstat_4_1_32_t *old;
   2881 {
   2882 	natstat_t *ns = (natstat_t *)current;
   2883 
   2884 	old->ns_mapped[0] = ns->ns_side[0].ns_translated;
   2885 	old->ns_mapped[1] = ns->ns_side[1].ns_translated;
   2886 	old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   2887 	old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
   2888 	old->ns_expire = ns->ns_expire;
   2889 	old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   2890 	old->ns_logged = ns->ns_log_ok;
   2891 	old->ns_logfail = ns->ns_log_fail;
   2892 	old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
   2893 	old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
   2894 	old->ns_addtrpnt = ns->ns_addtrpnt;
   2895 	old->ns_table[0] = ns->ns_side[0].ns_table;
   2896 	old->ns_table[1] = ns->ns_side[1].ns_table;
   2897 	old->ns_maptable = NULL;
   2898 	old->ns_list = ns->ns_list;
   2899 	old->ns_apslist = NULL;
   2900 	old->ns_wilds = ns->ns_wilds;
   2901 	old->ns_nattab_sz = ns->ns_nattab_sz;
   2902 	old->ns_nattab_max = ns->ns_nattab_max;
   2903 	old->ns_rultab_sz = ns->ns_rultab_sz;
   2904 	old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
   2905 	old->ns_trpntab_sz = ns->ns_trpntab_sz;
   2906 	old->ns_hostmap_sz = 0;
   2907 	old->ns_instances = ns->ns_instances;
   2908 	old->ns_maplist = ns->ns_maplist;
   2909 	old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
   2910 	old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
   2911 	old->ns_ticks = ns->ns_ticks;
   2912 	old->ns_orphans = ns->ns_orphans;
   2913 	old->ns_uncreate[0][0] = ns->ns_side[0].ns_uncreate[0];
   2914 	old->ns_uncreate[0][1] = ns->ns_side[0].ns_uncreate[1];
   2915 	old->ns_uncreate[1][0] = ns->ns_side[1].ns_uncreate[0];
   2916 	old->ns_uncreate[1][1] = ns->ns_side[1].ns_uncreate[1];
   2917 }
   2918 
   2919 
   2920 static void
   2921 natstat_current_to_4_1_27(current, old)
   2922 	void *current;
   2923 	natstat_4_1_27_t *old;
   2924 {
   2925 	natstat_t *ns = (natstat_t *)current;
   2926 
   2927 	old->ns_mapped[0] = ns->ns_side[0].ns_translated;
   2928 	old->ns_mapped[1] = ns->ns_side[1].ns_translated;
   2929 	old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   2930 	old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
   2931 	old->ns_expire = ns->ns_expire;
   2932 	old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   2933 	old->ns_logged = ns->ns_log_ok;
   2934 	old->ns_logfail = ns->ns_log_fail;
   2935 	old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
   2936 	old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
   2937 	old->ns_addtrpnt = ns->ns_addtrpnt;
   2938 	old->ns_table[0] = ns->ns_side[0].ns_table;
   2939 	old->ns_table[1] = ns->ns_side[1].ns_table;
   2940 	old->ns_maptable = NULL;
   2941 	old->ns_list = ns->ns_list;
   2942 	old->ns_apslist = NULL;
   2943 	old->ns_wilds = ns->ns_wilds;
   2944 	old->ns_nattab_sz = ns->ns_nattab_sz;
   2945 	old->ns_nattab_max = ns->ns_nattab_max;
   2946 	old->ns_rultab_sz = ns->ns_rultab_sz;
   2947 	old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
   2948 	old->ns_trpntab_sz = ns->ns_trpntab_sz;
   2949 	old->ns_hostmap_sz = 0;
   2950 	old->ns_instances = ns->ns_instances;
   2951 	old->ns_maplist = ns->ns_maplist;
   2952 	old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
   2953 	old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
   2954 	old->ns_ticks = ns->ns_ticks;
   2955 	old->ns_orphans = ns->ns_orphans;
   2956 }
   2957 
   2958 
   2959 static void
   2960 natstat_current_to_4_1_16(current, old)
   2961 	void *current;
   2962 	natstat_4_1_16_t *old;
   2963 {
   2964 	natstat_t *ns = (natstat_t *)current;
   2965 
   2966 	old->ns_mapped[0] = ns->ns_side[0].ns_translated;
   2967 	old->ns_mapped[1] = ns->ns_side[1].ns_translated;
   2968 	old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   2969 	old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
   2970 	old->ns_expire = ns->ns_expire;
   2971 	old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   2972 	old->ns_logged = ns->ns_log_ok;
   2973 	old->ns_logfail = ns->ns_log_fail;
   2974 	old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
   2975 	old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
   2976 	old->ns_addtrpnt = ns->ns_addtrpnt;
   2977 	old->ns_table[0] = ns->ns_side[0].ns_table;
   2978 	old->ns_table[1] = ns->ns_side[1].ns_table;
   2979 	old->ns_maptable = NULL;
   2980 	old->ns_list = ns->ns_list;
   2981 	old->ns_apslist = NULL;
   2982 	old->ns_wilds = ns->ns_wilds;
   2983 	old->ns_nattab_sz = ns->ns_nattab_sz;
   2984 	old->ns_nattab_max = ns->ns_nattab_max;
   2985 	old->ns_rultab_sz = ns->ns_rultab_sz;
   2986 	old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
   2987 	old->ns_trpntab_sz = ns->ns_trpntab_sz;
   2988 	old->ns_hostmap_sz = 0;
   2989 	old->ns_instances = ns->ns_instances;
   2990 	old->ns_maplist = ns->ns_maplist;
   2991 	old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
   2992 	old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
   2993 	old->ns_ticks = ns->ns_ticks;
   2994 }
   2995 
   2996 
   2997 static void
   2998 natstat_current_to_4_1_0(current, old)
   2999 	void *current;
   3000 	natstat_4_1_0_t *old;
   3001 {
   3002 	natstat_t *ns = (natstat_t *)current;
   3003 
   3004 	old->ns_mapped[0] = ns->ns_side[0].ns_translated;
   3005 	old->ns_mapped[1] = ns->ns_side[1].ns_translated;
   3006 	old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   3007 	old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
   3008 	old->ns_expire = ns->ns_expire;
   3009 	old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
   3010 	old->ns_logged = ns->ns_log_ok;
   3011 	old->ns_logfail = ns->ns_log_fail;
   3012 	old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
   3013 	old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
   3014 	old->ns_addtrpnt = ns->ns_addtrpnt;
   3015 	old->ns_table[0] = ns->ns_side[0].ns_table;
   3016 	old->ns_table[1] = ns->ns_side[1].ns_table;
   3017 	old->ns_maptable = NULL;
   3018 	old->ns_list = ns->ns_list;
   3019 	old->ns_apslist = NULL;
   3020 	old->ns_wilds = ns->ns_wilds;
   3021 	old->ns_nattab_sz = ns->ns_nattab_sz;
   3022 	old->ns_nattab_max = ns->ns_nattab_max;
   3023 	old->ns_rultab_sz = ns->ns_rultab_sz;
   3024 	old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
   3025 	old->ns_trpntab_sz = ns->ns_trpntab_sz;
   3026 	old->ns_hostmap_sz = 0;
   3027 	old->ns_instances = ns->ns_instances;
   3028 	old->ns_maplist = ns->ns_maplist;
   3029 	old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
   3030 	old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
   3031 }
   3032 
   3033 
   3034 static void
   3035 ipstate_save_current_to_4_1_16(current, old)
   3036 	void *current;
   3037 	ipstate_save_4_1_16_t *old;
   3038 {
   3039 	ipstate_save_t *ips = (ipstate_save_t *)current;
   3040 
   3041 	old->ips_next = ips->ips_next;
   3042 	ipstate_current_to_4_1_0(&ips->ips_is, &old->ips_is);
   3043 	frentry_current_to_4_1_16(&ips->ips_fr, &old->ips_fr);
   3044 }
   3045 
   3046 
   3047 static void
   3048 ipstate_save_current_to_4_1_0(current, old)
   3049 	void *current;
   3050 	ipstate_save_4_1_0_t *old;
   3051 {
   3052 	ipstate_save_t *ips = (ipstate_save_t *)current;
   3053 
   3054 	old->ips_next = ips->ips_next;
   3055 	ipstate_current_to_4_1_0(&ips->ips_is, &old->ips_is);
   3056 	frentry_current_to_4_1_0(&ips->ips_fr, &old->ips_fr);
   3057 }
   3058 
   3059 
   3060 int
   3061 ipf_out_compat(softc, obj, ptr)
   3062 	ipf_main_softc_t *softc;
   3063 	ipfobj_t *obj;
   3064 	void *ptr;
   3065 {
   3066 	frentry_t *fr;
   3067 	int error;
   3068 
   3069 	IPFERROR(140042);
   3070 	error = EINVAL;
   3071 
   3072 	switch (obj->ipfo_type)
   3073 	{
   3074 	default :
   3075 		break;
   3076 
   3077 	case IPFOBJ_FRENTRY :
   3078 		if (obj->ipfo_rev >= 4013400) {
   3079 			frentry_4_1_34_t *old;
   3080 
   3081 			KMALLOC(old, frentry_4_1_34_t *);
   3082 			if (old == NULL) {
   3083 				IPFERROR(140043);
   3084 				error = ENOMEM;
   3085 				break;
   3086 			}
   3087 			frentry_current_to_4_1_34(ptr, old);
   3088 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3089 			if (error == 0 && old->fr_dsize > 0) {
   3090 				char *dst = obj->ipfo_ptr;
   3091 
   3092 				fr = ptr;
   3093 				dst += sizeof(*old);
   3094 				error = COPYOUT(fr->fr_data, dst,
   3095 						old->fr_dsize);
   3096 				if (error != 0) {
   3097 					IPFERROR(140044);
   3098 				}
   3099 			}
   3100 			KFREE(old);
   3101 			obj->ipfo_size = sizeof(*old);
   3102 		} else if (obj->ipfo_rev >= 4011600) {
   3103 			frentry_4_1_16_t *old;
   3104 
   3105 			KMALLOC(old, frentry_4_1_16_t *);
   3106 			if (old == NULL) {
   3107 				IPFERROR(140045);
   3108 				error = ENOMEM;
   3109 				break;
   3110 			}
   3111 			frentry_current_to_4_1_16(ptr, old);
   3112 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3113 			if (error != 0) {
   3114 				IPFERROR(140046);
   3115 			}
   3116 			KFREE(old);
   3117 			obj->ipfo_size = sizeof(*old);
   3118 		} else {
   3119 			frentry_4_1_0_t *old;
   3120 
   3121 			KMALLOC(old, frentry_4_1_0_t *);
   3122 			if (old == NULL) {
   3123 				IPFERROR(140047);
   3124 				error = ENOMEM;
   3125 				break;
   3126 			}
   3127 			frentry_current_to_4_1_0(ptr, old);
   3128 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3129 			if (error != 0) {
   3130 				IPFERROR(140048);
   3131 			}
   3132 			KFREE(old);
   3133 			obj->ipfo_size = sizeof(*old);
   3134 		}
   3135 		break;
   3136 
   3137 	case IPFOBJ_IPFSTAT :
   3138 		if (obj->ipfo_rev >= 4013300) {
   3139 			friostat_4_1_33_t *old;
   3140 
   3141 			KMALLOC(old, friostat_4_1_33_t *);
   3142 			if (old == NULL) {
   3143 				IPFERROR(140049);
   3144 				error = ENOMEM;
   3145 				break;
   3146 			}
   3147 			friostat_current_to_4_1_33(ptr, old, obj->ipfo_rev);
   3148 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3149 			if (error != 0) {
   3150 				IPFERROR(140050);
   3151 			}
   3152 			KFREE(old);
   3153 		} else {
   3154 			friostat_4_1_0_t *old;
   3155 
   3156 			KMALLOC(old, friostat_4_1_0_t *);
   3157 			if (old == NULL) {
   3158 				IPFERROR(140051);
   3159 				error = ENOMEM;
   3160 				break;
   3161 			}
   3162 			friostat_current_to_4_1_0(ptr, old, obj->ipfo_rev);
   3163 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3164 			if (error != 0) {
   3165 				IPFERROR(140052);
   3166 			}
   3167 			KFREE(old);
   3168 		}
   3169 		break;
   3170 
   3171 	case IPFOBJ_IPFINFO :	/* unused */
   3172 		break;
   3173 
   3174 	case IPFOBJ_IPNAT :
   3175 		if (obj->ipfo_rev >= 4011400) {
   3176 			ipnat_4_1_14_t *old;
   3177 
   3178 			KMALLOC(old, ipnat_4_1_14_t *);
   3179 			if (old == NULL) {
   3180 				IPFERROR(140053);
   3181 				error = ENOMEM;
   3182 				break;
   3183 			}
   3184 			ipnat_current_to_4_1_14(ptr, old);
   3185 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3186 			if (error != 0) {
   3187 				IPFERROR(140054);
   3188 			}
   3189 			KFREE(old);
   3190 		} else {
   3191 			ipnat_4_1_0_t *old;
   3192 
   3193 			KMALLOC(old, ipnat_4_1_0_t *);
   3194 			if (old == NULL) {
   3195 				IPFERROR(140055);
   3196 				error = ENOMEM;
   3197 				break;
   3198 			}
   3199 			ipnat_current_to_4_1_0(ptr, old);
   3200 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3201 			if (error != 0) {
   3202 				IPFERROR(140056);
   3203 			}
   3204 			KFREE(old);
   3205 		}
   3206 		break;
   3207 
   3208 	case IPFOBJ_NATSTAT :
   3209 		if (obj->ipfo_rev >= 4013200) {
   3210 			natstat_4_1_32_t *old;
   3211 
   3212 			KMALLOC(old, natstat_4_1_32_t *);
   3213 			if (old == NULL) {
   3214 				IPFERROR(140057);
   3215 				error = ENOMEM;
   3216 				break;
   3217 			}
   3218 			natstat_current_to_4_1_32(ptr, old);
   3219 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3220 			if (error != 0) {
   3221 				IPFERROR(140058);
   3222 			}
   3223 			KFREE(old);
   3224 		} else if (obj->ipfo_rev >= 4012700) {
   3225 			natstat_4_1_27_t *old;
   3226 
   3227 			KMALLOC(old, natstat_4_1_27_t *);
   3228 			if (old == NULL) {
   3229 				IPFERROR(140059);
   3230 				error = ENOMEM;
   3231 				break;
   3232 			}
   3233 			natstat_current_to_4_1_27(ptr, old);
   3234 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3235 			if (error != 0) {
   3236 				IPFERROR(140060);
   3237 			}
   3238 			KFREE(old);
   3239 		} else if (obj->ipfo_rev >= 4011600) {
   3240 			natstat_4_1_16_t *old;
   3241 
   3242 			KMALLOC(old, natstat_4_1_16_t *);
   3243 			if (old == NULL) {
   3244 				IPFERROR(140061);
   3245 				error = ENOMEM;
   3246 				break;
   3247 			}
   3248 			natstat_current_to_4_1_16(ptr, old);
   3249 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3250 			if (error != 0) {
   3251 				IPFERROR(140062);
   3252 			}
   3253 			KFREE(old);
   3254 		} else {
   3255 			natstat_4_1_0_t *old;
   3256 
   3257 			KMALLOC(old, natstat_4_1_0_t *);
   3258 			if (old == NULL) {
   3259 				IPFERROR(140063);
   3260 				error = ENOMEM;
   3261 				break;
   3262 			}
   3263 			natstat_current_to_4_1_0(ptr, old);
   3264 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3265 			if (error != 0) {
   3266 				IPFERROR(140064);
   3267 			}
   3268 			KFREE(old);
   3269 		}
   3270 		break;
   3271 
   3272 	case IPFOBJ_STATESAVE :
   3273 		if (obj->ipfo_rev >= 4011600) {
   3274 			ipstate_save_4_1_16_t *old;
   3275 
   3276 			KMALLOC(old, ipstate_save_4_1_16_t *);
   3277 			if (old == NULL) {
   3278 				IPFERROR(140065);
   3279 				error = ENOMEM;
   3280 				break;
   3281 			}
   3282 			ipstate_save_current_to_4_1_16(ptr, old);
   3283 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3284 			if (error != 0) {
   3285 				IPFERROR(140066);
   3286 			}
   3287 			KFREE(old);
   3288 		} else {
   3289 			ipstate_save_4_1_0_t *old;
   3290 
   3291 			KMALLOC(old, ipstate_save_4_1_0_t *);
   3292 			if (old == NULL) {
   3293 				IPFERROR(140067);
   3294 				error = ENOMEM;
   3295 				break;
   3296 			}
   3297 			ipstate_save_current_to_4_1_0(ptr, old);
   3298 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3299 			if (error != 0) {
   3300 				IPFERROR(140068);
   3301 			}
   3302 			KFREE(old);
   3303 		}
   3304 		break;
   3305 
   3306 	case IPFOBJ_NATSAVE :
   3307 		if (obj->ipfo_rev >= 4011600) {
   3308 			nat_save_4_1_16_t *old16;
   3309 
   3310 			KMALLOC(old16, nat_save_4_1_16_t *);
   3311 			if (old16 == NULL) {
   3312 				IPFERROR(140069);
   3313 				error = ENOMEM;
   3314 				break;
   3315 			}
   3316 			nat_save_current_to_4_1_16(ptr, old16);
   3317 			error = COPYOUT(&old16, obj->ipfo_ptr, sizeof(*old16));
   3318 			if (error != 0) {
   3319 				IPFERROR(140070);
   3320 			}
   3321 			KFREE(old16);
   3322 		} else if (obj->ipfo_rev >= 4011400) {
   3323 			nat_save_4_1_14_t *old14;
   3324 
   3325 			KMALLOC(old14, nat_save_4_1_14_t *);
   3326 			if (old14 == NULL) {
   3327 				IPFERROR(140071);
   3328 				error = ENOMEM;
   3329 				break;
   3330 			}
   3331 			nat_save_current_to_4_1_14(ptr, old14);
   3332 			error = COPYOUT(&old14, obj->ipfo_ptr, sizeof(*old14));
   3333 			if (error != 0) {
   3334 				IPFERROR(140072);
   3335 			}
   3336 			KFREE(old14);
   3337 		} else if (obj->ipfo_rev >= 4010300) {
   3338 			nat_save_4_1_3_t *old3;
   3339 
   3340 			KMALLOC(old3, nat_save_4_1_3_t *);
   3341 			if (old3 == NULL) {
   3342 				IPFERROR(140073);
   3343 				error = ENOMEM;
   3344 				break;
   3345 			}
   3346 			nat_save_current_to_4_1_3(ptr, old3);
   3347 			error = COPYOUT(&old3, obj->ipfo_ptr, sizeof(*old3));
   3348 			if (error != 0) {
   3349 				IPFERROR(140074);
   3350 			}
   3351 			KFREE(old3);
   3352 		}
   3353 		break;
   3354 
   3355 	case IPFOBJ_IPSTATE :
   3356 		if (obj->ipfo_rev >= 4011600) {
   3357 			ipstate_4_1_16_t *old;
   3358 
   3359 			KMALLOC(old, ipstate_4_1_16_t *);
   3360 			if (old == NULL) {
   3361 				IPFERROR(140075);
   3362 				error = ENOMEM;
   3363 				break;
   3364 			}
   3365 			ipstate_current_to_4_1_16(ptr, old);
   3366 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3367 			if (error != 0) {
   3368 				IPFERROR(140076);
   3369 			}
   3370 			KFREE(old);
   3371 		} else {
   3372 			ipstate_4_1_0_t *old;
   3373 
   3374 			KMALLOC(old, ipstate_4_1_0_t *);
   3375 			if (old == NULL) {
   3376 				IPFERROR(140077);
   3377 				error = ENOMEM;
   3378 				break;
   3379 			}
   3380 			ipstate_current_to_4_1_0(ptr, old);
   3381 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3382 			if (error != 0) {
   3383 				IPFERROR(140078);
   3384 			}
   3385 			KFREE(old);
   3386 		}
   3387 		break;
   3388 
   3389 	case IPFOBJ_STATESTAT :
   3390 		if (obj->ipfo_rev >= 4012100) {
   3391 			ips_stat_4_1_21_t *old;
   3392 
   3393 			KMALLOC(old, ips_stat_4_1_21_t *);
   3394 			if (old == NULL) {
   3395 				IPFERROR(140079);
   3396 				error = ENOMEM;
   3397 				break;
   3398 			}
   3399 			ips_stat_current_to_4_1_21(ptr, old);
   3400 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3401 			if (error != 0) {
   3402 				IPFERROR(140080);
   3403 			}
   3404 			KFREE(old);
   3405 		} else {
   3406 			ips_stat_4_1_0_t *old;
   3407 
   3408 			KMALLOC(old, ips_stat_4_1_0_t *);
   3409 			if (old == NULL) {
   3410 				IPFERROR(140081);
   3411 				error = ENOMEM;
   3412 				break;
   3413 			}
   3414 			ips_stat_current_to_4_1_0(ptr, old);
   3415 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3416 			if (error != 0) {
   3417 				IPFERROR(140082);
   3418 			}
   3419 			KFREE(old);
   3420 		}
   3421 		break;
   3422 
   3423 	case IPFOBJ_FRAUTH :
   3424 		if (obj->ipfo_rev >= 4012900) {
   3425 			frauth_4_1_29_t *old29;
   3426 
   3427 			KMALLOC(old29, frauth_4_1_29_t *);
   3428 			if (old29 == NULL) {
   3429 				IPFERROR(140083);
   3430 				error = ENOMEM;
   3431 				break;
   3432 			}
   3433 			frauth_current_to_4_1_29(ptr, old29);
   3434 			error = COPYOUT(old29, obj->ipfo_ptr, sizeof(*old29));
   3435 			if (error != 0) {
   3436 				IPFERROR(140084);
   3437 			}
   3438 			KFREE(old29);
   3439 		} else if (obj->ipfo_rev >= 4012400) {
   3440 			frauth_4_1_24_t *old24;
   3441 
   3442 			KMALLOC(old24, frauth_4_1_24_t *);
   3443 			if (old24 == NULL) {
   3444 				IPFERROR(140085);
   3445 				error = ENOMEM;
   3446 				break;
   3447 			}
   3448 			frauth_current_to_4_1_24(ptr, old24);
   3449 			error = COPYOUT(old24, obj->ipfo_ptr, sizeof(*old24));
   3450 			if (error != 0) {
   3451 				IPFERROR(140086);
   3452 			}
   3453 			KFREE(old24);
   3454 		} else if (obj->ipfo_rev >= 4012300) {
   3455 			frauth_4_1_23_t *old23;
   3456 
   3457 			KMALLOC(old23, frauth_4_1_23_t *);
   3458 			if (old23 == NULL) {
   3459 				IPFERROR(140087);
   3460 				error = ENOMEM;
   3461 				break;
   3462 			}
   3463 			frauth_current_to_4_1_23(ptr, old23);
   3464 			error = COPYOUT(old23, obj->ipfo_ptr, sizeof(*old23));
   3465 			if (error != 0) {
   3466 				IPFERROR(140088);
   3467 			}
   3468 			KFREE(old23);
   3469 		} else if (obj->ipfo_rev >= 4011100) {
   3470 			frauth_4_1_11_t *old11;
   3471 
   3472 			KMALLOC(old11, frauth_4_1_11_t *);
   3473 			if (old11 == NULL) {
   3474 				IPFERROR(140089);
   3475 				error = ENOMEM;
   3476 				break;
   3477 			}
   3478 			frauth_current_to_4_1_11(ptr, old11);
   3479 			error = COPYOUT(old11, obj->ipfo_ptr, sizeof(*old11));
   3480 			if (error != 0) {
   3481 				IPFERROR(140090);
   3482 			}
   3483 			KFREE(old11);
   3484 		}
   3485 		break;
   3486 
   3487 	case IPFOBJ_NAT :
   3488 		if (obj->ipfo_rev >= 4012500) {
   3489 			nat_4_1_25_t *old;
   3490 
   3491 			KMALLOC(old, nat_4_1_25_t *);
   3492 			if (old == NULL) {
   3493 				IPFERROR(140091);
   3494 				error = ENOMEM;
   3495 				break;
   3496 			}
   3497 			nat_current_to_4_1_25(ptr, old);
   3498 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3499 			if (error != 0) {
   3500 				IPFERROR(140092);
   3501 			}
   3502 			KFREE(old);
   3503 		} else if (obj->ipfo_rev >= 4011400) {
   3504 			nat_4_1_14_t *old;
   3505 
   3506 			KMALLOC(old, nat_4_1_14_t *);
   3507 			if (old == NULL) {
   3508 				IPFERROR(140093);
   3509 				error = ENOMEM;
   3510 				break;
   3511 			}
   3512 			nat_current_to_4_1_14(ptr, old);
   3513 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3514 			if (error != 0) {
   3515 				IPFERROR(140094);
   3516 			}
   3517 			KFREE(old);
   3518 		} else if (obj->ipfo_rev >= 4010300) {
   3519 			nat_4_1_3_t *old;
   3520 
   3521 			KMALLOC(old, nat_4_1_3_t *);
   3522 			if (old == NULL) {
   3523 				IPFERROR(140095);
   3524 				error = ENOMEM;
   3525 				break;
   3526 			}
   3527 			nat_current_to_4_1_3(ptr, old);
   3528 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3529 			if (error != 0) {
   3530 				IPFERROR(140096);
   3531 			}
   3532 			KFREE(old);
   3533 		}
   3534 		break;
   3535 
   3536 	case IPFOBJ_FRIPF :
   3537 		if (obj->ipfo_rev < 5000000) {
   3538 			fripf4_t *old;
   3539 
   3540 			KMALLOC(old, fripf4_t *);
   3541 			if (old == NULL) {
   3542 				IPFERROR(140097);
   3543 				error = ENOMEM;
   3544 				break;
   3545 			}
   3546 			ipf_v5fripftov4(ptr, old);
   3547 			error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
   3548 			if (error != 0) {
   3549 				IPFERROR(140098);
   3550 			}
   3551 			KFREE(old);
   3552 		}
   3553 		break;
   3554 	}
   3555 	return error;
   3556 }
   3557 
   3558 
   3559 static void
   3560 friostat_current_to_4_1_33(current, old, rev)
   3561 	void *current;
   3562 	friostat_4_1_33_t *old;
   3563 	int rev;
   3564 {
   3565 	friostat_t *fiop = (friostat_t *)current;
   3566 
   3567 	bcopy(&fiop->f_st[0].fr_pass, &old->of_st[0], sizeof(old->of_st[0]));
   3568 	bcopy(&fiop->f_st[1].fr_pass, &old->of_st[1], sizeof(old->of_st[1]));
   3569 
   3570 	old->f_ipf[0][0] = fiop->f_ipf[0][0];
   3571 	old->f_ipf[0][1] = fiop->f_ipf[0][1];
   3572 	old->f_ipf[1][0] = fiop->f_ipf[1][0];
   3573 	old->f_ipf[1][1] = fiop->f_ipf[1][1];
   3574 	old->f_acct[0][0] = fiop->f_acct[0][0];
   3575 	old->f_acct[0][1] = fiop->f_acct[0][1];
   3576 	old->f_acct[1][0] = fiop->f_acct[1][0];
   3577 	old->f_acct[1][1] = fiop->f_acct[1][1];
   3578 	old->f_ipf6[0][0] = NULL;
   3579 	old->f_ipf6[0][1] = NULL;
   3580 	old->f_ipf6[1][0] = NULL;
   3581 	old->f_ipf6[1][1] = NULL;
   3582 	old->f_acct6[0][0] = NULL;
   3583 	old->f_acct6[0][1] = NULL;
   3584 	old->f_acct6[1][0] = NULL;
   3585 	old->f_acct6[1][1] = NULL;
   3586 	old->f_auth = fiop->f_auth;
   3587 	bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
   3588 	bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
   3589 	old->f_ticks = fiop->f_ticks;
   3590 	bcopy(&fiop->f_locks, &old->f_locks, sizeof(old->f_locks));
   3591 	old->f_kmutex_sz = 0;
   3592 	old->f_krwlock_sz = 0;
   3593 	old->f_defpass = fiop->f_defpass;
   3594 	old->f_active = fiop->f_active;
   3595 	old->f_running = fiop->f_running;
   3596 	old->f_logging = fiop->f_logging;
   3597 	old->f_features = fiop->f_features;
   3598 	sprintf(old->f_version, "IP Filter: v%d.%d.%d",
   3599 		(rev / 1000000) % 100,
   3600 		(rev / 10000) % 100,
   3601 		(rev / 100) % 100);
   3602 }
   3603 
   3604 
   3605 static void
   3606 friostat_current_to_4_1_0(current, old, rev)
   3607 	void *current;
   3608 	friostat_4_1_0_t *old;
   3609 	int rev;
   3610 {
   3611 	friostat_t *fiop = (friostat_t *)current;
   3612 
   3613 	bcopy(&fiop->f_st[0].fr_pass, &old->of_st[0], sizeof(old->of_st[0]));
   3614 	bcopy(&fiop->f_st[1].fr_pass, &old->of_st[1], sizeof(old->of_st[1]));
   3615 
   3616 	old->f_ipf[0][0] = fiop->f_ipf[0][0];
   3617 	old->f_ipf[0][1] = fiop->f_ipf[0][1];
   3618 	old->f_ipf[1][0] = fiop->f_ipf[1][0];
   3619 	old->f_ipf[1][1] = fiop->f_ipf[1][1];
   3620 	old->f_acct[0][0] = fiop->f_acct[0][0];
   3621 	old->f_acct[0][1] = fiop->f_acct[0][1];
   3622 	old->f_acct[1][0] = fiop->f_acct[1][0];
   3623 	old->f_acct[1][1] = fiop->f_acct[1][1];
   3624 	old->f_ipf6[0][0] = NULL;
   3625 	old->f_ipf6[0][1] = NULL;
   3626 	old->f_ipf6[1][0] = NULL;
   3627 	old->f_ipf6[1][1] = NULL;
   3628 	old->f_acct6[0][0] = NULL;
   3629 	old->f_acct6[0][1] = NULL;
   3630 	old->f_acct6[1][0] = NULL;
   3631 	old->f_acct6[1][1] = NULL;
   3632 	old->f_auth = fiop->f_auth;
   3633 	bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
   3634 	bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
   3635 	old->f_ticks = fiop->f_ticks;
   3636 	old->f_ipf[0][0] = fiop->f_ipf[0][0];
   3637 	old->f_ipf[0][1] = fiop->f_ipf[0][1];
   3638 	old->f_ipf[1][0] = fiop->f_ipf[1][0];
   3639 	old->f_ipf[1][1] = fiop->f_ipf[1][1];
   3640 	old->f_acct[0][0] = fiop->f_acct[0][0];
   3641 	old->f_acct[0][1] = fiop->f_acct[0][1];
   3642 	old->f_acct[1][0] = fiop->f_acct[1][0];
   3643 	old->f_acct[1][1] = fiop->f_acct[1][1];
   3644 	old->f_ipf6[0][0] = NULL;
   3645 	old->f_ipf6[0][1] = NULL;
   3646 	old->f_ipf6[1][0] = NULL;
   3647 	old->f_ipf6[1][1] = NULL;
   3648 	old->f_acct6[0][0] = NULL;
   3649 	old->f_acct6[0][1] = NULL;
   3650 	old->f_acct6[1][0] = NULL;
   3651 	old->f_acct6[1][1] = NULL;
   3652 	old->f_auth = fiop->f_auth;
   3653 	bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
   3654 	bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
   3655 	old->f_ticks = fiop->f_ticks;
   3656 	bcopy(&fiop->f_locks, &old->f_locks, sizeof(old->f_locks));
   3657 	old->f_kmutex_sz = 0;
   3658 	old->f_krwlock_sz = 0;
   3659 	old->f_defpass = fiop->f_defpass;
   3660 	old->f_active = fiop->f_active;
   3661 	old->f_running = fiop->f_running;
   3662 	old->f_logging = fiop->f_logging;
   3663 	old->f_features = fiop->f_features;
   3664 	sprintf(old->f_version, "IP Filter: v%d.%d.%d",
   3665 		(rev / 1000000) % 100,
   3666 		(rev / 10000) % 100,
   3667 		(rev / 100) % 100);
   3668 }
   3669 
   3670 
   3671 /*
   3672  * nflags is v5 flags, returns v4 flags.
   3673  */
   3674 static int
   3675 fr_frflags5to4(nflags)
   3676 	u_32_t nflags;
   3677 {
   3678 	u_32_t oflags = 0;
   3679 
   3680 	switch (nflags & FR_CMDMASK) {
   3681 	case FR_CALL :
   3682 		oflags = 0x0;
   3683 		break;
   3684 	case FR_BLOCK :
   3685 		oflags = 0x1;
   3686 		break;
   3687 	case FR_PASS :
   3688 		oflags = 0x2;
   3689 		break;
   3690 	case FR_AUTH :
   3691 		oflags = 0x3;
   3692 		break;
   3693 	case FR_PREAUTH :
   3694 		oflags = 0x4;
   3695 		break;
   3696 	case FR_ACCOUNT :
   3697 		oflags = 0x5;
   3698 		break;
   3699 	case FR_SKIP :
   3700 		oflags = 0x6;
   3701 		break;
   3702 	default :
   3703 		break;
   3704 	}
   3705 
   3706 	if (nflags & FR_LOG)
   3707 		oflags |= 0x00010;
   3708 	if (nflags & FR_CALLNOW)
   3709 		oflags |= 0x00020;
   3710 	if (nflags & FR_NOTSRCIP)
   3711 		oflags |= 0x00080;
   3712 	if (nflags & FR_NOTDSTIP)
   3713 		oflags |= 0x00040;
   3714 	if (nflags & FR_QUICK)
   3715 		oflags |= 0x00100;
   3716 	if (nflags & FR_KEEPFRAG)
   3717 		oflags |= 0x00200;
   3718 	if (nflags & FR_KEEPSTATE)
   3719 		oflags |= 0x00400;
   3720 	if (nflags & FR_FASTROUTE)
   3721 		oflags |= 0x00800;
   3722 	if (nflags & FR_RETRST)
   3723 		oflags |= 0x01000;
   3724 	if (nflags & FR_RETICMP)
   3725 		oflags |= 0x02000;
   3726 	if (nflags & FR_FAKEICMP)
   3727 		oflags |= 0x03000;
   3728 	if (nflags & FR_OUTQUE)
   3729 		oflags |= 0x04000;
   3730 	if (nflags & FR_INQUE)
   3731 		oflags |= 0x08000;
   3732 	if (nflags & FR_LOGBODY)
   3733 		oflags |= 0x10000;
   3734 	if (nflags & FR_LOGFIRST)
   3735 		oflags |= 0x20000;
   3736 	if (nflags & FR_LOGORBLOCK)
   3737 		oflags |= 0x40000;
   3738 	if (nflags & FR_FRSTRICT)
   3739 		oflags |= 0x100000;
   3740 	if (nflags & FR_STSTRICT)
   3741 		oflags |= 0x200000;
   3742 	if (nflags & FR_NEWISN)
   3743 		oflags |= 0x400000;
   3744 	if (nflags & FR_NOICMPERR)
   3745 		oflags |= 0x800000;
   3746 	if (nflags & FR_STATESYNC)
   3747 		oflags |= 0x1000000;
   3748 	if (nflags & FR_NOMATCH)
   3749 		oflags |= 0x8000000;
   3750 	if (nflags & FR_COPIED)
   3751 		oflags |= 0x40000000;
   3752 	if (nflags & FR_INACTIVE)
   3753 		oflags |= 0x80000000;
   3754 
   3755 	return oflags;
   3756 }
   3757 
   3758 
   3759 static void
   3760 frentry_current_to_4_1_34(current, old)
   3761 	void *current;
   3762 	frentry_4_1_34_t *old;
   3763 {
   3764 	frentry_t *fr = (frentry_t *)current;
   3765 
   3766 	old->fr_lock = fr->fr_lock;
   3767 	old->fr_next = fr->fr_next;
   3768 	old->fr_grp = fr->fr_grp;
   3769 	old->fr_isc = fr->fr_isc;
   3770 	old->fr_ifas[0] = fr->fr_ifas[0];
   3771 	old->fr_ifas[1] = fr->fr_ifas[1];
   3772 	old->fr_ifas[2] = fr->fr_ifas[2];
   3773 	old->fr_ifas[3] = fr->fr_ifas[3];
   3774 	old->fr_ptr = fr->fr_ptr;
   3775 	old->fr_comment = NULL;
   3776 	old->fr_ref = fr->fr_ref;
   3777 	old->fr_statecnt = fr->fr_statecnt;
   3778 	old->fr_hits = fr->fr_hits;
   3779 	old->fr_bytes = fr->fr_bytes;
   3780 	old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
   3781 	old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
   3782 	old->fr_curpps = fr->fr_curpps;
   3783 	old->fr_dun.fru_data = fr->fr_dun.fru_data;
   3784 	old->fr_func = fr->fr_func;
   3785 	old->fr_dsize = fr->fr_dsize;
   3786 	old->fr_pps = fr->fr_pps;
   3787 	old->fr_statemax = fr->fr_statemax;
   3788 	old->fr_flineno = fr->fr_flineno;
   3789 	old->fr_type = fr->fr_type;
   3790 	old->fr_flags = fr_frflags5to4(fr->fr_flags);
   3791 	old->fr_logtag = fr->fr_logtag;
   3792 	old->fr_collect = fr->fr_collect;
   3793 	old->fr_arg = fr->fr_arg;
   3794 	old->fr_loglevel = fr->fr_loglevel;
   3795 	old->fr_age[0] = fr->fr_age[0];
   3796 	old->fr_age[1] = fr->fr_age[1];
   3797 	if (fr->fr_family == AF_INET)
   3798 		old->fr_v = 4;
   3799 	if (fr->fr_family == AF_INET6)
   3800 		old->fr_v = 6;
   3801 	old->fr_icode = fr->fr_icode;
   3802 	old->fr_cksum = fr->fr_cksum;
   3803 	old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
   3804 	old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
   3805 	old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
   3806 	if (fr->fr_ifnames[0] >= 0) {
   3807 		strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
   3808 			LIFNAMSIZ);
   3809 		old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
   3810 	}
   3811 	if (fr->fr_ifnames[1] >= 0) {
   3812 		strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
   3813 			LIFNAMSIZ);
   3814 		old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
   3815 	}
   3816 	if (fr->fr_ifnames[2] >= 0) {
   3817 		strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
   3818 			LIFNAMSIZ);
   3819 		old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
   3820 	}
   3821 	if (fr->fr_ifnames[3] >= 0) {
   3822 		strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
   3823 			LIFNAMSIZ);
   3824 		old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
   3825 	}
   3826 	if (fr->fr_tifs[0].fd_name >= 0) {
   3827 		strncpy(old->fr_tifs[0].fd_ifname,
   3828 			fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
   3829 		old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
   3830 	}
   3831 	if (fr->fr_tifs[1].fd_name >= 0) {
   3832 		strncpy(old->fr_tifs[1].fd_ifname,
   3833 			fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
   3834 		old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
   3835 	}
   3836 	if (fr->fr_dif.fd_name >= 0) {
   3837 		strncpy(old->fr_dif.fd_ifname,
   3838 			fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
   3839 		old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
   3840 	}
   3841 	if (fr->fr_group >= 0) {
   3842 		strncpy(old->fr_group, fr->fr_names + fr->fr_group,
   3843 			FR_GROUPLEN);
   3844 		old->fr_group[FR_GROUPLEN - 1] = '\0';
   3845 	}
   3846 	if (fr->fr_grhead >= 0) {
   3847 		strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
   3848 			FR_GROUPLEN);
   3849 		old->fr_grhead[FR_GROUPLEN - 1] = '\0';
   3850 	}
   3851 }
   3852 
   3853 
   3854 static void
   3855 frentry_current_to_4_1_16(current, old)
   3856 	void *current;
   3857 	frentry_4_1_16_t *old;
   3858 {
   3859 	frentry_t *fr = (frentry_t *)current;
   3860 
   3861 	old->fr_lock = fr->fr_lock;
   3862 	old->fr_next = fr->fr_next;
   3863 	old->fr_grp = fr->fr_grp;
   3864 	old->fr_isc = fr->fr_isc;
   3865 	old->fr_ifas[0] = fr->fr_ifas[0];
   3866 	old->fr_ifas[1] = fr->fr_ifas[1];
   3867 	old->fr_ifas[2] = fr->fr_ifas[2];
   3868 	old->fr_ifas[3] = fr->fr_ifas[3];
   3869 	old->fr_ptr = fr->fr_ptr;
   3870 	old->fr_comment = NULL;
   3871 	old->fr_ref = fr->fr_ref;
   3872 	old->fr_statecnt = fr->fr_statecnt;
   3873 	old->fr_hits = fr->fr_hits;
   3874 	old->fr_bytes = fr->fr_bytes;
   3875 	old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
   3876 	old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
   3877 	old->fr_curpps = fr->fr_curpps;
   3878 	old->fr_dun.fru_data = fr->fr_dun.fru_data;
   3879 	old->fr_func = fr->fr_func;
   3880 	old->fr_dsize = fr->fr_dsize;
   3881 	old->fr_pps = fr->fr_pps;
   3882 	old->fr_statemax = fr->fr_statemax;
   3883 	old->fr_flineno = fr->fr_flineno;
   3884 	old->fr_type = fr->fr_type;
   3885 	old->fr_flags = fr_frflags5to4(fr->fr_flags);
   3886 	old->fr_logtag = fr->fr_logtag;
   3887 	old->fr_collect = fr->fr_collect;
   3888 	old->fr_arg = fr->fr_arg;
   3889 	old->fr_loglevel = fr->fr_loglevel;
   3890 	old->fr_age[0] = fr->fr_age[0];
   3891 	old->fr_age[1] = fr->fr_age[1];
   3892 	if (old->fr_v == 4)
   3893 		fr->fr_family = AF_INET;
   3894 	if (old->fr_v == 6)
   3895 		fr->fr_family = AF_INET6;
   3896 	old->fr_icode = fr->fr_icode;
   3897 	old->fr_cksum = fr->fr_cksum;
   3898 	old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
   3899 	old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
   3900 	old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
   3901 	if (fr->fr_ifnames[0] >= 0) {
   3902 		strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
   3903 			LIFNAMSIZ);
   3904 		old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
   3905 	}
   3906 	if (fr->fr_ifnames[1] >= 0) {
   3907 		strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
   3908 			LIFNAMSIZ);
   3909 		old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
   3910 	}
   3911 	if (fr->fr_ifnames[2] >= 0) {
   3912 		strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
   3913 			LIFNAMSIZ);
   3914 		old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
   3915 	}
   3916 	if (fr->fr_ifnames[3] >= 0) {
   3917 		strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
   3918 			LIFNAMSIZ);
   3919 		old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
   3920 	}
   3921 	if (fr->fr_tifs[0].fd_name >= 0) {
   3922 		strncpy(old->fr_tifs[0].fd_ifname,
   3923 			fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
   3924 		old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
   3925 	}
   3926 	if (fr->fr_tifs[1].fd_name >= 0) {
   3927 		strncpy(old->fr_tifs[1].fd_ifname,
   3928 			fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
   3929 		old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
   3930 	}
   3931 	if (fr->fr_dif.fd_name >= 0) {
   3932 		strncpy(old->fr_dif.fd_ifname,
   3933 			fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
   3934 		old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
   3935 	}
   3936 	if (fr->fr_group >= 0) {
   3937 		strncpy(old->fr_group, fr->fr_names + fr->fr_group,
   3938 			FR_GROUPLEN);
   3939 		old->fr_group[FR_GROUPLEN - 1] = '\0';
   3940 	}
   3941 	if (fr->fr_grhead >= 0) {
   3942 		strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
   3943 			FR_GROUPLEN);
   3944 		old->fr_grhead[FR_GROUPLEN - 1] = '\0';
   3945 	}
   3946 }
   3947 
   3948 
   3949 static void
   3950 frentry_current_to_4_1_0(current, old)
   3951 	void *current;
   3952 	frentry_4_1_0_t *old;
   3953 {
   3954 	frentry_t *fr = (frentry_t *)current;
   3955 
   3956 	old->fr_lock = fr->fr_lock;
   3957 	old->fr_next = fr->fr_next;
   3958 	old->fr_grp = fr->fr_grp;
   3959 	old->fr_isc = fr->fr_isc;
   3960 	old->fr_ifas[0] = fr->fr_ifas[0];
   3961 	old->fr_ifas[1] = fr->fr_ifas[1];
   3962 	old->fr_ifas[2] = fr->fr_ifas[2];
   3963 	old->fr_ifas[3] = fr->fr_ifas[3];
   3964 	old->fr_ptr = fr->fr_ptr;
   3965 	old->fr_comment = NULL;
   3966 	old->fr_ref = fr->fr_ref;
   3967 	old->fr_statecnt = fr->fr_statecnt;
   3968 	old->fr_hits = fr->fr_hits;
   3969 	old->fr_bytes = fr->fr_bytes;
   3970 	old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
   3971 	old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
   3972 	old->fr_curpps = fr->fr_curpps;
   3973 	old->fr_dun.fru_data = fr->fr_dun.fru_data;
   3974 	old->fr_func = fr->fr_func;
   3975 	old->fr_dsize = fr->fr_dsize;
   3976 	old->fr_pps = fr->fr_pps;
   3977 	old->fr_statemax = fr->fr_statemax;
   3978 	old->fr_flineno = fr->fr_flineno;
   3979 	old->fr_type = fr->fr_type;
   3980 	old->fr_flags = fr_frflags5to4(fr->fr_flags);
   3981 	old->fr_logtag = fr->fr_logtag;
   3982 	old->fr_collect = fr->fr_collect;
   3983 	old->fr_arg = fr->fr_arg;
   3984 	old->fr_loglevel = fr->fr_loglevel;
   3985 	old->fr_age[0] = fr->fr_age[0];
   3986 	old->fr_age[1] = fr->fr_age[1];
   3987 	if (old->fr_v == 4)
   3988 		fr->fr_family = AF_INET;
   3989 	if (old->fr_v == 6)
   3990 		fr->fr_family = AF_INET6;
   3991 	old->fr_icode = fr->fr_icode;
   3992 	old->fr_cksum = fr->fr_cksum;
   3993 	old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
   3994 	old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
   3995 	old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
   3996 	if (fr->fr_ifnames[0] >= 0) {
   3997 		strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
   3998 			LIFNAMSIZ);
   3999 		old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
   4000 	}
   4001 	if (fr->fr_ifnames[1] >= 0) {
   4002 		strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
   4003 			LIFNAMSIZ);
   4004 		old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
   4005 	}
   4006 	if (fr->fr_ifnames[2] >= 0) {
   4007 		strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
   4008 			LIFNAMSIZ);
   4009 		old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
   4010 	}
   4011 	if (fr->fr_ifnames[3] >= 0) {
   4012 		strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
   4013 			LIFNAMSIZ);
   4014 		old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
   4015 	}
   4016 	if (fr->fr_tifs[0].fd_name >= 0) {
   4017 		strncpy(old->fr_tifs[0].fd_ifname,
   4018 			fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
   4019 		old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
   4020 	}
   4021 	if (fr->fr_tifs[1].fd_name >= 0) {
   4022 		strncpy(old->fr_tifs[1].fd_ifname,
   4023 			fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
   4024 		old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
   4025 	}
   4026 	if (fr->fr_dif.fd_name >= 0) {
   4027 		strncpy(old->fr_dif.fd_ifname,
   4028 			fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
   4029 		old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
   4030 	}
   4031 	if (fr->fr_group >= 0) {
   4032 		strncpy(old->fr_group, fr->fr_names + fr->fr_group,
   4033 			FR_GROUPLEN);
   4034 		old->fr_group[FR_GROUPLEN - 1] = '\0';
   4035 	}
   4036 	if (fr->fr_grhead >= 0) {
   4037 		strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
   4038 			FR_GROUPLEN);
   4039 		old->fr_grhead[FR_GROUPLEN - 1] = '\0';
   4040 	}
   4041 }
   4042 
   4043 
   4044 static void
   4045 fr_info_current_to_4_1_24(current, old)
   4046 	void *current;
   4047 	fr_info_4_1_24_t *old;
   4048 {
   4049 	fr_info_t *fin = (fr_info_t *)current;
   4050 
   4051 	old->fin_ifp = fin->fin_ifp;
   4052 	ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
   4053 	bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
   4054 	old->fin_out = fin->fin_out;
   4055 	old->fin_rev = fin->fin_rev;
   4056 	old->fin_hlen = fin->fin_hlen;
   4057 	old->ofin_tcpf = fin->fin_tcpf;
   4058 	old->fin_icode = fin->fin_icode;
   4059 	old->fin_rule = fin->fin_rule;
   4060 	bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
   4061 	old->fin_fr = fin->fin_fr;
   4062 	old->fin_dp = fin->fin_dp;
   4063 	old->fin_dlen = fin->fin_dlen;
   4064 	old->fin_plen = fin->fin_plen;
   4065 	old->fin_ipoff = fin->fin_ipoff;
   4066 	old->fin_id = fin->fin_id;
   4067 	old->fin_off = fin->fin_off;
   4068 	old->fin_depth = fin->fin_depth;
   4069 	old->fin_error = fin->fin_error;
   4070 	old->fin_cksum = fin->fin_cksum;
   4071 	old->fin_state = NULL;
   4072 	old->fin_nat = NULL;
   4073 	old->fin_nattag = fin->fin_nattag;
   4074 	old->fin_exthdr = NULL;
   4075 	old->ofin_ip = fin->fin_ip;
   4076 	old->fin_mp = fin->fin_mp;
   4077 	old->fin_m = fin->fin_m;
   4078 #ifdef  MENTAT
   4079 	old->fin_qfm = fin->fin_qfm;
   4080 	old->fin_qpi = fin->fin_qpi;
   4081 	old->fin_ifname[0] = '\0';
   4082 #endif
   4083 #ifdef  __sgi
   4084 	old->fin_hbuf = fin->fin_hbuf;
   4085 #endif
   4086 }
   4087 
   4088 
   4089 static void
   4090 fr_info_current_to_4_1_23(current, old)
   4091 	void *current;
   4092 	fr_info_4_1_23_t *old;
   4093 {
   4094 	fr_info_t *fin = (fr_info_t *)current;
   4095 
   4096 	old->fin_ifp = fin->fin_ifp;
   4097 	ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
   4098 	bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
   4099 	old->fin_out = fin->fin_out;
   4100 	old->fin_rev = fin->fin_rev;
   4101 	old->fin_hlen = fin->fin_hlen;
   4102 	old->ofin_tcpf = fin->fin_tcpf;
   4103 	old->fin_icode = fin->fin_icode;
   4104 	old->fin_rule = fin->fin_rule;
   4105 	bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
   4106 	old->fin_fr = fin->fin_fr;
   4107 	old->fin_dp = fin->fin_dp;
   4108 	old->fin_dlen = fin->fin_dlen;
   4109 	old->fin_plen = fin->fin_plen;
   4110 	old->fin_ipoff = fin->fin_ipoff;
   4111 	old->fin_id = fin->fin_id;
   4112 	old->fin_off = fin->fin_off;
   4113 	old->fin_depth = fin->fin_depth;
   4114 	old->fin_error = fin->fin_error;
   4115 	old->fin_state = NULL;
   4116 	old->fin_nat = NULL;
   4117 	old->fin_nattag = fin->fin_nattag;
   4118 	old->ofin_ip = fin->fin_ip;
   4119 	old->fin_mp = fin->fin_mp;
   4120 	old->fin_m = fin->fin_m;
   4121 #ifdef  MENTAT
   4122 	old->fin_qfm = fin->fin_qfm;
   4123 	old->fin_qpi = fin->fin_qpi;
   4124 	old->fin_ifname[0] = '\0';
   4125 #endif
   4126 #ifdef  __sgi
   4127 	old->fin_hbuf = fin->fin_hbuf;
   4128 #endif
   4129 }
   4130 
   4131 
   4132 static void
   4133 fr_info_current_to_4_1_11(current, old)
   4134 	void *current;
   4135 	fr_info_4_1_11_t *old;
   4136 {
   4137 	fr_info_t *fin = (fr_info_t *)current;
   4138 
   4139 	old->fin_ifp = fin->fin_ifp;
   4140 	ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
   4141 	bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
   4142 	old->fin_out = fin->fin_out;
   4143 	old->fin_rev = fin->fin_rev;
   4144 	old->fin_hlen = fin->fin_hlen;
   4145 	old->ofin_tcpf = fin->fin_tcpf;
   4146 	old->fin_icode = fin->fin_icode;
   4147 	old->fin_rule = fin->fin_rule;
   4148 	bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
   4149 	old->fin_fr = fin->fin_fr;
   4150 	old->fin_dp = fin->fin_dp;
   4151 	old->fin_dlen = fin->fin_dlen;
   4152 	old->fin_plen = fin->fin_plen;
   4153 	old->fin_ipoff = fin->fin_ipoff;
   4154 	old->fin_id = fin->fin_id;
   4155 	old->fin_off = fin->fin_off;
   4156 	old->fin_depth = fin->fin_depth;
   4157 	old->fin_error = fin->fin_error;
   4158 	old->fin_state = NULL;
   4159 	old->fin_nat = NULL;
   4160 	old->fin_nattag = fin->fin_nattag;
   4161 	old->ofin_ip = fin->fin_ip;
   4162 	old->fin_mp = fin->fin_mp;
   4163 	old->fin_m = fin->fin_m;
   4164 #ifdef  MENTAT
   4165 	old->fin_qfm = fin->fin_qfm;
   4166 	old->fin_qpi = fin->fin_qpi;
   4167 	old->fin_ifname[0] = '\0';
   4168 #endif
   4169 #ifdef  __sgi
   4170 	old->fin_hbuf = fin->fin_hbuf;
   4171 #endif
   4172 }
   4173 
   4174 
   4175 static void
   4176 frauth_current_to_4_1_29(current, old)
   4177 	void *current;
   4178 	frauth_4_1_29_t *old;
   4179 {
   4180 	frauth_t *fra = (frauth_t *)current;
   4181 
   4182 	old->fra_age = fra->fra_age;
   4183 	old->fra_len = fra->fra_len;
   4184 	old->fra_index = fra->fra_index;
   4185 	old->fra_pass = fra->fra_pass;
   4186 	fr_info_current_to_4_1_24(&fra->fra_info, &old->fra_info);
   4187 	old->fra_buf = fra->fra_buf;
   4188 	old->fra_flx = fra->fra_flx;
   4189 #ifdef	MENTAT
   4190 	old->fra_q = fra->fra_q;
   4191 	old->fra_m = fra->fra_m;
   4192 #endif
   4193 }
   4194 
   4195 
   4196 static void
   4197 frauth_current_to_4_1_24(current, old)
   4198 	void *current;
   4199 	frauth_4_1_24_t *old;
   4200 {
   4201 	frauth_t *fra = (frauth_t *)current;
   4202 
   4203 	old->fra_age = fra->fra_age;
   4204 	old->fra_len = fra->fra_len;
   4205 	old->fra_index = fra->fra_index;
   4206 	old->fra_pass = fra->fra_pass;
   4207 	fr_info_current_to_4_1_24(&fra->fra_info, &old->fra_info);
   4208 	old->fra_buf = fra->fra_buf;
   4209 #ifdef	MENTAT
   4210 	old->fra_q = fra->fra_q;
   4211 	old->fra_m = fra->fra_m;
   4212 #endif
   4213 }
   4214 
   4215 
   4216 static void
   4217 frauth_current_to_4_1_23(current, old)
   4218 	void *current;
   4219 	frauth_4_1_23_t *old;
   4220 {
   4221 	frauth_t *fra = (frauth_t *)current;
   4222 
   4223 	old->fra_age = fra->fra_age;
   4224 	old->fra_len = fra->fra_len;
   4225 	old->fra_index = fra->fra_index;
   4226 	old->fra_pass = fra->fra_pass;
   4227 	fr_info_current_to_4_1_23(&fra->fra_info, &old->fra_info);
   4228 	old->fra_buf = fra->fra_buf;
   4229 #ifdef	MENTAT
   4230 	old->fra_q = fra->fra_q;
   4231 	old->fra_m = fra->fra_m;
   4232 #endif
   4233 }
   4234 
   4235 
   4236 static void
   4237 frauth_current_to_4_1_11(current, old)
   4238 	void *current;
   4239 	frauth_4_1_11_t *old;
   4240 {
   4241 	frauth_t *fra = (frauth_t *)current;
   4242 
   4243 	old->fra_age = fra->fra_age;
   4244 	old->fra_len = fra->fra_len;
   4245 	old->fra_index = fra->fra_index;
   4246 	old->fra_pass = fra->fra_pass;
   4247 	fr_info_current_to_4_1_11(&fra->fra_info, &old->fra_info);
   4248 	old->fra_buf = fra->fra_buf;
   4249 #ifdef	MENTAT
   4250 	old->fra_q = fra->fra_q;
   4251 	old->fra_m = fra->fra_m;
   4252 #endif
   4253 }
   4254 
   4255 
   4256 static void
   4257 ipnat_current_to_4_1_14(current, old)
   4258 	void *current;
   4259 	ipnat_4_1_14_t *old;
   4260 {
   4261 	ipnat_t *np = (ipnat_t *)current;
   4262 
   4263 	old->in_next = np->in_next;
   4264 	old->in_rnext = np->in_rnext;
   4265 	old->in_prnext = np->in_prnext;
   4266 	old->in_mnext = np->in_mnext;
   4267 	old->in_pmnext = np->in_pmnext;
   4268 	old->in_tqehead[0] = np->in_tqehead[0];
   4269 	old->in_tqehead[1] = np->in_tqehead[1];
   4270 	old->in_ifps[0] = np->in_ifps[0];
   4271 	old->in_ifps[1] = np->in_ifps[1];
   4272 	old->in_apr = np->in_apr;
   4273 	old->in_comment = np->in_comment;
   4274 	old->in_space = np->in_space;
   4275 	old->in_hits = np->in_hits;
   4276 	old->in_use = np->in_use;
   4277 	old->in_hv = np->in_hv[0];
   4278 	old->in_flineno = np->in_flineno;
   4279 	if (old->in_redir == NAT_REDIRECT)
   4280 		old->in_pnext = np->in_dpnext;
   4281 	else
   4282 		old->in_pnext = np->in_spnext;
   4283 	old->in_v = np->in_v[0];
   4284 	old->in_flags = np->in_flags;
   4285 	old->in_mssclamp = np->in_mssclamp;
   4286 	old->in_age[0] = np->in_age[0];
   4287 	old->in_age[1] = np->in_age[1];
   4288 	old->in_redir = np->in_redir;
   4289 	old->in_p = np->in_pr[0];
   4290 	if (np->in_redir == NAT_REDIRECT) {
   4291 		old->in_next6 = np->in_ndst.na_nextaddr;
   4292 		old->in_in[0] = np->in_ndst.na_addr[0];
   4293 		old->in_in[1] = np->in_ndst.na_addr[1];
   4294 		old->in_out[0] = np->in_odst.na_addr[0];
   4295 		old->in_out[1] = np->in_odst.na_addr[1];
   4296 		old->in_src[0] = np->in_osrc.na_addr[0];
   4297 		old->in_src[1] = np->in_osrc.na_addr[1];
   4298 	} else {
   4299 		old->in_next6 = np->in_nsrc.na_nextaddr;
   4300 		old->in_out[0] = np->in_nsrc.na_addr[0];
   4301 		old->in_out[1] = np->in_nsrc.na_addr[1];
   4302 		old->in_in[0] = np->in_osrc.na_addr[0];
   4303 		old->in_in[1] = np->in_osrc.na_addr[1];
   4304 		old->in_src[0] = np->in_odst.na_addr[0];
   4305 		old->in_src[1] = np->in_odst.na_addr[1];
   4306 	}
   4307 	ipfv5tuctov4(&np->in_tuc, &old->in_tuc);
   4308 	if (np->in_redir == NAT_REDIRECT) {
   4309 		old->in_port[0] = np->in_dpmin;
   4310 		old->in_port[1] = np->in_dpmax;
   4311 	} else {
   4312 		old->in_port[0] = np->in_spmin;
   4313 		old->in_port[1] = np->in_spmax;
   4314 	}
   4315 	old->in_ppip = np->in_ppip;
   4316 	old->in_ippip = np->in_ippip;
   4317 	bcopy(&np->in_tag, &old->in_tag, sizeof(np->in_tag));
   4318 
   4319 	if (np->in_ifnames[0] >= 0) {
   4320 		strncpy(old->in_ifnames[0], np->in_names + np->in_ifnames[0],
   4321 			LIFNAMSIZ);
   4322 		old->in_ifnames[0][LIFNAMSIZ - 1] = '\0';
   4323 	}
   4324 	if (np->in_ifnames[1] >= 0) {
   4325 		strncpy(old->in_ifnames[1], np->in_names + np->in_ifnames[1],
   4326 			LIFNAMSIZ);
   4327 		old->in_ifnames[1][LIFNAMSIZ - 1] = '\0';
   4328 	}
   4329 	if (np->in_plabel >= 0) {
   4330 		strncpy(old->in_plabel, np->in_names + np->in_plabel,
   4331 			APR_LABELLEN);
   4332 		old->in_plabel[APR_LABELLEN - 1] = '\0';
   4333 	}
   4334 }
   4335 
   4336 
   4337 static void
   4338 ipnat_current_to_4_1_0(current, old)
   4339 	void *current;
   4340 	ipnat_4_1_0_t *old;
   4341 {
   4342 	ipnat_t *np = (ipnat_t *)current;
   4343 
   4344 	old->in_next = np->in_next;
   4345 	old->in_rnext = np->in_rnext;
   4346 	old->in_prnext = np->in_prnext;
   4347 	old->in_mnext = np->in_mnext;
   4348 	old->in_pmnext = np->in_pmnext;
   4349 	old->in_tqehead[0] = np->in_tqehead[0];
   4350 	old->in_tqehead[1] = np->in_tqehead[1];
   4351 	old->in_ifps[0] = np->in_ifps[0];
   4352 	old->in_ifps[1] = np->in_ifps[1];
   4353 	old->in_apr = np->in_apr;
   4354 	old->in_comment = np->in_comment;
   4355 	old->in_space = np->in_space;
   4356 	old->in_hits = np->in_hits;
   4357 	old->in_use = np->in_use;
   4358 	old->in_hv = np->in_hv[0];
   4359 	old->in_flineno = np->in_flineno;
   4360 	if (old->in_redir == NAT_REDIRECT)
   4361 		old->in_pnext = np->in_dpnext;
   4362 	else
   4363 		old->in_pnext = np->in_spnext;
   4364 	old->in_v = np->in_v[0];
   4365 	old->in_flags = np->in_flags;
   4366 	old->in_mssclamp = np->in_mssclamp;
   4367 	old->in_age[0] = np->in_age[0];
   4368 	old->in_age[1] = np->in_age[1];
   4369 	old->in_redir = np->in_redir;
   4370 	old->in_p = np->in_pr[0];
   4371 	if (np->in_redir == NAT_REDIRECT) {
   4372 		old->in_next6 = np->in_ndst.na_nextaddr;
   4373 		old->in_in[0] = np->in_ndst.na_addr[0];
   4374 		old->in_in[1] = np->in_ndst.na_addr[1];
   4375 		old->in_out[0] = np->in_odst.na_addr[0];
   4376 		old->in_out[1] = np->in_odst.na_addr[1];
   4377 		old->in_src[0] = np->in_osrc.na_addr[0];
   4378 		old->in_src[1] = np->in_osrc.na_addr[1];
   4379 	} else {
   4380 		old->in_next6 = np->in_nsrc.na_nextaddr;
   4381 		old->in_out[0] = np->in_nsrc.na_addr[0];
   4382 		old->in_out[1] = np->in_nsrc.na_addr[1];
   4383 		old->in_in[0] = np->in_osrc.na_addr[0];
   4384 		old->in_in[1] = np->in_osrc.na_addr[1];
   4385 		old->in_src[0] = np->in_odst.na_addr[0];
   4386 		old->in_src[1] = np->in_odst.na_addr[1];
   4387 	}
   4388 	ipfv5tuctov4(&np->in_tuc, &old->in_tuc);
   4389 	if (np->in_redir == NAT_REDIRECT) {
   4390 		old->in_port[0] = np->in_dpmin;
   4391 		old->in_port[1] = np->in_dpmax;
   4392 	} else {
   4393 		old->in_port[0] = np->in_spmin;
   4394 		old->in_port[1] = np->in_spmax;
   4395 	}
   4396 	old->in_ppip = np->in_ppip;
   4397 	old->in_ippip = np->in_ippip;
   4398 	bcopy(&np->in_tag, &old->in_tag, sizeof(np->in_tag));
   4399 
   4400 	if (np->in_ifnames[0] >= 0) {
   4401 		strncpy(old->in_ifnames[0], np->in_names + np->in_ifnames[0],
   4402 			LIFNAMSIZ);
   4403 		old->in_ifnames[0][LIFNAMSIZ - 1] = '\0';
   4404 	}
   4405 	if (np->in_ifnames[1] >= 0) {
   4406 		strncpy(old->in_ifnames[1], np->in_names + np->in_ifnames[1],
   4407 			LIFNAMSIZ);
   4408 		old->in_ifnames[1][LIFNAMSIZ - 1] = '\0';
   4409 	}
   4410 	if (np->in_plabel >= 0) {
   4411 		strncpy(old->in_plabel, np->in_names + np->in_plabel,
   4412 			APR_LABELLEN);
   4413 		old->in_plabel[APR_LABELLEN - 1] = '\0';
   4414 	}
   4415 }
   4416 
   4417 
   4418 static void
   4419 ipstate_current_to_4_1_16(current, old)
   4420 	void *current;
   4421 	ipstate_4_1_16_t *old;
   4422 {
   4423 	ipstate_t *is = (ipstate_t *)current;
   4424 
   4425 	old->is_lock = is->is_lock;
   4426 	old->is_next = is->is_next;
   4427 	old->is_pnext = is->is_pnext;
   4428 	old->is_hnext = is->is_hnext;
   4429 	old->is_phnext = is->is_phnext;
   4430 	old->is_me = is->is_me;
   4431 	old->is_ifp[0] = is->is_ifp[0];
   4432 	old->is_ifp[1] = is->is_ifp[1];
   4433 	old->is_sync = is->is_sync;
   4434 	old->is_rule = is->is_rule;
   4435 	old->is_tqehead[0] = is->is_tqehead[0];
   4436 	old->is_tqehead[1] = is->is_tqehead[1];
   4437 	old->is_isc = is->is_isc;
   4438 	old->is_pkts[0] = is->is_pkts[0];
   4439 	old->is_pkts[1] = is->is_pkts[1];
   4440 	old->is_pkts[2] = is->is_pkts[2];
   4441 	old->is_pkts[3] = is->is_pkts[3];
   4442 	old->is_bytes[0] = is->is_bytes[0];
   4443 	old->is_bytes[1] = is->is_bytes[1];
   4444 	old->is_bytes[2] = is->is_bytes[2];
   4445 	old->is_bytes[3] = is->is_bytes[3];
   4446 	old->is_icmppkts[0] = is->is_icmppkts[0];
   4447 	old->is_icmppkts[1] = is->is_icmppkts[1];
   4448 	old->is_icmppkts[2] = is->is_icmppkts[2];
   4449 	old->is_icmppkts[3] = is->is_icmppkts[3];
   4450 	old->is_sti = is->is_sti;
   4451 	old->is_frage[0] = is->is_frage[0];
   4452 	old->is_frage[1] = is->is_frage[1];
   4453 	old->is_ref = is->is_ref;
   4454 	old->is_isninc[0] = is->is_isninc[0];
   4455 	old->is_isninc[1] = is->is_isninc[1];
   4456 	old->is_sumd[0] = is->is_sumd[0];
   4457 	old->is_sumd[1] = is->is_sumd[1];
   4458 	old->is_src = is->is_src;
   4459 	old->is_dst = is->is_dst;
   4460 	old->is_pass = is->is_pass;
   4461 	old->is_p = is->is_p;
   4462 	old->is_v = is->is_v;
   4463 	old->is_hv = is->is_hv;
   4464 	old->is_tag = is->is_tag;
   4465 	old->is_opt[0] = is->is_opt[0];
   4466 	old->is_opt[1] = is->is_opt[1];
   4467 	old->is_optmsk[0] = is->is_optmsk[0];
   4468 	old->is_optmsk[1] = is->is_optmsk[1];
   4469 	old->is_sec = is->is_sec;
   4470 	old->is_secmsk = is->is_secmsk;
   4471 	old->is_auth = is->is_auth;
   4472 	old->is_authmsk = is->is_authmsk;
   4473 	ipf_v5tcpinfoto4(&is->is_tcp, &old->is_tcp);
   4474 	old->is_flags = is->is_flags;
   4475 	old->is_flx[0][0] = is->is_flx[0][0];
   4476 	old->is_flx[0][1] = is->is_flx[0][1];
   4477 	old->is_flx[1][0] = is->is_flx[1][0];
   4478 	old->is_flx[1][1] = is->is_flx[1][1];
   4479 	old->is_rulen = is->is_rulen;
   4480 	old->is_s0[0] = is->is_s0[0];
   4481 	old->is_s0[1] = is->is_s0[1];
   4482 	old->is_smsk[0] = is->is_smsk[0];
   4483 	old->is_smsk[1] = is->is_smsk[1];
   4484 	bcopy(is->is_group, old->is_group, sizeof(is->is_group));
   4485 	bcopy(is->is_sbuf, old->is_sbuf, sizeof(is->is_sbuf));
   4486 	bcopy(is->is_ifname, old->is_ifname, sizeof(is->is_ifname));
   4487 }
   4488 
   4489 
   4490 static void
   4491 ipstate_current_to_4_1_0(current, old)
   4492 	void *current;
   4493 	ipstate_4_1_0_t *old;
   4494 {
   4495 	ipstate_t *is = (ipstate_t *)current;
   4496 
   4497 	old->is_lock = is->is_lock;
   4498 	old->is_next = is->is_next;
   4499 	old->is_pnext = is->is_pnext;
   4500 	old->is_hnext = is->is_hnext;
   4501 	old->is_phnext = is->is_phnext;
   4502 	old->is_me = is->is_me;
   4503 	old->is_ifp[0] = is->is_ifp[0];
   4504 	old->is_ifp[1] = is->is_ifp[1];
   4505 	old->is_sync = is->is_sync;
   4506 	bzero(&old->is_nat, sizeof(old->is_nat));
   4507 	old->is_rule = is->is_rule;
   4508 	old->is_tqehead[0] = is->is_tqehead[0];
   4509 	old->is_tqehead[1] = is->is_tqehead[1];
   4510 	old->is_isc = is->is_isc;
   4511 	old->is_pkts[0] = is->is_pkts[0];
   4512 	old->is_pkts[1] = is->is_pkts[1];
   4513 	old->is_pkts[2] = is->is_pkts[2];
   4514 	old->is_pkts[3] = is->is_pkts[3];
   4515 	old->is_bytes[0] = is->is_bytes[0];
   4516 	old->is_bytes[1] = is->is_bytes[1];
   4517 	old->is_bytes[2] = is->is_bytes[2];
   4518 	old->is_bytes[3] = is->is_bytes[3];
   4519 	old->is_icmppkts[0] = is->is_icmppkts[0];
   4520 	old->is_icmppkts[1] = is->is_icmppkts[1];
   4521 	old->is_icmppkts[2] = is->is_icmppkts[2];
   4522 	old->is_icmppkts[3] = is->is_icmppkts[3];
   4523 	old->is_sti = is->is_sti;
   4524 	old->is_frage[0] = is->is_frage[0];
   4525 	old->is_frage[1] = is->is_frage[1];
   4526 	old->is_ref = is->is_ref;
   4527 	old->is_isninc[0] = is->is_isninc[0];
   4528 	old->is_isninc[1] = is->is_isninc[1];
   4529 	old->is_sumd[0] = is->is_sumd[0];
   4530 	old->is_sumd[1] = is->is_sumd[1];
   4531 	old->is_src = is->is_src;
   4532 	old->is_dst = is->is_dst;
   4533 	old->is_pass = is->is_pass;
   4534 	old->is_p = is->is_p;
   4535 	old->is_v = is->is_v;
   4536 	old->is_hv = is->is_hv;
   4537 	old->is_tag = is->is_tag;
   4538 	old->is_opt[0] = is->is_opt[0];
   4539 	old->is_opt[1] = is->is_opt[1];
   4540 	old->is_optmsk[0] = is->is_optmsk[0];
   4541 	old->is_optmsk[1] = is->is_optmsk[1];
   4542 	old->is_sec = is->is_sec;
   4543 	old->is_secmsk = is->is_secmsk;
   4544 	old->is_auth = is->is_auth;
   4545 	old->is_authmsk = is->is_authmsk;
   4546 	ipf_v5tcpinfoto4(&is->is_tcp, &old->is_tcp);
   4547 	old->is_flags = is->is_flags;
   4548 	old->is_flx[0][0] = is->is_flx[0][0];
   4549 	old->is_flx[0][1] = is->is_flx[0][1];
   4550 	old->is_flx[1][0] = is->is_flx[1][0];
   4551 	old->is_flx[1][1] = is->is_flx[1][1];
   4552 	old->is_rulen = is->is_rulen;
   4553 	old->is_s0[0] = is->is_s0[0];
   4554 	old->is_s0[1] = is->is_s0[1];
   4555 	old->is_smsk[0] = is->is_smsk[0];
   4556 	old->is_smsk[1] = is->is_smsk[1];
   4557 	bcopy(is->is_group, old->is_group, sizeof(is->is_group));
   4558 	bcopy(is->is_sbuf, old->is_sbuf, sizeof(is->is_sbuf));
   4559 	bcopy(is->is_ifname, old->is_ifname, sizeof(is->is_ifname));
   4560 }
   4561 
   4562 
   4563 static void
   4564 ips_stat_current_to_4_1_21(current, old)
   4565 	void *current;
   4566 	ips_stat_4_1_21_t *old;
   4567 {
   4568 	ips_stat_t *st = (ips_stat_t *)current;
   4569 
   4570 	old->iss_hits = st->iss_hits;
   4571 	old->iss_miss = st->iss_check_miss;
   4572 	old->iss_max = st->iss_max;
   4573 	old->iss_maxref = st->iss_max_ref;
   4574 	old->iss_tcp = st->iss_proto[IPPROTO_TCP];
   4575 	old->iss_udp = st->iss_proto[IPPROTO_UDP];
   4576 	old->iss_icmp = st->iss_proto[IPPROTO_ICMP];
   4577 	old->iss_nomem = st->iss_nomem;
   4578 	old->iss_expire = st->iss_expire;
   4579 	old->iss_fin = st->iss_fin;
   4580 	old->iss_active = st->iss_active;
   4581 	old->iss_logged = st->iss_log_ok;
   4582 	old->iss_logfail = st->iss_log_fail;
   4583 	old->iss_inuse = st->iss_inuse;
   4584 	old->iss_wild = st->iss_wild;
   4585 	old->iss_ticks = st->iss_ticks;
   4586 	old->iss_bucketfull = st->iss_bucket_full;
   4587 	old->iss_statesize = st->iss_state_size;
   4588 	old->iss_statemax = st->iss_state_max;
   4589 	old->iss_table = st->iss_table;
   4590 	old->iss_list = st->iss_list;
   4591 	old->iss_bucketlen = (void *)st->iss_bucketlen;
   4592 	old->iss_tcptab = st->iss_tcptab;
   4593 }
   4594 
   4595 
   4596 static void
   4597 ips_stat_current_to_4_1_0(current, old)
   4598 	void *current;
   4599 	ips_stat_4_1_0_t *old;
   4600 {
   4601 	ips_stat_t *st = (ips_stat_t *)current;
   4602 
   4603 	old->iss_hits = st->iss_hits;
   4604 	old->iss_miss = st->iss_check_miss;
   4605 	old->iss_max = st->iss_max;
   4606 	old->iss_maxref = st->iss_max_ref;
   4607 	old->iss_tcp = st->iss_proto[IPPROTO_TCP];
   4608 	old->iss_udp = st->iss_proto[IPPROTO_UDP];
   4609 	old->iss_icmp = st->iss_proto[IPPROTO_ICMP];
   4610 	old->iss_nomem = st->iss_nomem;
   4611 	old->iss_expire = st->iss_expire;
   4612 	old->iss_fin = st->iss_fin;
   4613 	old->iss_active = st->iss_active;
   4614 	old->iss_logged = st->iss_log_ok;
   4615 	old->iss_logfail = st->iss_log_fail;
   4616 	old->iss_inuse = st->iss_inuse;
   4617 	old->iss_wild = st->iss_wild;
   4618 	old->iss_ticks = st->iss_ticks;
   4619 	old->iss_bucketfull = st->iss_bucket_full;
   4620 	old->iss_statesize = st->iss_state_size;
   4621 	old->iss_statemax = st->iss_state_max;
   4622 	old->iss_table = st->iss_table;
   4623 	old->iss_list = st->iss_list;
   4624 	old->iss_bucketlen = (void *)st->iss_bucketlen;
   4625 }
   4626 
   4627 
   4628 static void
   4629 nat_save_current_to_4_1_16(current, old)
   4630 	void *current;
   4631 	nat_save_4_1_16_t *old;
   4632 {
   4633 	nat_save_t *nats = (nat_save_t *)current;
   4634 
   4635 	old->ipn_next = nats->ipn_next;
   4636 	bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
   4637 	bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
   4638 	frentry_current_to_4_1_16(&nats->ipn_fr, &old->ipn_fr);
   4639 	old->ipn_dsize = nats->ipn_dsize;
   4640 	bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
   4641 }
   4642 
   4643 
   4644 static void
   4645 nat_save_current_to_4_1_14(current, old)
   4646 	void *current;
   4647 	nat_save_4_1_14_t *old;
   4648 {
   4649 	nat_save_t *nats = (nat_save_t *)current;
   4650 
   4651 	old->ipn_next = nats->ipn_next;
   4652 	bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
   4653 	bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
   4654 	frentry_current_to_4_1_0(&nats->ipn_fr, &old->ipn_fr);
   4655 	old->ipn_dsize = nats->ipn_dsize;
   4656 	bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
   4657 }
   4658 
   4659 
   4660 static void
   4661 nat_save_current_to_4_1_3(current, old)
   4662 	void *current;
   4663 	nat_save_4_1_3_t *old;
   4664 {
   4665 	nat_save_t *nats = (nat_save_t *)current;
   4666 
   4667 	old->ipn_next = nats->ipn_next;
   4668 	bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
   4669 	bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
   4670 	frentry_current_to_4_1_0(&nats->ipn_fr, &old->ipn_fr);
   4671 	old->ipn_dsize = nats->ipn_dsize;
   4672 	bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
   4673 }
   4674 
   4675 
   4676 static void
   4677 nat_current_to_4_1_25(current, old)
   4678 	void *current;
   4679 	nat_4_1_25_t *old;
   4680 {
   4681 	nat_t *nat = (nat_t *)current;
   4682 
   4683 	old->nat_lock = nat->nat_lock;
   4684 	old->nat_next = (void *)nat->nat_next;
   4685 	old->nat_pnext = (void *)nat->nat_pnext;
   4686 	old->nat_hnext[0] = (void *)nat->nat_hnext[0];
   4687 	old->nat_hnext[1] = (void *)nat->nat_hnext[1];
   4688 	old->nat_phnext[0] = (void *)nat->nat_phnext[0];
   4689 	old->nat_phnext[1] = (void *)nat->nat_phnext[1];
   4690 	old->nat_hm = nat->nat_hm;
   4691 	old->nat_data = nat->nat_data;
   4692 	old->nat_me = (void *)nat->nat_me;
   4693 	old->nat_state = nat->nat_state;
   4694 	old->nat_aps = nat->nat_aps;
   4695 	old->nat_fr = nat->nat_fr;
   4696 	old->nat_ptr = (void *)nat->nat_ptr;
   4697 	old->nat_ifps[0] = nat->nat_ifps[0];
   4698 	old->nat_ifps[1] = nat->nat_ifps[1];
   4699 	old->nat_sync = nat->nat_sync;
   4700 	old->nat_tqe = nat->nat_tqe;
   4701 	old->nat_flags = nat->nat_flags;
   4702 	old->nat_sumd[0] = nat->nat_sumd[0];
   4703 	old->nat_sumd[1] = nat->nat_sumd[1];
   4704 	old->nat_ipsumd = nat->nat_ipsumd;
   4705 	old->nat_mssclamp = nat->nat_mssclamp;
   4706 	old->nat_pkts[0] = nat->nat_pkts[0];
   4707 	old->nat_pkts[1] = nat->nat_pkts[1];
   4708 	old->nat_bytes[0] = nat->nat_bytes[0];
   4709 	old->nat_bytes[1] = nat->nat_bytes[1];
   4710 	old->nat_ref = nat->nat_ref;
   4711 	old->nat_dir = nat->nat_dir;
   4712 	old->nat_p = nat->nat_pr[0];
   4713 	old->nat_use = nat->nat_use;
   4714 	old->nat_hv[0] = nat->nat_hv[0];
   4715 	old->nat_hv[1] = nat->nat_hv[1];
   4716 	old->nat_rev = nat->nat_rev;
   4717 	old->nat_redir = nat->nat_redir;
   4718 	bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
   4719 	bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
   4720 
   4721 	if (nat->nat_redir == NAT_REDIRECT) {
   4722 		old->nat_inip6 = nat->nat_ndst6;
   4723 		old->nat_outip6 = nat->nat_odst6;
   4724 		old->nat_oip6 = nat->nat_osrc6;
   4725 		old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
   4726 		old->nat_un.nat_unt.ts_dport = nat->nat_odport;
   4727 	} else {
   4728 		old->nat_inip6 = nat->nat_osrc6;
   4729 		old->nat_outip6 = nat->nat_nsrc6;
   4730 		old->nat_oip6 = nat->nat_odst6;
   4731 		old->nat_un.nat_unt.ts_sport = nat->nat_osport;
   4732 		old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
   4733 	}
   4734 }
   4735 
   4736 
   4737 static void
   4738 nat_current_to_4_1_14(current, old)
   4739 	void *current;
   4740 	nat_4_1_14_t *old;
   4741 {
   4742 	nat_t *nat = (nat_t *)current;
   4743 
   4744 	old->nat_lock = nat->nat_lock;
   4745 	old->nat_next = nat->nat_next;
   4746 	old->nat_pnext = NULL;
   4747 	old->nat_hnext[0] = NULL;
   4748 	old->nat_hnext[1] = NULL;
   4749 	old->nat_phnext[0] = NULL;
   4750 	old->nat_phnext[1] = NULL;
   4751 	old->nat_hm = nat->nat_hm;
   4752 	old->nat_data = nat->nat_data;
   4753 	old->nat_me = (void *)nat->nat_me;
   4754 	old->nat_state = nat->nat_state;
   4755 	old->nat_aps = nat->nat_aps;
   4756 	old->nat_fr = nat->nat_fr;
   4757 	old->nat_ptr = nat->nat_ptr;
   4758 	old->nat_ifps[0] = nat->nat_ifps[0];
   4759 	old->nat_ifps[1] = nat->nat_ifps[1];
   4760 	old->nat_sync = nat->nat_sync;
   4761 	old->nat_tqe = nat->nat_tqe;
   4762 	old->nat_flags = nat->nat_flags;
   4763 	old->nat_sumd[0] = nat->nat_sumd[0];
   4764 	old->nat_sumd[1] = nat->nat_sumd[1];
   4765 	old->nat_ipsumd = nat->nat_ipsumd;
   4766 	old->nat_mssclamp = nat->nat_mssclamp;
   4767 	old->nat_pkts[0] = nat->nat_pkts[0];
   4768 	old->nat_pkts[1] = nat->nat_pkts[1];
   4769 	old->nat_bytes[0] = nat->nat_bytes[0];
   4770 	old->nat_bytes[1] = nat->nat_bytes[1];
   4771 	old->nat_ref = nat->nat_ref;
   4772 	old->nat_dir = nat->nat_dir;
   4773 	old->nat_p = nat->nat_pr[0];
   4774 	old->nat_use = nat->nat_use;
   4775 	old->nat_hv[0] = nat->nat_hv[0];
   4776 	old->nat_hv[1] = nat->nat_hv[1];
   4777 	old->nat_rev = nat->nat_rev;
   4778 	bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
   4779 	bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
   4780 
   4781 	if (nat->nat_redir == NAT_REDIRECT) {
   4782 		old->nat_inip6 = nat->nat_ndst6;
   4783 		old->nat_outip6 = nat->nat_odst6;
   4784 		old->nat_oip6 = nat->nat_osrc6;
   4785 		old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
   4786 		old->nat_un.nat_unt.ts_dport = nat->nat_odport;
   4787 	} else {
   4788 		old->nat_inip6 = nat->nat_osrc6;
   4789 		old->nat_outip6 = nat->nat_nsrc6;
   4790 		old->nat_oip6 = nat->nat_odst6;
   4791 		old->nat_un.nat_unt.ts_sport = nat->nat_osport;
   4792 		old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
   4793 	}
   4794 }
   4795 
   4796 
   4797 static void
   4798 nat_current_to_4_1_3(current, old)
   4799 	void *current;
   4800 	nat_4_1_3_t *old;
   4801 {
   4802 	nat_t *nat = (nat_t *)current;
   4803 
   4804 	old->nat_lock = nat->nat_lock;
   4805 	old->nat_next = nat->nat_next;
   4806 	old->nat_pnext = NULL;
   4807 	old->nat_hnext[0] = NULL;
   4808 	old->nat_hnext[1] = NULL;
   4809 	old->nat_phnext[0] = NULL;
   4810 	old->nat_phnext[1] = NULL;
   4811 	old->nat_hm = nat->nat_hm;
   4812 	old->nat_data = nat->nat_data;
   4813 	old->nat_me = (void *)nat->nat_me;
   4814 	old->nat_state = nat->nat_state;
   4815 	old->nat_aps = nat->nat_aps;
   4816 	old->nat_fr = nat->nat_fr;
   4817 	old->nat_ptr = nat->nat_ptr;
   4818 	old->nat_ifps[0] = nat->nat_ifps[0];
   4819 	old->nat_ifps[1] = nat->nat_ifps[1];
   4820 	old->nat_sync = nat->nat_sync;
   4821 	old->nat_tqe = nat->nat_tqe;
   4822 	old->nat_flags = nat->nat_flags;
   4823 	old->nat_sumd[0] = nat->nat_sumd[0];
   4824 	old->nat_sumd[1] = nat->nat_sumd[1];
   4825 	old->nat_ipsumd = nat->nat_ipsumd;
   4826 	old->nat_mssclamp = nat->nat_mssclamp;
   4827 	old->nat_pkts[0] = nat->nat_pkts[0];
   4828 	old->nat_pkts[1] = nat->nat_pkts[1];
   4829 	old->nat_bytes[0] = nat->nat_bytes[0];
   4830 	old->nat_bytes[1] = nat->nat_bytes[1];
   4831 	old->nat_ref = nat->nat_ref;
   4832 	old->nat_dir = nat->nat_dir;
   4833 	old->nat_p = nat->nat_pr[0];
   4834 	old->nat_use = nat->nat_use;
   4835 	old->nat_hv[0] = nat->nat_hv[0];
   4836 	old->nat_hv[1] = nat->nat_hv[1];
   4837 	old->nat_rev = nat->nat_rev;
   4838 	bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
   4839 	bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
   4840 
   4841 	if (nat->nat_redir == NAT_REDIRECT) {
   4842 		old->nat_inip6 = nat->nat_ndst6;
   4843 		old->nat_outip6 = nat->nat_odst6;
   4844 		old->nat_oip6 = nat->nat_osrc6;
   4845 		old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
   4846 		old->nat_un.nat_unt.ts_dport = nat->nat_odport;
   4847 	} else {
   4848 		old->nat_inip6 = nat->nat_osrc6;
   4849 		old->nat_outip6 = nat->nat_nsrc6;
   4850 		old->nat_oip6 = nat->nat_odst6;
   4851 		old->nat_un.nat_unt.ts_sport = nat->nat_osport;
   4852 		old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
   4853 	}
   4854 }
   4855 
   4856 #endif /* IPFILTER_COMPAT */
   4857