2 * Copyright (C) 2002-2012 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 #if defined(KERNEL) || defined(_KERNEL)
12 #include <sys/param.h>
13 #include <sys/errno.h>
14 #include <sys/types.h>
17 #if defined(__FreeBSD_version) && defined(_KERNEL)
18 # include <sys/fcntl.h>
19 # include <sys/filio.h>
21 # include <sys/ioctl.h>
29 #include <sys/socket.h>
31 #if defined(__FreeBSD__)
32 # include <sys/cdefs.h>
33 # include <sys/proc.h>
36 # include <sys/systm.h>
38 # include <sys/mbuf.h>
41 #include <netinet/in.h>
43 #include "netinet/ip_compat.h"
44 #include "netinet/ip_fil.h"
45 #include "netinet/ip_pool.h"
46 #include "netinet/ip_htable.h"
47 #include "netinet/ip_lookup.h"
48 #include "netinet/ip_nat.h"
49 #include "netinet/ip_state.h"
50 #include "netinet/ip_proxy.h"
51 #include "netinet/ip_auth.h"
55 * NetBSD has moved to 64bit time_t for all architectures.
56 * For some, such as sparc64, there is no change because long is already
57 * 64bit, but for others (i386), there is...
59 #ifdef IPFILTER_COMPAT
62 typedef struct timeval_l {
68 /* ------------------------------------------------------------------------ */
70 typedef struct tcpinfo4 {
76 static void ipf_v5tcpinfoto4 __P((tcpinfo_t *, tcpinfo4_t *));
79 ipf_v5tcpinfoto4(v5, v4)
83 v4->ts_sport = v5->ts_sport;
84 v4->ts_dport = v5->ts_dport;
85 v4->ts_data[0] = v5->ts_data[0];
86 v4->ts_data[1] = v5->ts_data[1];
89 typedef struct fr_ip4 {
105 typedef struct frpcmp4 {
111 typedef struct frtuc4 {
118 typedef struct fripf4 {
132 typedef struct frdest_4 {
135 char fd_ifname[LIFNAMSIZ];
138 /* ------------------------------------------------------------------------ */
140 /* 5.1.0 new release (current)
141 * 4.1.34 changed the size of the time structure used for pps
142 * 4.1.16 moved the location of fr_flineno
145 typedef struct frentry_4_1_34 {
147 struct frentry *fr_next;
148 struct frentry **fr_grp;
149 struct ipscan *fr_isc;
151 void *fr_ptr; /* for use with fr_arg */
152 char *fr_comment; /* text comment for rule */
153 int fr_ref; /* reference count - for grouping */
154 int fr_statecnt; /* state count - for limit rules */
155 int fr_flineno; /* line number from conf file */
159 struct timeval frp_lastpkt;
167 frentfunc_t fru_func;
169 ipfunc_t fr_func; /* call this function */
172 int fr_statemax; /* max reference count */
174 u_32_t fr_flags; /* per-rule flags && options (see below) */
175 u_32_t fr_logtag; /* user defined log tag # */
176 u_32_t fr_collect; /* collection number */
177 u_int fr_arg; /* misc. numeric arg for rule */
178 u_int fr_loglevel; /* syslog log facility + priority */
179 u_int fr_age[2]; /* non-TCP timeouts */
181 u_char fr_icode; /* return ICMP code */
182 char fr_group[FR_GROUPLEN]; /* group to which this rule belongs */
183 char fr_grhead[FR_GROUPLEN]; /* group # which this rule starts */
185 char fr_ifnames[4][LIFNAMSIZ];
187 frdest_4_t fr_tifs[2]; /* "to"/"reply-to" interface */
188 frdest_4_t fr_dif; /* duplicate packet interface */
189 u_int fr_cksum; /* checksum on filter rules for performance */
192 typedef struct frentry_4_1_16 {
194 struct frentry *fr_next;
195 struct frentry **fr_grp;
196 struct ipscan *fr_isc;
207 timeval_l_t frp_lastpkt;
209 struct timeval frp_lastpkt;
217 frentfunc_t fru_func;
232 char fr_group[FR_GROUPLEN];
233 char fr_grhead[FR_GROUPLEN];
235 char fr_ifnames[4][LIFNAMSIZ];
237 frdest_4_t fr_tifs[2];
242 typedef struct frentry_4_1_0 {
244 struct frentry *fr_next;
245 struct frentry **fr_grp;
246 struct ipscan *fr_isc;
256 timeval_l_t frp_lastpkt;
258 struct timeval frp_lastpkt;
267 frentfunc_t fru_func;
270 * Fields after this may not change whilst in the kernel.
286 char fr_group[FR_GROUPLEN];
287 char fr_grhead[FR_GROUPLEN];
289 char fr_ifnames[4][LIFNAMSIZ];
291 frdest_4_t fr_tifs[2];
296 /* ------------------------------------------------------------------------ */
299 * 5.1.0 new release (current)
300 * 4.1.32 removed both fin_state and fin_nat, added fin_pktnum
301 * 4.1.24 added fin_cksum
302 * 4.1.23 added fin_exthdr
303 * 4.1.11 added fin_ifname
304 * 4.1.4 added fin_hbuf
306 typedef struct fr_info_4_1_32 {
307 void *fin_ifp; /* interface packet is `on' */
308 frip4_t fin_fi; /* IP Packet summary */
310 u_short fid_16[2]; /* TCP/UDP ports, ICMP code/type */
313 int fin_out; /* in or out ? 1 == out, 0 == in */
314 int fin_rev; /* state only: 1 = reverse */
315 u_short fin_hlen; /* length of IP header in bytes */
316 u_char ofin_tcpf; /* TCP header flags (SYN, ACK, etc) */
317 u_char fin_icode; /* ICMP error to return */
318 u_32_t fin_rule; /* rule # last matched */
319 char fin_group[FR_GROUPLEN]; /* group number, -1 for none */
320 struct frentry *fin_fr; /* last matching rule */
321 void *fin_dp; /* start of data past IP header */
322 int fin_dlen; /* length of data portion of packet */
324 int fin_ipoff; /* # bytes from buffer start to hdr */
325 u_short fin_id; /* IP packet id field */
327 int fin_depth; /* Group nesting depth */
328 int fin_error; /* Error code to return */
329 int fin_cksum; /* -1 bad, 1 good, 0 not done */
334 mb_t **fin_mp; /* pointer to pointer to mbuf */
335 mb_t *fin_m; /* pointer to mbuf */
337 mb_t *fin_qfm; /* pointer to mblk where pkt starts */
339 char fin_ifname[LIFNAMSIZ];
343 typedef struct fr_info_4_1_24 {
356 char fin_group[FR_GROUPLEN];
357 struct frentry *fin_fr;
377 char fin_ifname[LIFNAMSIZ];
381 typedef struct fr_info_4_1_23 {
394 char fin_group[FR_GROUPLEN];
395 struct frentry *fin_fr;
414 char fin_ifname[LIFNAMSIZ];
418 typedef struct fr_info_4_1_11 {
431 char fin_group[FR_GROUPLEN];
432 struct frentry *fin_fr;
450 char fin_ifname[LIFNAMSIZ];
454 /* ------------------------------------------------------------------------ */
456 typedef struct filterstats_4_1 {
457 u_long fr_pass; /* packets allowed */
458 u_long fr_block; /* packets denied */
459 u_long fr_nom; /* packets which don't match any rule */
460 u_long fr_short; /* packets which are short */
461 u_long fr_ppkl; /* packets allowed and logged */
462 u_long fr_bpkl; /* packets denied and logged */
463 u_long fr_npkl; /* packets unmatched and logged */
464 u_long fr_pkl; /* packets logged */
465 u_long fr_skip; /* packets to be logged but buffer full */
466 u_long fr_ret; /* packets for which a return is sent */
467 u_long fr_acct; /* packets for which counting was performed */
468 u_long fr_bnfr; /* bad attempts to allocate fragment state */
469 u_long fr_nfr; /* new fragment state kept */
470 u_long fr_cfr; /* add new fragment state but complete pkt */
471 u_long fr_bads; /* bad attempts to allocate packet state */
472 u_long fr_ads; /* new packet state kept */
473 u_long fr_chit; /* cached hit */
474 u_long fr_tcpbad; /* TCP checksum check failures */
475 u_long fr_pull[2]; /* good and bad pullup attempts */
476 u_long fr_badsrc; /* source received doesn't match route */
477 u_long fr_badttl; /* TTL in packet doesn't reach minimum */
478 u_long fr_bad; /* bad IP packets to the filter */
479 u_long fr_ipv6; /* IPv6 packets in/out */
480 u_long fr_ppshit; /* dropped because of pps ceiling */
481 u_long fr_ipud; /* IP id update failures */
485 * 5.1.0 new release (current)
486 * 4.1.33 changed the size of f_locks from IPL_LOGMAX to IPL_LOGSIZE
488 typedef struct friostat_4_1_33 {
489 struct filterstats_4_1 of_st[2];
490 struct frentry *f_ipf[2][2];
491 struct frentry *f_acct[2][2];
492 struct frentry *f_ipf6[2][2];
493 struct frentry *f_acct6[2][2];
494 struct frentry *f_auth;
495 struct frgroup *f_groups[IPL_LOGSIZE][2];
498 int f_locks[IPL_LOGSIZE];
501 int f_defpass; /* default pass - from fr_pass */
502 int f_active; /* 1 or 0 - active rule set */
503 int f_running; /* 1 if running, else 0 */
504 int f_logging; /* 1 if enabled, else 0 */
506 char f_version[32]; /* version string */
509 typedef struct friostat_4_1_0 {
510 struct filterstats_4_1 of_st[2];
511 struct frentry *f_ipf[2][2];
512 struct frentry *f_acct[2][2];
513 struct frentry *f_ipf6[2][2];
514 struct frentry *f_acct6[2][2];
515 struct frentry *f_auth;
516 struct frgroup *f_groups[IPL_LOGSIZE][2];
519 int f_locks[IPL_LOGMAX];
530 /* ------------------------------------------------------------------------ */
533 * 5.1.0 new release (current)
534 * 4.1.14 added in_lock
536 typedef struct ipnat_4_1_14 {
538 struct ipnat *in_next; /* NAT rule list next */
539 struct ipnat *in_rnext; /* rdr rule hash next */
540 struct ipnat **in_prnext; /* prior rdr next ptr */
541 struct ipnat *in_mnext; /* map rule hash next */
542 struct ipnat **in_pmnext; /* prior map next ptr */
543 struct ipftq *in_tqehead[2];
552 int in_flineno; /* conf. file line number */
556 /* From here to the end is covered by IPN_CMPSIZ */
558 u_32_t in_mssclamp; /* if != 0 clamp MSS to this */
560 int in_redir; /* see below for values */
561 int in_p; /* protocol. */
567 u_short in_ppip; /* ports per IP. */
568 u_short in_ippip; /* IP #'s per IP# */
569 char in_ifnames[2][LIFNAMSIZ];
570 char in_plabel[APR_LABELLEN]; /* proxy label. */
574 typedef struct ipnat_4_1_0 {
575 struct ipnat *in_next;
576 struct ipnat *in_rnext;
577 struct ipnat **in_prnext;
578 struct ipnat *in_mnext;
579 struct ipnat **in_pmnext;
580 struct ipftq *in_tqehead[2];
605 char in_ifnames[2][LIFNAMSIZ];
606 char in_plabel[APR_LABELLEN];
610 /* ------------------------------------------------------------------------ */
612 typedef struct natlookup_4_1_1 {
613 struct in_addr onl_inip;
614 struct in_addr onl_outip;
615 struct in_addr onl_realip;
622 /* ------------------------------------------------------------------------ */
625 * 4.1.25 added nat_seqnext (current)
626 * 4.1.14 added nat_redir
627 * 4.1.3 moved nat_rev
628 * 4.1.2 added nat_rev
630 typedef struct nat_4_1_25 {
632 struct nat_4_1_25 *nat_next;
633 struct nat_4_1_25 **nat_pnext;
634 struct nat_4_1_25 *nat_hnext[2];
635 struct nat_4_1_25 **nat_phnext[2];
636 struct hostmap *nat_hm;
638 struct nat_4_1_25 **nat_me;
639 struct ipstate *nat_state;
640 struct ap_session *nat_aps;
642 struct ipnat_4_1_14 *nat_ptr;
653 U_QUAD_T nat_pkts[2];
654 U_QUAD_T nat_bytes[2];
667 char nat_ifnames[2][LIFNAMSIZ];
670 u_32_t nat_seqnext[2];
673 typedef struct nat_4_1_14 {
675 struct nat *nat_next;
676 struct nat **nat_pnext;
677 struct nat *nat_hnext[2];
678 struct nat **nat_phnext[2];
679 struct hostmap *nat_hm;
682 struct ipstate *nat_state;
683 struct ap_session *nat_aps;
685 struct ipnat *nat_ptr;
696 U_QUAD_T nat_pkts[2];
697 U_QUAD_T nat_bytes[2];
710 char nat_ifnames[2][LIFNAMSIZ];
715 typedef struct nat_4_1_3 {
717 struct nat *nat_next;
718 struct nat **nat_pnext;
719 struct nat *nat_hnext[2];
720 struct nat **nat_phnext[2];
721 struct hostmap *nat_hm;
724 struct ipstate *nat_state;
725 struct ap_session *nat_aps;
727 struct ipnat *nat_ptr;
738 U_QUAD_T nat_pkts[2];
739 U_QUAD_T nat_bytes[2];
752 char nat_ifnames[2][LIFNAMSIZ];
758 typedef struct nat_save_4_1_34 {
760 struct nat_4_1_25 ipn_nat;
761 struct ipnat_4_1_14 ipn_ipnat;
762 struct frentry_4_1_34 ipn_fr;
767 typedef struct nat_save_4_1_16 {
769 nat_4_1_14_t ipn_nat;
771 frentry_4_1_16_t ipn_fr;
776 typedef struct nat_save_4_1_14 {
778 nat_4_1_14_t ipn_nat;
780 frentry_4_1_0_t ipn_fr;
785 typedef struct nat_save_4_1_3 {
788 ipnat_4_1_0_t ipn_ipnat;
789 frentry_4_1_0_t ipn_fr;
794 /* ------------------------------------------------------------------------ */
797 * 5.1.0 new release (current)
798 * 4.1.32 added ns_uncreate
799 * 4.1.27 added ns_orphans
800 * 4.1.16 added ns_ticks
802 typedef struct natstat_4_1_32 {
814 hostmap_t **ns_maptable;
825 hostmap_t *ns_maplist;
826 u_long *ns_bucketlen[2];
829 u_long ns_uncreate[2][2];
832 typedef struct natstat_4_1_27 {
844 hostmap_t **ns_maptable;
855 hostmap_t *ns_maplist;
856 u_long *ns_bucketlen[2];
861 typedef struct natstat_4_1_16 {
873 hostmap_t **ns_maptable;
884 hostmap_t *ns_maplist;
885 u_long *ns_bucketlen[2];
889 typedef struct natstat_4_1_0 {
901 hostmap_t **ns_maptable;
912 hostmap_t *ns_maplist;
913 u_long *ns_bucketlen[2];
916 /* ------------------------------------------------------------------------ */
919 * 5.1.0 new release (current)
920 * 4.1.32 fra_info:removed both fin_state & fin_nat, added fin_pktnum
921 * 4.1.29 added fra_flx
922 * 4.1.24 fra_info:added fin_cksum
923 * 4.1.23 fra_info:added fin_exthdr
924 * 4.1.11 fra_info:added fin_ifname
925 * 4.1.4 fra_info:added fin_hbuf
928 typedef struct frauth_4_1_32 {
933 fr_info_4_1_32_t fra_info;
942 typedef struct frauth_4_1_29 {
947 fr_info_4_1_24_t fra_info;
956 typedef struct frauth_4_1_24 {
961 fr_info_4_1_24_t fra_info;
969 typedef struct frauth_4_1_23 {
974 fr_info_4_1_23_t fra_info;
982 typedef struct frauth_4_1_11 {
987 fr_info_4_1_11_t fra_info;
995 /* ------------------------------------------------------------------------ */
998 * 5.1.0 new release (current)
999 * 4.1.16 removed is_nat
1001 typedef struct ipstate_4_1_16 {
1003 struct ipstate *is_next;
1004 struct ipstate **is_pnext;
1005 struct ipstate *is_hnext;
1006 struct ipstate **is_phnext;
1007 struct ipstate **is_me;
1011 struct ipftq *is_tqehead[2];
1012 struct ipscan *is_isc;
1013 U_QUAD_T is_pkts[4];
1014 U_QUAD_T is_bytes[4];
1015 U_QUAD_T is_icmppkts[4];
1016 struct ipftqent is_sti;
1018 int is_ref; /* reference count */
1024 u_char is_p; /* Protocol */
1028 u_32_t is_opt[2]; /* packet options set */
1029 u_32_t is_optmsk[2]; /* " " mask */
1030 u_short is_sec; /* security options set */
1031 u_short is_secmsk; /* " " mask */
1032 u_short is_auth; /* authentication options set */
1033 u_short is_authmsk; /* " " mask */
1042 u_32_t is_rulen; /* rule number when created */
1045 char is_group[FR_GROUPLEN];
1046 char is_sbuf[2][16];
1047 char is_ifname[4][LIFNAMSIZ];
1050 typedef struct ipstate_4_1_0 {
1052 struct ipstate *is_next;
1053 struct ipstate **is_pnext;
1054 struct ipstate *is_hnext;
1055 struct ipstate **is_phnext;
1056 struct ipstate **is_me;
1061 struct ipftq *is_tqehead[2];
1062 struct ipscan *is_isc;
1063 U_QUAD_T is_pkts[4];
1064 U_QUAD_T is_bytes[4];
1065 U_QUAD_T is_icmppkts[4];
1066 struct ipftqent is_sti;
1079 u_32_t is_optmsk[2];
1095 char is_group[FR_GROUPLEN];
1096 char is_sbuf[2][16];
1097 char is_ifname[4][LIFNAMSIZ];
1100 typedef struct ipstate_save_4_1_34 {
1102 struct ipstate_4_1_16 ips_is;
1103 struct frentry_4_1_34 ips_fr;
1104 } ipstate_save_4_1_34_t;
1106 typedef struct ipstate_save_4_1_16 {
1108 ipstate_4_1_0_t ips_is;
1109 frentry_4_1_16_t ips_fr;
1110 } ipstate_save_4_1_16_t;
1112 typedef struct ipstate_save_4_1_0 {
1114 ipstate_4_1_0_t ips_is;
1115 frentry_4_1_0_t ips_fr;
1116 } ipstate_save_4_1_0_t;
1118 /* ------------------------------------------------------------------------ */
1121 * 5.1.0 new release (current)
1122 * 4.1.21 added iss_tcptab
1124 typedef struct ips_stat_4_1_21 {
1142 u_long iss_bucketfull;
1145 ipstate_t **iss_table;
1146 ipstate_t *iss_list;
1147 u_long *iss_bucketlen;
1148 ipftq_t *iss_tcptab;
1149 } ips_stat_4_1_21_t;
1151 typedef struct ips_stat_4_1_0 {
1169 u_long iss_bucketfull;
1172 ipstate_t **iss_table;
1173 ipstate_t *iss_list;
1174 u_long *iss_bucketlen;
1177 /* ------------------------------------------------------------------------ */
1179 typedef struct ipfrstat_4_1_1 {
1180 u_long ifs_exists; /* add & already exists */
1186 u_long ifs_retrans0;
1188 struct ipfr **ifs_table;
1189 struct ipfr **ifs_nattab;
1192 /* ------------------------------------------------------------------------ */
1193 static int ipf_addfrstr __P((char *, int, char *, int));
1194 static void ipf_v4iptov5 __P((frip4_t *, fr_ip_t *));
1195 static void ipf_v5iptov4 __P((fr_ip_t *, frip4_t *));
1196 static void ipfv4tuctov5 __P((frtuc4_t *, frtuc_t *));
1197 static void ipfv5tuctov4 __P((frtuc_t *, frtuc4_t *));
1198 static int ipf_v4fripftov5 __P((fripf4_t *, char *));
1199 static void ipf_v5fripftov4 __P((fripf_t *, fripf4_t *));
1200 static int fr_frflags4to5 __P((u_32_t));
1201 static int fr_frflags5to4 __P((u_32_t));
1203 static void friostat_current_to_4_1_0 __P((void *, friostat_4_1_0_t *, int));
1204 static void friostat_current_to_4_1_33 __P((void *, friostat_4_1_33_t *, int));
1205 static void ipstate_current_to_4_1_0 __P((void *, ipstate_4_1_0_t *));
1206 static void ipstate_current_to_4_1_16 __P((void *, ipstate_4_1_16_t *));
1207 static void ipnat_current_to_4_1_0 __P((void *, ipnat_4_1_0_t *));
1208 static void ipnat_current_to_4_1_14 __P((void *, ipnat_4_1_14_t *));
1209 static void frauth_current_to_4_1_11 __P((void *, frauth_4_1_11_t *));
1210 static void frauth_current_to_4_1_23 __P((void *, frauth_4_1_23_t *));
1211 static void frauth_current_to_4_1_24 __P((void *, frauth_4_1_24_t *));
1212 static void frauth_current_to_4_1_29 __P((void *, frauth_4_1_29_t *));
1213 static void frentry_current_to_4_1_0 __P((void *, frentry_4_1_0_t *));
1214 static void frentry_current_to_4_1_16 __P((void *, frentry_4_1_16_t *));
1215 static void frentry_current_to_4_1_34 __P((void *, frentry_4_1_34_t *));
1216 static void fr_info_current_to_4_1_11 __P((void *, fr_info_4_1_11_t *));
1217 static void fr_info_current_to_4_1_23 __P((void *, fr_info_4_1_23_t *));
1218 static void fr_info_current_to_4_1_24 __P((void *, fr_info_4_1_24_t *));
1219 static void nat_save_current_to_4_1_3 __P((void *, nat_save_4_1_3_t *));
1220 static void nat_save_current_to_4_1_14 __P((void *, nat_save_4_1_14_t *));
1221 static void nat_save_current_to_4_1_16 __P((void *, nat_save_4_1_16_t *));
1222 static void ipstate_save_current_to_4_1_0 __P((void *, ipstate_save_4_1_0_t *));
1223 static void ipstate_save_current_to_4_1_16 __P((void *, ipstate_save_4_1_16_t *));
1224 static void ips_stat_current_to_4_1_0 __P((void *, ips_stat_4_1_0_t *));
1225 static void ips_stat_current_to_4_1_21 __P((void *, ips_stat_4_1_21_t *));
1226 static void natstat_current_to_4_1_0 __P((void *, natstat_4_1_0_t *));
1227 static void natstat_current_to_4_1_16 __P((void *, natstat_4_1_16_t *));
1228 static void natstat_current_to_4_1_27 __P((void *, natstat_4_1_27_t *));
1229 static void natstat_current_to_4_1_32 __P((void *, natstat_4_1_32_t *));
1230 static void nat_current_to_4_1_3 __P((void *, nat_4_1_3_t *));
1231 static void nat_current_to_4_1_14 __P((void *, nat_4_1_14_t *));
1232 static void nat_current_to_4_1_25 __P((void *, nat_4_1_25_t *));
1234 static void friostat_4_1_0_to_current __P((friostat_4_1_0_t *, void *));
1235 static void friostat_4_1_33_to_current __P((friostat_4_1_33_t *, void *));
1236 static void ipnat_4_1_0_to_current __P((ipnat_4_1_0_t *, void *, int));
1237 static void ipnat_4_1_14_to_current __P((ipnat_4_1_14_t *, void *, int));
1238 static void frauth_4_1_11_to_current __P((frauth_4_1_11_t *, void *));
1239 static void frauth_4_1_23_to_current __P((frauth_4_1_23_t *, void *));
1240 static void frauth_4_1_24_to_current __P((frauth_4_1_24_t *, void *));
1241 static void frauth_4_1_29_to_current __P((frauth_4_1_29_t *, void *));
1242 static void frauth_4_1_32_to_current __P((frauth_4_1_32_t *, void *));
1243 static void frentry_4_1_0_to_current __P((ipf_main_softc_t *, frentry_4_1_0_t *, void *, int));
1244 static void frentry_4_1_16_to_current __P((ipf_main_softc_t *, frentry_4_1_16_t *, void *, int));
1245 static void frentry_4_1_34_to_current __P((ipf_main_softc_t *, frentry_4_1_34_t *, void *, int));
1246 static void fr_info_4_1_11_to_current __P((fr_info_4_1_11_t *, void *));
1247 static void fr_info_4_1_23_to_current __P((fr_info_4_1_23_t *, void *));
1248 static void fr_info_4_1_24_to_current __P((fr_info_4_1_24_t *, void *));
1249 static void fr_info_4_1_32_to_current __P((fr_info_4_1_32_t *, void *));
1250 static void nat_save_4_1_3_to_current __P((ipf_main_softc_t *, nat_save_4_1_3_t *, void *));
1251 static void nat_save_4_1_14_to_current __P((ipf_main_softc_t *, nat_save_4_1_14_t *, void *));
1252 static void nat_save_4_1_16_to_current __P((ipf_main_softc_t *, nat_save_4_1_16_t *, void *));
1254 /* ------------------------------------------------------------------------ */
1255 /* In this section is a series of short routines that deal with translating */
1256 /* the smaller data structures used above as their internal changes make */
1257 /* them inappropriate for simple assignment. */
1258 /* ------------------------------------------------------------------------ */
1262 ipf_addfrstr(char *names, int namelen, char *str, int maxlen)
1267 for (i = maxlen, t = str; (*t != '\0') && (i > 0); i--) {
1268 names[namelen++] = *t++;
1270 names[namelen++] = '\0';
1276 ipf_v4iptov5(v4, v5)
1280 v5->fi_v = v4->fi_v;
1281 v5->fi_p = v4->fi_p;
1282 v5->fi_xx = v4->fi_xx;
1283 v5->fi_tos = v4->fi_tos;
1284 v5->fi_ttl = v4->fi_ttl;
1285 v5->fi_p = v4->fi_p;
1286 v5->fi_optmsk = v4->fi_optmsk;
1287 v5->fi_src = v4->fi_src;
1288 v5->fi_dst = v4->fi_dst;
1289 v5->fi_secmsk = v4->ofi_secmsk;
1290 v5->fi_auth = v4->ofi_auth;
1291 v5->fi_flx = v4->fi_flx;
1292 v5->fi_tcpmsk = v4->fi_tcpmsk;
1296 ipf_v5iptov4(v5, v4)
1300 v4->fi_v = v5->fi_v;
1301 v4->fi_p = v5->fi_p;
1302 v4->fi_xx = v5->fi_xx;
1303 v4->fi_tos = v5->fi_tos;
1304 v4->fi_ttl = v5->fi_ttl;
1305 v4->fi_p = v5->fi_p;
1306 v4->fi_optmsk = v5->fi_optmsk;
1307 v4->fi_src = v5->fi_src;
1308 v4->fi_dst = v5->fi_dst;
1309 v4->ofi_secmsk = v5->fi_secmsk;
1310 v4->ofi_auth = v5->fi_auth;
1311 v4->fi_flx = v5->fi_flx;
1312 v4->fi_tcpmsk = v5->fi_tcpmsk;
1317 ipfv4tuctov5(v4, v5)
1321 v5->ftu_src.frp_cmp = v4->ftu_src.frp_cmp;
1322 v5->ftu_src.frp_port = v4->ftu_src.frp_port;
1323 v5->ftu_src.frp_top = v4->ftu_src.frp_top;
1324 v5->ftu_dst.frp_cmp = v4->ftu_dst.frp_cmp;
1325 v5->ftu_dst.frp_port = v4->ftu_dst.frp_port;
1326 v5->ftu_dst.frp_top = v4->ftu_dst.frp_top;
1331 ipfv5tuctov4(v5, v4)
1335 v4->ftu_src.frp_cmp = v5->ftu_src.frp_cmp;
1336 v4->ftu_src.frp_port = v5->ftu_src.frp_port;
1337 v4->ftu_src.frp_top = v5->ftu_src.frp_top;
1338 v4->ftu_dst.frp_cmp = v5->ftu_dst.frp_cmp;
1339 v4->ftu_dst.frp_port = v5->ftu_dst.frp_port;
1340 v4->ftu_dst.frp_top = v5->ftu_dst.frp_top;
1345 ipf_v4fripftov5(frp4, dst)
1351 frp = (fripf_t *)dst;
1353 ipf_v4iptov5(&frp4->fri_ip, &frp->fri_ip);
1354 ipf_v4iptov5(&frp4->fri_mip, &frp->fri_mip);
1355 frp->fri_icmpm = frp4->fri_icmpm;
1356 frp->fri_icmp = frp4->fri_icmp;
1357 frp->fri_tuc.ftu_tcpfm = frp4->fri_tuc.ftu_tcpfm;
1358 frp->fri_tuc.ftu_tcpf = frp4->fri_tuc.ftu_tcpf;
1359 ipfv4tuctov5(&frp4->fri_tuc, &frp->fri_tuc);
1360 frp->fri_satype = frp4->fri_satype;
1361 frp->fri_datype = frp4->fri_datype;
1362 frp->fri_sifpidx = frp4->fri_sifpidx;
1363 frp->fri_difpidx = frp4->fri_difpidx;
1369 ipf_v5fripftov4(frp, frp4)
1374 ipf_v5iptov4(&frp->fri_ip, &frp4->fri_ip);
1375 ipf_v5iptov4(&frp->fri_mip, &frp4->fri_mip);
1376 frp4->fri_icmpm = frp->fri_icmpm;
1377 frp4->fri_icmp = frp->fri_icmp;
1378 frp4->fri_tuc.ftu_tcpfm = frp->fri_tuc.ftu_tcpfm;
1379 frp4->fri_tuc.ftu_tcpf = frp->fri_tuc.ftu_tcpf;
1380 ipfv5tuctov4(&frp->fri_tuc, &frp4->fri_tuc);
1381 frp4->fri_satype = frp->fri_satype;
1382 frp4->fri_datype = frp->fri_datype;
1383 frp4->fri_sifpidx = frp->fri_sifpidx;
1384 frp4->fri_difpidx = frp->fri_difpidx;
1388 /* ------------------------------------------------------------------------ */
1389 /* ipf_in_compat is the first of two service routines. It is responsible for*/
1390 /* converting data structures from user space into what's required by the */
1391 /* kernel module. */
1392 /* ------------------------------------------------------------------------ */
1394 ipf_in_compat(softc, obj, ptr, size)
1395 ipf_main_softc_t *softc;
1406 switch (obj->ipfo_type)
1411 case IPFOBJ_FRENTRY :
1412 if (obj->ipfo_rev >= 4013400) {
1413 frentry_4_1_34_t *old;
1415 KMALLOC(old, frentry_4_1_34_t *);
1421 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1423 if (old->fr_type != FR_T_NONE &&
1424 old->fr_type != FR_T_IPF) {
1430 frentry_4_1_34_to_current(softc, old,
1436 } else if (obj->ipfo_rev >= 4011600) {
1437 frentry_4_1_16_t *old;
1439 KMALLOC(old, frentry_4_1_16_t *);
1445 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1447 if (old->fr_type != FR_T_NONE &&
1448 old->fr_type != FR_T_IPF) {
1454 frentry_4_1_16_to_current(softc, old,
1461 frentry_4_1_0_t *old;
1463 KMALLOC(old, frentry_4_1_0_t *);
1469 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1471 if (old->fr_type != FR_T_NONE &&
1472 old->fr_type != FR_T_IPF) {
1478 frentry_4_1_0_to_current(softc, old, ptr, size);
1486 case IPFOBJ_IPFSTAT :
1487 if (obj->ipfo_rev >= 4013300) {
1488 friostat_4_1_33_t *old;
1490 KMALLOC(old, friostat_4_1_33_t *);
1496 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1498 friostat_4_1_33_to_current(old, ptr);
1503 friostat_4_1_0_t *old;
1505 KMALLOC(old, friostat_4_1_0_t *);
1511 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1513 friostat_4_1_0_to_current(old, ptr);
1520 case IPFOBJ_IPFINFO : /* unused */
1524 if (obj->ipfo_rev >= 4011400) {
1525 ipnat_4_1_14_t *old;
1527 KMALLOC(old, ipnat_4_1_14_t *);
1533 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1535 ipnat_4_1_14_to_current(old, ptr, size);
1543 KMALLOC(old, ipnat_4_1_0_t *);
1549 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1551 ipnat_4_1_0_to_current(old, ptr, size);
1559 case IPFOBJ_NATSTAT :
1561 * Statistics are not copied in.
1565 case IPFOBJ_NATSAVE :
1566 if (obj->ipfo_rev >= 4011600) {
1567 nat_save_4_1_16_t *old16;
1569 KMALLOC(old16, nat_save_4_1_16_t *);
1570 if (old16 == NULL) {
1575 error = COPYIN(obj->ipfo_ptr, old16, sizeof(*old16));
1577 nat_save_4_1_16_to_current(softc, old16, ptr);
1582 } else if (obj->ipfo_rev >= 4011400) {
1583 nat_save_4_1_14_t *old14;
1585 KMALLOC(old14, nat_save_4_1_14_t *);
1586 if (old14 == NULL) {
1591 error = COPYIN(obj->ipfo_ptr, old14, sizeof(*old14));
1593 nat_save_4_1_14_to_current(softc, old14, ptr);
1598 } else if (obj->ipfo_rev >= 4010300) {
1599 nat_save_4_1_3_t *old3;
1601 KMALLOC(old3, nat_save_4_1_3_t *);
1607 error = COPYIN(obj->ipfo_ptr, old3, sizeof(*old3));
1609 nat_save_4_1_3_to_current(softc, old3, ptr);
1617 case IPFOBJ_STATESAVE :
1618 if (obj->ipfo_rev >= 4013400) {
1619 ipstate_save_4_1_34_t *old;
1621 KMALLOC(old, ipstate_save_4_1_34_t *);
1627 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1632 } else if (obj->ipfo_rev >= 4011600) {
1633 ipstate_save_4_1_16_t *old;
1635 KMALLOC(old, ipstate_save_4_1_16_t *);
1641 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1647 ipstate_save_4_1_0_t *old;
1649 KMALLOC(old, ipstate_save_4_1_0_t *);
1655 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1663 case IPFOBJ_IPSTATE :
1665 * This structure is not copied in by itself.
1669 case IPFOBJ_STATESTAT :
1671 * Statistics are not copied in.
1675 case IPFOBJ_FRAUTH :
1676 if (obj->ipfo_rev >= 4013200) {
1677 frauth_4_1_32_t *old32;
1679 KMALLOC(old32, frauth_4_1_32_t *);
1680 if (old32 == NULL) {
1685 error = COPYIN(obj->ipfo_ptr, old32, sizeof(*old32));
1687 frauth_4_1_32_to_current(old32, ptr);
1692 } else if (obj->ipfo_rev >= 4012900) {
1693 frauth_4_1_29_t *old29;
1695 KMALLOC(old29, frauth_4_1_29_t *);
1696 if (old29 == NULL) {
1701 error = COPYIN(obj->ipfo_ptr, old29, sizeof(*old29));
1703 frauth_4_1_29_to_current(old29, ptr);
1708 } else if (obj->ipfo_rev >= 4012400) {
1709 frauth_4_1_24_t *old24;
1711 KMALLOC(old24, frauth_4_1_24_t *);
1712 if (old24 == NULL) {
1717 error = COPYIN(obj->ipfo_ptr, old24, sizeof(*old24));
1719 frauth_4_1_24_to_current(old24, ptr);
1724 } else if (obj->ipfo_rev >= 4012300) {
1725 frauth_4_1_23_t *old23;
1727 KMALLOC(old23, frauth_4_1_23_t *);
1728 if (old23 == NULL) {
1733 error = COPYIN(obj->ipfo_ptr, old23, sizeof(*old23));
1735 frauth_4_1_23_to_current(old23, ptr);
1737 } else if (obj->ipfo_rev >= 4011100) {
1738 frauth_4_1_11_t *old11;
1740 KMALLOC(old11, frauth_4_1_11_t *);
1741 if (old11 == NULL) {
1746 error = COPYIN(obj->ipfo_ptr, old11, sizeof(*old11));
1748 frauth_4_1_11_to_current(old11, ptr);
1757 if (obj->ipfo_rev >= 4011400) {
1758 sz = sizeof(nat_4_1_14_t);
1759 } else if (obj->ipfo_rev >= 4010300) {
1760 sz = sizeof(nat_4_1_3_t);
1764 bzero(ptr, sizeof(nat_t));
1765 error = COPYIN(obj->ipfo_ptr, ptr, sz);
1772 if (obj->ipfo_rev < 5000000) {
1775 KMALLOC(old, fripf4_t *);
1781 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1783 ipf_v4fripftov5(old, ptr);
1794 /* ------------------------------------------------------------------------ */
1798 * flags is v4 flags, returns v5 flags.
1801 fr_frflags4to5(flags)
1806 switch (flags & 0xf) {
1820 nflags |= FR_PREAUTH;
1823 nflags |= FR_ACCOUNT;
1832 if (flags & 0x00010)
1834 if (flags & 0x00020)
1835 nflags |= FR_CALLNOW;
1836 if (flags & 0x00080)
1837 nflags |= FR_NOTSRCIP;
1838 if (flags & 0x00040)
1839 nflags |= FR_NOTDSTIP;
1840 if (flags & 0x00100)
1842 if (flags & 0x00200)
1843 nflags |= FR_KEEPFRAG;
1844 if (flags & 0x00400)
1845 nflags |= FR_KEEPSTATE;
1846 if (flags & 0x00800)
1847 nflags |= FR_FASTROUTE;
1848 if (flags & 0x01000)
1849 nflags |= FR_RETRST;
1850 if (flags & 0x02000)
1851 nflags |= FR_RETICMP;
1852 if (flags & 0x03000)
1853 nflags |= FR_FAKEICMP;
1854 if (flags & 0x04000)
1855 nflags |= FR_OUTQUE;
1856 if (flags & 0x08000)
1858 if (flags & 0x10000)
1859 nflags |= FR_LOGBODY;
1860 if (flags & 0x20000)
1861 nflags |= FR_LOGFIRST;
1862 if (flags & 0x40000)
1863 nflags |= FR_LOGORBLOCK;
1864 if (flags & 0x100000)
1865 nflags |= FR_FRSTRICT;
1866 if (flags & 0x200000)
1867 nflags |= FR_STSTRICT;
1868 if (flags & 0x400000)
1869 nflags |= FR_NEWISN;
1870 if (flags & 0x800000)
1871 nflags |= FR_NOICMPERR;
1872 if (flags & 0x1000000)
1873 nflags |= FR_STATESYNC;
1874 if (flags & 0x8000000)
1875 nflags |= FR_NOMATCH;
1876 if (flags & 0x40000000)
1877 nflags |= FR_COPIED;
1878 if (flags & 0x80000000)
1879 nflags |= FR_INACTIVE;
1885 frentry_4_1_34_to_current(softc, old, current, size)
1886 ipf_main_softc_t *softc;
1887 frentry_4_1_34_t *old;
1891 frentry_t *fr = (frentry_t *)current;
1893 fr->fr_comment = -1;
1894 fr->fr_ref = old->fr_ref;
1895 fr->fr_statecnt = old->fr_statecnt;
1896 fr->fr_hits = old->fr_hits;
1897 fr->fr_bytes = old->fr_bytes;
1898 fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
1899 fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
1900 bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
1901 fr->fr_func = old->fr_func;
1902 fr->fr_dsize = old->fr_dsize;
1903 fr->fr_pps = old->fr_pps;
1904 fr->fr_statemax = old->fr_statemax;
1905 fr->fr_flineno = old->fr_flineno;
1906 fr->fr_type = old->fr_type;
1907 fr->fr_flags = fr_frflags4to5(old->fr_flags);
1908 fr->fr_logtag = old->fr_logtag;
1909 fr->fr_collect = old->fr_collect;
1910 fr->fr_arg = old->fr_arg;
1911 fr->fr_loglevel = old->fr_loglevel;
1912 fr->fr_age[0] = old->fr_age[0];
1913 fr->fr_age[1] = old->fr_age[1];
1914 fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
1915 fr->fr_tifs[0].fd_type = FRD_NORMAL;
1916 fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
1917 fr->fr_tifs[1].fd_type = FRD_NORMAL;
1918 fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
1919 fr->fr_dif.fd_type = FRD_NORMAL;
1921 fr->fr_family = AF_INET;
1923 fr->fr_family = AF_INET6;
1924 fr->fr_icode = old->fr_icode;
1925 fr->fr_cksum = old->fr_cksum;
1927 fr->fr_ifnames[0] = -1;
1928 fr->fr_ifnames[1] = -1;
1929 fr->fr_ifnames[2] = -1;
1930 fr->fr_ifnames[3] = -1;
1931 fr->fr_dif.fd_name = -1;
1932 fr->fr_tifs[0].fd_name = -1;
1933 fr->fr_tifs[1].fd_name = -1;
1936 fr->fr_icmphead = -1;
1938 fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
1939 fr->fr_size += sizeof(fripf_t) + 16;
1940 fr->fr_size += 9; /* room for \0's */
1942 char *names = fr->fr_names;
1943 int nlen = fr->fr_namelen;
1946 if (old->fr_ifnames[0][0] != '\0') {
1947 fr->fr_ifnames[0] = nlen;
1948 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
1951 if (old->fr_ifnames[1][0] != '\0') {
1952 fr->fr_ifnames[1] = nlen;
1953 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
1956 if (old->fr_ifnames[2][0] != '\0') {
1957 fr->fr_ifnames[2] = nlen;
1958 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
1961 if (old->fr_ifnames[3][0] != '\0') {
1962 fr->fr_ifnames[3] = nlen;
1963 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
1966 if (old->fr_tifs[0].fd_ifname[0] != '\0') {
1967 fr->fr_tifs[0].fd_name = nlen;
1968 nlen = ipf_addfrstr(names, nlen,
1969 old->fr_tifs[0].fd_ifname,
1972 if (old->fr_tifs[1].fd_ifname[0] != '\0') {
1973 fr->fr_tifs[1].fd_name = nlen;
1974 nlen = ipf_addfrstr(names, nlen,
1975 old->fr_tifs[1].fd_ifname,
1978 if (old->fr_dif.fd_ifname[0] != '\0') {
1979 fr->fr_dif.fd_name = nlen;
1980 nlen = ipf_addfrstr(names, nlen,
1981 old->fr_dif.fd_ifname, LIFNAMSIZ);
1983 if (old->fr_group[0] != '\0') {
1984 fr->fr_group = nlen;
1985 nlen = ipf_addfrstr(names, nlen,
1986 old->fr_group, LIFNAMSIZ);
1988 if (old->fr_grhead[0] != '\0') {
1989 fr->fr_grhead = nlen;
1990 nlen = ipf_addfrstr(names, nlen,
1991 old->fr_grhead, LIFNAMSIZ);
1993 fr->fr_namelen = nlen;
1995 if (old->fr_type == FR_T_IPF) {
1996 int offset = fr->fr_namelen;
2000 obj.ipfo_type = IPFOBJ_FRIPF;
2001 obj.ipfo_rev = 4010100;
2002 obj.ipfo_ptr = old->fr_data;
2004 if ((offset & 7) != 0)
2005 offset += 8 - (offset & 7);
2006 error = ipf_in_compat(softc, &obj,
2007 fr->fr_names + offset, 0);
2009 fr->fr_data = fr->fr_names + offset;
2010 fr->fr_dsize = sizeof(fripf_t);
2017 frentry_4_1_16_to_current(softc, old, current, size)
2018 ipf_main_softc_t *softc;
2019 frentry_4_1_16_t *old;
2023 frentry_t *fr = (frentry_t *)current;
2025 fr->fr_comment = -1;
2026 fr->fr_ref = old->fr_ref;
2027 fr->fr_statecnt = old->fr_statecnt;
2028 fr->fr_hits = old->fr_hits;
2029 fr->fr_bytes = old->fr_bytes;
2030 fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
2031 fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
2032 bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
2033 fr->fr_func = old->fr_func;
2034 fr->fr_dsize = old->fr_dsize;
2035 fr->fr_pps = old->fr_pps;
2036 fr->fr_statemax = old->fr_statemax;
2037 fr->fr_flineno = old->fr_flineno;
2038 fr->fr_type = old->fr_type;
2039 fr->fr_flags = fr_frflags4to5(old->fr_flags);
2040 fr->fr_logtag = old->fr_logtag;
2041 fr->fr_collect = old->fr_collect;
2042 fr->fr_arg = old->fr_arg;
2043 fr->fr_loglevel = old->fr_loglevel;
2044 fr->fr_age[0] = old->fr_age[0];
2045 fr->fr_age[1] = old->fr_age[1];
2046 fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
2047 fr->fr_tifs[0].fd_type = FRD_NORMAL;
2048 fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
2049 fr->fr_tifs[1].fd_type = FRD_NORMAL;
2050 fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
2051 fr->fr_dif.fd_type = FRD_NORMAL;
2053 fr->fr_family = AF_INET;
2055 fr->fr_family = AF_INET6;
2056 fr->fr_icode = old->fr_icode;
2057 fr->fr_cksum = old->fr_cksum;
2059 fr->fr_ifnames[0] = -1;
2060 fr->fr_ifnames[1] = -1;
2061 fr->fr_ifnames[2] = -1;
2062 fr->fr_ifnames[3] = -1;
2063 fr->fr_dif.fd_name = -1;
2064 fr->fr_tifs[0].fd_name = -1;
2065 fr->fr_tifs[1].fd_name = -1;
2068 fr->fr_icmphead = -1;
2070 fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
2071 fr->fr_size += 9; /* room for \0's */
2073 char *names = fr->fr_names;
2074 int nlen = fr->fr_namelen;
2077 if (old->fr_ifnames[0][0] != '\0') {
2078 fr->fr_ifnames[0] = nlen;
2079 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
2082 if (old->fr_ifnames[1][0] != '\0') {
2083 fr->fr_ifnames[1] = nlen;
2084 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
2087 if (old->fr_ifnames[2][0] != '\0') {
2088 fr->fr_ifnames[2] = nlen;
2089 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
2092 if (old->fr_ifnames[3][0] != '\0') {
2093 fr->fr_ifnames[3] = nlen;
2094 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
2097 if (old->fr_tifs[0].fd_ifname[0] != '\0') {
2098 fr->fr_tifs[0].fd_name = nlen;
2099 nlen = ipf_addfrstr(names, nlen,
2100 old->fr_tifs[0].fd_ifname,
2103 if (old->fr_tifs[1].fd_ifname[0] != '\0') {
2104 fr->fr_tifs[1].fd_name = nlen;
2105 nlen = ipf_addfrstr(names, nlen,
2106 old->fr_tifs[1].fd_ifname,
2109 if (old->fr_dif.fd_ifname[0] != '\0') {
2110 fr->fr_dif.fd_name = nlen;
2111 nlen = ipf_addfrstr(names, nlen,
2112 old->fr_dif.fd_ifname, LIFNAMSIZ);
2114 if (old->fr_group[0] != '\0') {
2115 fr->fr_group = nlen;
2116 nlen = ipf_addfrstr(names, nlen,
2117 old->fr_group, LIFNAMSIZ);
2119 if (old->fr_grhead[0] != '\0') {
2120 fr->fr_grhead = nlen;
2121 nlen = ipf_addfrstr(names, nlen,
2122 old->fr_grhead, LIFNAMSIZ);
2124 fr->fr_namelen = nlen;
2126 if (old->fr_type == FR_T_IPF) {
2127 int offset = fr->fr_namelen;
2131 obj.ipfo_type = IPFOBJ_FRIPF;
2132 obj.ipfo_rev = 4010100;
2133 obj.ipfo_ptr = old->fr_data;
2135 if ((offset & 7) != 0)
2136 offset += 8 - (offset & 7);
2137 error = ipf_in_compat(softc, &obj,
2138 fr->fr_names + offset, 0);
2140 fr->fr_data = fr->fr_names + offset;
2141 fr->fr_dsize = sizeof(fripf_t);
2149 frentry_4_1_0_to_current(softc, old, current, size)
2150 ipf_main_softc_t *softc;
2151 frentry_4_1_0_t *old;
2155 frentry_t *fr = (frentry_t *)current;
2157 fr->fr_size = sizeof(*fr);
2158 fr->fr_comment = -1;
2159 fr->fr_ref = old->fr_ref;
2160 fr->fr_statecnt = old->fr_statecnt;
2161 fr->fr_hits = old->fr_hits;
2162 fr->fr_bytes = old->fr_bytes;
2163 fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
2164 fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
2165 bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
2166 fr->fr_func = old->fr_func;
2167 fr->fr_dsize = old->fr_dsize;
2168 fr->fr_pps = old->fr_pps;
2169 fr->fr_statemax = old->fr_statemax;
2170 fr->fr_flineno = old->fr_flineno;
2171 fr->fr_type = old->fr_type;
2172 fr->fr_flags = fr_frflags4to5(old->fr_flags);
2173 fr->fr_logtag = old->fr_logtag;
2174 fr->fr_collect = old->fr_collect;
2175 fr->fr_arg = old->fr_arg;
2176 fr->fr_loglevel = old->fr_loglevel;
2177 fr->fr_age[0] = old->fr_age[0];
2178 fr->fr_age[1] = old->fr_age[1];
2179 fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
2180 fr->fr_tifs[0].fd_type = FRD_NORMAL;
2181 fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
2182 fr->fr_tifs[1].fd_type = FRD_NORMAL;
2183 fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
2184 fr->fr_dif.fd_type = FRD_NORMAL;
2186 fr->fr_family = AF_INET;
2188 fr->fr_family = AF_INET6;
2189 fr->fr_icode = old->fr_icode;
2190 fr->fr_cksum = old->fr_cksum;
2192 fr->fr_ifnames[0] = -1;
2193 fr->fr_ifnames[1] = -1;
2194 fr->fr_ifnames[2] = -1;
2195 fr->fr_ifnames[3] = -1;
2196 fr->fr_dif.fd_name = -1;
2197 fr->fr_tifs[0].fd_name = -1;
2198 fr->fr_tifs[1].fd_name = -1;
2201 fr->fr_icmphead = -1;
2203 fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
2204 fr->fr_size += 9; /* room for \0's */
2206 char *names = fr->fr_names;
2207 int nlen = fr->fr_namelen;
2210 if (old->fr_ifnames[0][0] != '\0') {
2211 fr->fr_ifnames[0] = nlen;
2212 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
2215 if (old->fr_ifnames[1][0] != '\0') {
2216 fr->fr_ifnames[1] = nlen;
2217 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
2220 if (old->fr_ifnames[2][0] != '\0') {
2221 fr->fr_ifnames[2] = nlen;
2222 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
2225 if (old->fr_ifnames[3][0] != '\0') {
2226 fr->fr_ifnames[3] = nlen;
2227 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
2230 if (old->fr_tifs[0].fd_ifname[0] != '\0') {
2231 fr->fr_tifs[0].fd_name = nlen;
2232 nlen = ipf_addfrstr(names, nlen,
2233 old->fr_tifs[0].fd_ifname,
2236 if (old->fr_tifs[1].fd_ifname[0] != '\0') {
2237 fr->fr_tifs[1].fd_name = nlen;
2238 nlen = ipf_addfrstr(names, nlen,
2239 old->fr_tifs[1].fd_ifname,
2242 if (old->fr_dif.fd_ifname[0] != '\0') {
2243 fr->fr_dif.fd_name = nlen;
2244 nlen = ipf_addfrstr(names, nlen,
2245 old->fr_dif.fd_ifname, LIFNAMSIZ);
2247 if (old->fr_group[0] != '\0') {
2248 fr->fr_group = nlen;
2249 nlen = ipf_addfrstr(names, nlen,
2250 old->fr_group, LIFNAMSIZ);
2252 if (old->fr_grhead[0] != '\0') {
2253 fr->fr_grhead = nlen;
2254 nlen = ipf_addfrstr(names, nlen,
2255 old->fr_grhead, LIFNAMSIZ);
2257 fr->fr_namelen = nlen;
2259 if (old->fr_type == FR_T_IPF) {
2260 int offset = fr->fr_namelen;
2264 obj.ipfo_type = IPFOBJ_FRIPF;
2265 obj.ipfo_rev = 4010100;
2266 obj.ipfo_ptr = old->fr_data;
2268 if ((offset & 7) != 0)
2269 offset += 8 - (offset & 7);
2270 offset += 8 - (offset & 7);
2271 error = ipf_in_compat(softc, &obj,
2272 fr->fr_names + offset, 0);
2274 fr->fr_data = fr->fr_names + offset;
2275 fr->fr_dsize = sizeof(fripf_t);
2283 friostat_4_1_33_to_current(old, current)
2284 friostat_4_1_33_t *old;
2287 friostat_t *fiop = (friostat_t *)current;
2289 bcopy(&old->of_st[0], &fiop->f_st[0].fr_pass, sizeof(old->of_st[0]));
2290 bcopy(&old->of_st[1], &fiop->f_st[1].fr_pass, sizeof(old->of_st[1]));
2292 fiop->f_ipf[0][0] = old->f_ipf[0][0];
2293 fiop->f_ipf[0][1] = old->f_ipf[0][1];
2294 fiop->f_ipf[1][0] = old->f_ipf[1][0];
2295 fiop->f_ipf[1][1] = old->f_ipf[1][1];
2296 fiop->f_acct[0][0] = old->f_acct[0][0];
2297 fiop->f_acct[0][1] = old->f_acct[0][1];
2298 fiop->f_acct[1][0] = old->f_acct[1][0];
2299 fiop->f_acct[1][1] = old->f_acct[1][1];
2300 fiop->f_auth = fiop->f_auth;
2301 bcopy(&old->f_groups, &fiop->f_groups, sizeof(old->f_groups));
2302 bcopy(&old->f_froute, &fiop->f_froute, sizeof(old->f_froute));
2303 fiop->f_ticks = old->f_ticks;
2304 bcopy(&old->f_locks, &fiop->f_locks, sizeof(old->f_locks));
2305 fiop->f_defpass = old->f_defpass;
2306 fiop->f_active = old->f_active;
2307 fiop->f_running = old->f_running;
2308 fiop->f_logging = old->f_logging;
2309 fiop->f_features = old->f_features;
2310 bcopy(old->f_version, fiop->f_version, sizeof(old->f_version));
2315 friostat_4_1_0_to_current(old, current)
2316 friostat_4_1_0_t *old;
2319 friostat_t *fiop = (friostat_t *)current;
2321 bcopy(&old->of_st[0], &fiop->f_st[0].fr_pass, sizeof(old->of_st[0]));
2322 bcopy(&old->of_st[1], &fiop->f_st[1].fr_pass, sizeof(old->of_st[1]));
2324 fiop->f_ipf[0][0] = old->f_ipf[0][0];
2325 fiop->f_ipf[0][1] = old->f_ipf[0][1];
2326 fiop->f_ipf[1][0] = old->f_ipf[1][0];
2327 fiop->f_ipf[1][1] = old->f_ipf[1][1];
2328 fiop->f_acct[0][0] = old->f_acct[0][0];
2329 fiop->f_acct[0][1] = old->f_acct[0][1];
2330 fiop->f_acct[1][0] = old->f_acct[1][0];
2331 fiop->f_acct[1][1] = old->f_acct[1][1];
2332 fiop->f_auth = fiop->f_auth;
2333 bcopy(&old->f_groups, &fiop->f_groups, sizeof(old->f_groups));
2334 bcopy(&old->f_froute, &fiop->f_froute, sizeof(old->f_froute));
2335 fiop->f_ticks = old->f_ticks;
2336 bcopy(&old->f_locks, &fiop->f_locks, sizeof(old->f_locks));
2337 fiop->f_defpass = old->f_defpass;
2338 fiop->f_active = old->f_active;
2339 fiop->f_running = old->f_running;
2340 fiop->f_logging = old->f_logging;
2341 fiop->f_features = old->f_features;
2342 bcopy(old->f_version, fiop->f_version, sizeof(old->f_version));
2347 ipnat_4_1_14_to_current(old, current, size)
2348 ipnat_4_1_14_t *old;
2352 ipnat_t *np = (ipnat_t *)current;
2354 np->in_space = old->in_space;
2355 np->in_hv[0] = old->in_hv;
2356 np->in_hv[1] = old->in_hv;
2357 np->in_flineno = old->in_flineno;
2358 if (old->in_redir == NAT_REDIRECT)
2359 np->in_dpnext = old->in_pnext;
2361 np->in_spnext = old->in_pnext;
2362 np->in_v[0] = old->in_v;
2363 np->in_v[1] = old->in_v;
2364 np->in_flags = old->in_flags;
2365 np->in_mssclamp = old->in_mssclamp;
2366 np->in_age[0] = old->in_age[0];
2367 np->in_age[1] = old->in_age[1];
2368 np->in_redir = old->in_redir;
2369 np->in_pr[0] = old->in_p;
2370 np->in_pr[1] = old->in_p;
2371 if (np->in_redir == NAT_REDIRECT) {
2372 np->in_ndst.na_nextaddr = old->in_next6;
2373 np->in_ndst.na_addr[0] = old->in_in[0];
2374 np->in_ndst.na_addr[1] = old->in_in[1];
2375 np->in_ndst.na_atype = FRI_NORMAL;
2376 np->in_odst.na_addr[0] = old->in_out[0];
2377 np->in_odst.na_addr[1] = old->in_out[1];
2378 np->in_odst.na_atype = FRI_NORMAL;
2379 np->in_osrc.na_addr[0] = old->in_src[0];
2380 np->in_osrc.na_addr[1] = old->in_src[1];
2381 np->in_osrc.na_atype = FRI_NORMAL;
2383 np->in_nsrc.na_nextaddr = old->in_next6;
2384 np->in_nsrc.na_addr[0] = old->in_out[0];
2385 np->in_nsrc.na_addr[1] = old->in_out[1];
2386 np->in_nsrc.na_atype = FRI_NORMAL;
2387 np->in_osrc.na_addr[0] = old->in_in[0];
2388 np->in_osrc.na_addr[1] = old->in_in[1];
2389 np->in_osrc.na_atype = FRI_NORMAL;
2390 np->in_odst.na_addr[0] = old->in_src[0];
2391 np->in_odst.na_addr[1] = old->in_src[1];
2392 np->in_odst.na_atype = FRI_NORMAL;
2394 ipfv4tuctov5(&old->in_tuc, &np->in_tuc);
2395 if (np->in_redir == NAT_REDIRECT) {
2396 np->in_dpmin = old->in_port[0];
2397 np->in_dpmax = old->in_port[1];
2399 np->in_spmin = old->in_port[0];
2400 np->in_spmax = old->in_port[1];
2402 np->in_ppip = old->in_ppip;
2403 np->in_ippip = old->in_ippip;
2404 np->in_tag = old->in_tag;
2408 np->in_ifnames[0] = -1;
2409 np->in_ifnames[1] = -1;
2412 np->in_size = sizeof(*np);
2413 np->in_size += LIFNAMSIZ * 2 + APR_LABELLEN;
2416 int nlen = np->in_namelen;
2417 char *names = np->in_names;
2419 if (old->in_ifnames[0][0] != '\0') {
2420 np->in_ifnames[0] = nlen;
2421 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[0],
2424 if (old->in_ifnames[1][0] != '\0') {
2425 np->in_ifnames[0] = nlen;
2426 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[1],
2429 if (old->in_plabel[0] != '\0') {
2430 np->in_plabel = nlen;
2431 nlen = ipf_addfrstr(names, nlen, old->in_plabel,
2434 np->in_namelen = nlen;
2441 ipnat_4_1_0_to_current(old, current, size)
2446 ipnat_t *np = (ipnat_t *)current;
2448 np->in_space = old->in_space;
2449 np->in_hv[0] = old->in_hv;
2450 np->in_hv[1] = old->in_hv;
2451 np->in_flineno = old->in_flineno;
2452 if (old->in_redir == NAT_REDIRECT)
2453 np->in_dpnext = old->in_pnext;
2455 np->in_spnext = old->in_pnext;
2456 np->in_v[0] = old->in_v;
2457 np->in_v[1] = old->in_v;
2458 np->in_flags = old->in_flags;
2459 np->in_mssclamp = old->in_mssclamp;
2460 np->in_age[0] = old->in_age[0];
2461 np->in_age[1] = old->in_age[1];
2462 np->in_redir = old->in_redir;
2463 np->in_pr[0] = old->in_p;
2464 np->in_pr[1] = old->in_p;
2465 if (np->in_redir == NAT_REDIRECT) {
2466 np->in_ndst.na_nextaddr = old->in_next6;
2467 bcopy(&old->in_in, &np->in_ndst.na_addr, sizeof(old->in_in));
2468 bcopy(&old->in_out, &np->in_odst.na_addr, sizeof(old->in_out));
2469 bcopy(&old->in_src, &np->in_osrc.na_addr, sizeof(old->in_src));
2471 np->in_nsrc.na_nextaddr = old->in_next6;
2472 bcopy(&old->in_in, &np->in_osrc.na_addr, sizeof(old->in_in));
2473 bcopy(&old->in_out, &np->in_nsrc.na_addr, sizeof(old->in_out));
2474 bcopy(&old->in_src, &np->in_odst.na_addr, sizeof(old->in_src));
2476 ipfv4tuctov5(&old->in_tuc, &np->in_tuc);
2477 if (np->in_redir == NAT_REDIRECT) {
2478 np->in_dpmin = old->in_port[0];
2479 np->in_dpmax = old->in_port[1];
2481 np->in_spmin = old->in_port[0];
2482 np->in_spmax = old->in_port[1];
2484 np->in_ppip = old->in_ppip;
2485 np->in_ippip = old->in_ippip;
2486 bcopy(&old->in_tag, &np->in_tag, sizeof(np->in_tag));
2490 np->in_ifnames[0] = -1;
2491 np->in_ifnames[1] = -1;
2494 np->in_size = sizeof(*np);
2495 np->in_size += LIFNAMSIZ * 2 + APR_LABELLEN;
2498 int nlen = np->in_namelen;
2499 char *names = np->in_names;
2501 if (old->in_ifnames[0][0] != '\0') {
2502 np->in_ifnames[0] = nlen;
2503 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[0],
2506 if (old->in_ifnames[1][0] != '\0') {
2507 np->in_ifnames[0] = nlen;
2508 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[1],
2511 if (old->in_plabel[0] != '\0') {
2512 np->in_plabel = nlen;
2513 nlen = ipf_addfrstr(names, nlen, old->in_plabel,
2516 np->in_namelen = nlen;
2523 frauth_4_1_32_to_current(old, current)
2524 frauth_4_1_32_t *old;
2527 frauth_t *fra = (frauth_t *)current;
2529 fra->fra_age = old->fra_age;
2530 fra->fra_len = old->fra_len;
2531 fra->fra_index = old->fra_index;
2532 fra->fra_pass = old->fra_pass;
2533 fr_info_4_1_32_to_current(&old->fra_info, &fra->fra_info);
2534 fra->fra_buf = old->fra_buf;
2535 fra->fra_flx = old->fra_flx;
2537 fra->fra_q = old->fra_q;
2538 fra->fra_m = old->fra_m;
2544 frauth_4_1_29_to_current(old, current)
2545 frauth_4_1_29_t *old;
2548 frauth_t *fra = (frauth_t *)current;
2550 fra->fra_age = old->fra_age;
2551 fra->fra_len = old->fra_len;
2552 fra->fra_index = old->fra_index;
2553 fra->fra_pass = old->fra_pass;
2554 fr_info_4_1_24_to_current(&old->fra_info, &fra->fra_info);
2555 fra->fra_buf = old->fra_buf;
2556 fra->fra_flx = old->fra_flx;
2558 fra->fra_q = old->fra_q;
2559 fra->fra_m = old->fra_m;
2565 frauth_4_1_24_to_current(old, current)
2566 frauth_4_1_24_t *old;
2569 frauth_t *fra = (frauth_t *)current;
2571 fra->fra_age = old->fra_age;
2572 fra->fra_len = old->fra_len;
2573 fra->fra_index = old->fra_index;
2574 fra->fra_pass = old->fra_pass;
2575 fr_info_4_1_24_to_current(&old->fra_info, &fra->fra_info);
2576 fra->fra_buf = old->fra_buf;
2578 fra->fra_q = old->fra_q;
2579 fra->fra_m = old->fra_m;
2585 frauth_4_1_23_to_current(old, current)
2586 frauth_4_1_23_t *old;
2589 frauth_t *fra = (frauth_t *)current;
2591 fra->fra_age = old->fra_age;
2592 fra->fra_len = old->fra_len;
2593 fra->fra_index = old->fra_index;
2594 fra->fra_pass = old->fra_pass;
2595 fr_info_4_1_23_to_current(&old->fra_info, &fra->fra_info);
2596 fra->fra_buf = old->fra_buf;
2598 fra->fra_q = old->fra_q;
2599 fra->fra_m = old->fra_m;
2605 frauth_4_1_11_to_current(old, current)
2606 frauth_4_1_11_t *old;
2609 frauth_t *fra = (frauth_t *)current;
2611 fra->fra_age = old->fra_age;
2612 fra->fra_len = old->fra_len;
2613 fra->fra_index = old->fra_index;
2614 fra->fra_pass = old->fra_pass;
2615 fr_info_4_1_11_to_current(&old->fra_info, &fra->fra_info);
2616 fra->fra_buf = old->fra_buf;
2618 fra->fra_q = old->fra_q;
2619 fra->fra_m = old->fra_m;
2625 fr_info_4_1_32_to_current(old, current)
2626 fr_info_4_1_32_t *old;
2629 fr_info_t *fin = (fr_info_t *)current;
2631 fin->fin_ifp = old->fin_ifp;
2632 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2633 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2634 fin->fin_out = old->fin_out;
2635 fin->fin_rev = old->fin_rev;
2636 fin->fin_hlen = old->fin_hlen;
2637 fin->fin_tcpf = old->ofin_tcpf;
2638 fin->fin_icode = old->fin_icode;
2639 fin->fin_rule = old->fin_rule;
2640 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2641 fin->fin_fr = old->fin_fr;
2642 fin->fin_dp = old->fin_dp;
2643 fin->fin_dlen = old->fin_dlen;
2644 fin->fin_plen = old->fin_plen;
2645 fin->fin_ipoff = old->fin_ipoff;
2646 fin->fin_id = old->fin_id;
2647 fin->fin_off = old->fin_off;
2648 fin->fin_depth = old->fin_depth;
2649 fin->fin_error = old->fin_error;
2650 fin->fin_cksum = old->fin_cksum;
2651 fin->fin_nattag = old->fin_nattag;
2652 fin->fin_ip = old->ofin_ip;
2653 fin->fin_mp = old->fin_mp;
2654 fin->fin_m = old->fin_m;
2656 fin->fin_qfm = old->fin_qfm;
2657 fin->fin_qpi = old->fin_qpi;
2663 fr_info_4_1_24_to_current(old, current)
2664 fr_info_4_1_24_t *old;
2667 fr_info_t *fin = (fr_info_t *)current;
2669 fin->fin_ifp = old->fin_ifp;
2670 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2671 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2672 fin->fin_out = old->fin_out;
2673 fin->fin_rev = old->fin_rev;
2674 fin->fin_hlen = old->fin_hlen;
2675 fin->fin_tcpf = old->ofin_tcpf;
2676 fin->fin_icode = old->fin_icode;
2677 fin->fin_rule = old->fin_rule;
2678 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2679 fin->fin_fr = old->fin_fr;
2680 fin->fin_dp = old->fin_dp;
2681 fin->fin_dlen = old->fin_dlen;
2682 fin->fin_plen = old->fin_plen;
2683 fin->fin_ipoff = old->fin_ipoff;
2684 fin->fin_id = old->fin_id;
2685 fin->fin_off = old->fin_off;
2686 fin->fin_depth = old->fin_depth;
2687 fin->fin_error = old->fin_error;
2688 fin->fin_cksum = old->fin_cksum;
2689 fin->fin_nattag = old->fin_nattag;
2690 fin->fin_ip = old->ofin_ip;
2691 fin->fin_mp = old->fin_mp;
2692 fin->fin_m = old->fin_m;
2694 fin->fin_qfm = old->fin_qfm;
2695 fin->fin_qpi = old->fin_qpi;
2701 fr_info_4_1_23_to_current(old, current)
2702 fr_info_4_1_23_t *old;
2705 fr_info_t *fin = (fr_info_t *)current;
2707 fin->fin_ifp = old->fin_ifp;
2708 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2709 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2710 fin->fin_out = old->fin_out;
2711 fin->fin_rev = old->fin_rev;
2712 fin->fin_hlen = old->fin_hlen;
2713 fin->fin_tcpf = old->ofin_tcpf;
2714 fin->fin_icode = old->fin_icode;
2715 fin->fin_rule = old->fin_rule;
2716 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2717 fin->fin_fr = old->fin_fr;
2718 fin->fin_dp = old->fin_dp;
2719 fin->fin_dlen = old->fin_dlen;
2720 fin->fin_plen = old->fin_plen;
2721 fin->fin_ipoff = old->fin_ipoff;
2722 fin->fin_id = old->fin_id;
2723 fin->fin_off = old->fin_off;
2724 fin->fin_depth = old->fin_depth;
2725 fin->fin_error = old->fin_error;
2726 fin->fin_nattag = old->fin_nattag;
2727 fin->fin_ip = old->ofin_ip;
2728 fin->fin_mp = old->fin_mp;
2729 fin->fin_m = old->fin_m;
2731 fin->fin_qfm = old->fin_qfm;
2732 fin->fin_qpi = old->fin_qpi;
2738 fr_info_4_1_11_to_current(old, current)
2739 fr_info_4_1_11_t *old;
2742 fr_info_t *fin = (fr_info_t *)current;
2744 fin->fin_ifp = old->fin_ifp;
2745 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2746 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2747 fin->fin_out = old->fin_out;
2748 fin->fin_rev = old->fin_rev;
2749 fin->fin_hlen = old->fin_hlen;
2750 fin->fin_tcpf = old->ofin_tcpf;
2751 fin->fin_icode = old->fin_icode;
2752 fin->fin_rule = old->fin_rule;
2753 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2754 fin->fin_fr = old->fin_fr;
2755 fin->fin_dp = old->fin_dp;
2756 fin->fin_dlen = old->fin_dlen;
2757 fin->fin_plen = old->fin_plen;
2758 fin->fin_ipoff = old->fin_ipoff;
2759 fin->fin_id = old->fin_id;
2760 fin->fin_off = old->fin_off;
2761 fin->fin_depth = old->fin_depth;
2762 fin->fin_error = old->fin_error;
2763 fin->fin_nattag = old->fin_nattag;
2764 fin->fin_ip = old->ofin_ip;
2765 fin->fin_mp = old->fin_mp;
2766 fin->fin_m = old->fin_m;
2768 fin->fin_qfm = old->fin_qfm;
2769 fin->fin_qpi = old->fin_qpi;
2775 nat_4_1_3_to_current(nat_4_1_3_t *old, nat_t *current)
2777 bzero((void *)current, sizeof(*current));
2778 bcopy((void *)old, (void *)current, sizeof(*old));
2783 nat_4_1_14_to_current(nat_4_1_14_t *old, nat_t *current)
2785 bzero((void *)current, sizeof(*current));
2786 bcopy((void *)old, (void *)current, sizeof(*old));
2791 nat_save_4_1_16_to_current(softc, old, current)
2792 ipf_main_softc_t *softc;
2793 nat_save_4_1_16_t *old;
2796 nat_save_t *nats = (nat_save_t *)current;
2798 nats->ipn_next = old->ipn_next;
2799 nat_4_1_14_to_current(&old->ipn_nat, &nats->ipn_nat);
2800 bcopy(&old->ipn_ipnat, &nats->ipn_ipnat, sizeof(old->ipn_ipnat));
2801 frentry_4_1_16_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
2802 nats->ipn_dsize = old->ipn_dsize;
2803 bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
2808 nat_save_4_1_14_to_current(softc, old, current)
2809 ipf_main_softc_t *softc;
2810 nat_save_4_1_14_t *old;
2813 nat_save_t *nats = (nat_save_t *)current;
2815 nats->ipn_next = old->ipn_next;
2816 nat_4_1_14_to_current(&old->ipn_nat, &nats->ipn_nat);
2817 bcopy(&old->ipn_ipnat, &nats->ipn_ipnat, sizeof(old->ipn_ipnat));
2818 frentry_4_1_0_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
2819 nats->ipn_dsize = old->ipn_dsize;
2820 bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
2825 nat_save_4_1_3_to_current(softc, old, current)
2826 ipf_main_softc_t *softc;
2827 nat_save_4_1_3_t *old;
2830 nat_save_t *nats = (nat_save_t *)current;
2832 nats->ipn_next = old->ipn_next;
2833 nat_4_1_3_to_current(&old->ipn_nat, &nats->ipn_nat);
2834 ipnat_4_1_0_to_current(&old->ipn_ipnat, &nats->ipn_ipnat, 0);
2835 frentry_4_1_0_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
2836 nats->ipn_dsize = old->ipn_dsize;
2837 bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
2842 natstat_current_to_4_1_32(current, old)
2844 natstat_4_1_32_t *old;
2846 natstat_t *ns = (natstat_t *)current;
2848 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
2849 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
2850 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2851 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
2852 old->ns_expire = ns->ns_expire;
2853 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2854 old->ns_logged = ns->ns_log_ok;
2855 old->ns_logfail = ns->ns_log_fail;
2856 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
2857 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
2858 old->ns_addtrpnt = ns->ns_addtrpnt;
2859 old->ns_table[0] = ns->ns_side[0].ns_table;
2860 old->ns_table[1] = ns->ns_side[1].ns_table;
2861 old->ns_maptable = NULL;
2862 old->ns_list = ns->ns_list;
2863 old->ns_apslist = NULL;
2864 old->ns_wilds = ns->ns_wilds;
2865 old->ns_nattab_sz = ns->ns_nattab_sz;
2866 old->ns_nattab_max = ns->ns_nattab_max;
2867 old->ns_rultab_sz = ns->ns_rultab_sz;
2868 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
2869 old->ns_trpntab_sz = ns->ns_trpntab_sz;
2870 old->ns_hostmap_sz = 0;
2871 old->ns_instances = ns->ns_instances;
2872 old->ns_maplist = ns->ns_maplist;
2873 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
2874 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
2875 old->ns_ticks = ns->ns_ticks;
2876 old->ns_orphans = ns->ns_orphans;
2877 old->ns_uncreate[0][0] = ns->ns_side[0].ns_uncreate[0];
2878 old->ns_uncreate[0][1] = ns->ns_side[0].ns_uncreate[1];
2879 old->ns_uncreate[1][0] = ns->ns_side[1].ns_uncreate[0];
2880 old->ns_uncreate[1][1] = ns->ns_side[1].ns_uncreate[1];
2885 natstat_current_to_4_1_27(current, old)
2887 natstat_4_1_27_t *old;
2889 natstat_t *ns = (natstat_t *)current;
2891 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
2892 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
2893 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2894 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
2895 old->ns_expire = ns->ns_expire;
2896 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2897 old->ns_logged = ns->ns_log_ok;
2898 old->ns_logfail = ns->ns_log_fail;
2899 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
2900 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
2901 old->ns_addtrpnt = ns->ns_addtrpnt;
2902 old->ns_table[0] = ns->ns_side[0].ns_table;
2903 old->ns_table[1] = ns->ns_side[1].ns_table;
2904 old->ns_maptable = NULL;
2905 old->ns_list = ns->ns_list;
2906 old->ns_apslist = NULL;
2907 old->ns_wilds = ns->ns_wilds;
2908 old->ns_nattab_sz = ns->ns_nattab_sz;
2909 old->ns_nattab_max = ns->ns_nattab_max;
2910 old->ns_rultab_sz = ns->ns_rultab_sz;
2911 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
2912 old->ns_trpntab_sz = ns->ns_trpntab_sz;
2913 old->ns_hostmap_sz = 0;
2914 old->ns_instances = ns->ns_instances;
2915 old->ns_maplist = ns->ns_maplist;
2916 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
2917 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
2918 old->ns_ticks = ns->ns_ticks;
2919 old->ns_orphans = ns->ns_orphans;
2924 natstat_current_to_4_1_16(current, old)
2926 natstat_4_1_16_t *old;
2928 natstat_t *ns = (natstat_t *)current;
2930 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
2931 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
2932 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2933 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
2934 old->ns_expire = ns->ns_expire;
2935 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2936 old->ns_logged = ns->ns_log_ok;
2937 old->ns_logfail = ns->ns_log_fail;
2938 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
2939 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
2940 old->ns_addtrpnt = ns->ns_addtrpnt;
2941 old->ns_table[0] = ns->ns_side[0].ns_table;
2942 old->ns_table[1] = ns->ns_side[1].ns_table;
2943 old->ns_maptable = NULL;
2944 old->ns_list = ns->ns_list;
2945 old->ns_apslist = NULL;
2946 old->ns_wilds = ns->ns_wilds;
2947 old->ns_nattab_sz = ns->ns_nattab_sz;
2948 old->ns_nattab_max = ns->ns_nattab_max;
2949 old->ns_rultab_sz = ns->ns_rultab_sz;
2950 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
2951 old->ns_trpntab_sz = ns->ns_trpntab_sz;
2952 old->ns_hostmap_sz = 0;
2953 old->ns_instances = ns->ns_instances;
2954 old->ns_maplist = ns->ns_maplist;
2955 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
2956 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
2957 old->ns_ticks = ns->ns_ticks;
2962 natstat_current_to_4_1_0(current, old)
2964 natstat_4_1_0_t *old;
2966 natstat_t *ns = (natstat_t *)current;
2968 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
2969 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
2970 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2971 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
2972 old->ns_expire = ns->ns_expire;
2973 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2974 old->ns_logged = ns->ns_log_ok;
2975 old->ns_logfail = ns->ns_log_fail;
2976 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
2977 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
2978 old->ns_addtrpnt = ns->ns_addtrpnt;
2979 old->ns_table[0] = ns->ns_side[0].ns_table;
2980 old->ns_table[1] = ns->ns_side[1].ns_table;
2981 old->ns_maptable = NULL;
2982 old->ns_list = ns->ns_list;
2983 old->ns_apslist = NULL;
2984 old->ns_wilds = ns->ns_wilds;
2985 old->ns_nattab_sz = ns->ns_nattab_sz;
2986 old->ns_nattab_max = ns->ns_nattab_max;
2987 old->ns_rultab_sz = ns->ns_rultab_sz;
2988 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
2989 old->ns_trpntab_sz = ns->ns_trpntab_sz;
2990 old->ns_hostmap_sz = 0;
2991 old->ns_instances = ns->ns_instances;
2992 old->ns_maplist = ns->ns_maplist;
2993 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
2994 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
2999 ipstate_save_current_to_4_1_16(current, old)
3001 ipstate_save_4_1_16_t *old;
3003 ipstate_save_t *ips = (ipstate_save_t *)current;
3005 old->ips_next = ips->ips_next;
3006 ipstate_current_to_4_1_0(&ips->ips_is, &old->ips_is);
3007 frentry_current_to_4_1_16(&ips->ips_fr, &old->ips_fr);
3012 ipstate_save_current_to_4_1_0(current, old)
3014 ipstate_save_4_1_0_t *old;
3016 ipstate_save_t *ips = (ipstate_save_t *)current;
3018 old->ips_next = ips->ips_next;
3019 ipstate_current_to_4_1_0(&ips->ips_is, &old->ips_is);
3020 frentry_current_to_4_1_0(&ips->ips_fr, &old->ips_fr);
3025 ipf_out_compat(softc, obj, ptr)
3026 ipf_main_softc_t *softc;
3036 switch (obj->ipfo_type)
3041 case IPFOBJ_FRENTRY :
3042 if (obj->ipfo_rev >= 4013400) {
3043 frentry_4_1_34_t *old;
3045 KMALLOC(old, frentry_4_1_34_t *);
3051 frentry_current_to_4_1_34(ptr, old);
3052 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3053 if (error == 0 && old->fr_dsize > 0) {
3054 char *dst = obj->ipfo_ptr;
3057 dst += sizeof(*old);
3058 error = COPYOUT(fr->fr_data, dst,
3065 obj->ipfo_size = sizeof(*old);
3066 } else if (obj->ipfo_rev >= 4011600) {
3067 frentry_4_1_16_t *old;
3069 KMALLOC(old, frentry_4_1_16_t *);
3075 frentry_current_to_4_1_16(ptr, old);
3076 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3081 obj->ipfo_size = sizeof(*old);
3083 frentry_4_1_0_t *old;
3085 KMALLOC(old, frentry_4_1_0_t *);
3091 frentry_current_to_4_1_0(ptr, old);
3092 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3097 obj->ipfo_size = sizeof(*old);
3101 case IPFOBJ_IPFSTAT :
3102 if (obj->ipfo_rev >= 4013300) {
3103 friostat_4_1_33_t *old;
3105 KMALLOC(old, friostat_4_1_33_t *);
3111 friostat_current_to_4_1_33(ptr, old, obj->ipfo_rev);
3112 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3118 friostat_4_1_0_t *old;
3120 KMALLOC(old, friostat_4_1_0_t *);
3126 friostat_current_to_4_1_0(ptr, old, obj->ipfo_rev);
3127 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3135 case IPFOBJ_IPFINFO : /* unused */
3139 if (obj->ipfo_rev >= 4011400) {
3140 ipnat_4_1_14_t *old;
3142 KMALLOC(old, ipnat_4_1_14_t *);
3148 ipnat_current_to_4_1_14(ptr, old);
3149 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3157 KMALLOC(old, ipnat_4_1_0_t *);
3163 ipnat_current_to_4_1_0(ptr, old);
3164 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3172 case IPFOBJ_NATSTAT :
3173 if (obj->ipfo_rev >= 4013200) {
3174 natstat_4_1_32_t *old;
3176 KMALLOC(old, natstat_4_1_32_t *);
3182 natstat_current_to_4_1_32(ptr, old);
3183 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3188 } else if (obj->ipfo_rev >= 4012700) {
3189 natstat_4_1_27_t *old;
3191 KMALLOC(old, natstat_4_1_27_t *);
3197 natstat_current_to_4_1_27(ptr, old);
3198 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3203 } else if (obj->ipfo_rev >= 4011600) {
3204 natstat_4_1_16_t *old;
3206 KMALLOC(old, natstat_4_1_16_t *);
3212 natstat_current_to_4_1_16(ptr, old);
3213 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3219 natstat_4_1_0_t *old;
3221 KMALLOC(old, natstat_4_1_0_t *);
3227 natstat_current_to_4_1_0(ptr, old);
3228 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3236 case IPFOBJ_STATESAVE :
3237 if (obj->ipfo_rev >= 4011600) {
3238 ipstate_save_4_1_16_t *old;
3240 KMALLOC(old, ipstate_save_4_1_16_t *);
3246 ipstate_save_current_to_4_1_16(ptr, old);
3247 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3253 ipstate_save_4_1_0_t *old;
3255 KMALLOC(old, ipstate_save_4_1_0_t *);
3261 ipstate_save_current_to_4_1_0(ptr, old);
3262 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3270 case IPFOBJ_NATSAVE :
3271 if (obj->ipfo_rev >= 4011600) {
3272 nat_save_4_1_16_t *old16;
3274 KMALLOC(old16, nat_save_4_1_16_t *);
3275 if (old16 == NULL) {
3280 nat_save_current_to_4_1_16(ptr, old16);
3281 error = COPYOUT(&old16, obj->ipfo_ptr, sizeof(*old16));
3286 } else if (obj->ipfo_rev >= 4011400) {
3287 nat_save_4_1_14_t *old14;
3289 KMALLOC(old14, nat_save_4_1_14_t *);
3290 if (old14 == NULL) {
3295 nat_save_current_to_4_1_14(ptr, old14);
3296 error = COPYOUT(&old14, obj->ipfo_ptr, sizeof(*old14));
3301 } else if (obj->ipfo_rev >= 4010300) {
3302 nat_save_4_1_3_t *old3;
3304 KMALLOC(old3, nat_save_4_1_3_t *);
3310 nat_save_current_to_4_1_3(ptr, old3);
3311 error = COPYOUT(&old3, obj->ipfo_ptr, sizeof(*old3));
3319 case IPFOBJ_IPSTATE :
3320 if (obj->ipfo_rev >= 4011600) {
3321 ipstate_4_1_16_t *old;
3323 KMALLOC(old, ipstate_4_1_16_t *);
3329 ipstate_current_to_4_1_16(ptr, old);
3330 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3336 ipstate_4_1_0_t *old;
3338 KMALLOC(old, ipstate_4_1_0_t *);
3344 ipstate_current_to_4_1_0(ptr, old);
3345 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3353 case IPFOBJ_STATESTAT :
3354 if (obj->ipfo_rev >= 4012100) {
3355 ips_stat_4_1_21_t *old;
3357 KMALLOC(old, ips_stat_4_1_21_t *);
3363 ips_stat_current_to_4_1_21(ptr, old);
3364 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3370 ips_stat_4_1_0_t *old;
3372 KMALLOC(old, ips_stat_4_1_0_t *);
3378 ips_stat_current_to_4_1_0(ptr, old);
3379 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3387 case IPFOBJ_FRAUTH :
3388 if (obj->ipfo_rev >= 4012900) {
3389 frauth_4_1_29_t *old29;
3391 KMALLOC(old29, frauth_4_1_29_t *);
3392 if (old29 == NULL) {
3397 frauth_current_to_4_1_29(ptr, old29);
3398 error = COPYOUT(old29, obj->ipfo_ptr, sizeof(*old29));
3403 } else if (obj->ipfo_rev >= 4012400) {
3404 frauth_4_1_24_t *old24;
3406 KMALLOC(old24, frauth_4_1_24_t *);
3407 if (old24 == NULL) {
3412 frauth_current_to_4_1_24(ptr, old24);
3413 error = COPYOUT(old24, obj->ipfo_ptr, sizeof(*old24));
3418 } else if (obj->ipfo_rev >= 4012300) {
3419 frauth_4_1_23_t *old23;
3421 KMALLOC(old23, frauth_4_1_23_t *);
3422 if (old23 == NULL) {
3427 frauth_current_to_4_1_23(ptr, old23);
3428 error = COPYOUT(old23, obj->ipfo_ptr, sizeof(*old23));
3433 } else if (obj->ipfo_rev >= 4011100) {
3434 frauth_4_1_11_t *old11;
3436 KMALLOC(old11, frauth_4_1_11_t *);
3437 if (old11 == NULL) {
3442 frauth_current_to_4_1_11(ptr, old11);
3443 error = COPYOUT(old11, obj->ipfo_ptr, sizeof(*old11));
3452 if (obj->ipfo_rev >= 4012500) {
3455 KMALLOC(old, nat_4_1_25_t *);
3461 nat_current_to_4_1_25(ptr, old);
3462 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3467 } else if (obj->ipfo_rev >= 4011400) {
3470 KMALLOC(old, nat_4_1_14_t *);
3476 nat_current_to_4_1_14(ptr, old);
3477 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3482 } else if (obj->ipfo_rev >= 4010300) {
3485 KMALLOC(old, nat_4_1_3_t *);
3491 nat_current_to_4_1_3(ptr, old);
3492 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3501 if (obj->ipfo_rev < 5000000) {
3504 KMALLOC(old, fripf4_t *);
3510 ipf_v5fripftov4(ptr, old);
3511 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3524 friostat_current_to_4_1_33(current, old, rev)
3526 friostat_4_1_33_t *old;
3529 friostat_t *fiop = (friostat_t *)current;
3531 bcopy(&fiop->f_st[0].fr_pass, &old->of_st[0], sizeof(old->of_st[0]));
3532 bcopy(&fiop->f_st[1].fr_pass, &old->of_st[1], sizeof(old->of_st[1]));
3534 old->f_ipf[0][0] = fiop->f_ipf[0][0];
3535 old->f_ipf[0][1] = fiop->f_ipf[0][1];
3536 old->f_ipf[1][0] = fiop->f_ipf[1][0];
3537 old->f_ipf[1][1] = fiop->f_ipf[1][1];
3538 old->f_acct[0][0] = fiop->f_acct[0][0];
3539 old->f_acct[0][1] = fiop->f_acct[0][1];
3540 old->f_acct[1][0] = fiop->f_acct[1][0];
3541 old->f_acct[1][1] = fiop->f_acct[1][1];
3542 old->f_ipf6[0][0] = NULL;
3543 old->f_ipf6[0][1] = NULL;
3544 old->f_ipf6[1][0] = NULL;
3545 old->f_ipf6[1][1] = NULL;
3546 old->f_acct6[0][0] = NULL;
3547 old->f_acct6[0][1] = NULL;
3548 old->f_acct6[1][0] = NULL;
3549 old->f_acct6[1][1] = NULL;
3550 old->f_auth = fiop->f_auth;
3551 bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
3552 bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
3553 old->f_ticks = fiop->f_ticks;
3554 bcopy(&fiop->f_locks, &old->f_locks, sizeof(old->f_locks));
3555 old->f_kmutex_sz = 0;
3556 old->f_krwlock_sz = 0;
3557 old->f_defpass = fiop->f_defpass;
3558 old->f_active = fiop->f_active;
3559 old->f_running = fiop->f_running;
3560 old->f_logging = fiop->f_logging;
3561 old->f_features = fiop->f_features;
3562 sprintf(old->f_version, "IP Filter: v%d.%d.%d",
3563 (rev / 1000000) % 100,
3564 (rev / 10000) % 100,
3570 friostat_current_to_4_1_0(current, old, rev)
3572 friostat_4_1_0_t *old;
3575 friostat_t *fiop = (friostat_t *)current;
3577 bcopy(&fiop->f_st[0].fr_pass, &old->of_st[0], sizeof(old->of_st[0]));
3578 bcopy(&fiop->f_st[1].fr_pass, &old->of_st[1], sizeof(old->of_st[1]));
3580 old->f_ipf[0][0] = fiop->f_ipf[0][0];
3581 old->f_ipf[0][1] = fiop->f_ipf[0][1];
3582 old->f_ipf[1][0] = fiop->f_ipf[1][0];
3583 old->f_ipf[1][1] = fiop->f_ipf[1][1];
3584 old->f_acct[0][0] = fiop->f_acct[0][0];
3585 old->f_acct[0][1] = fiop->f_acct[0][1];
3586 old->f_acct[1][0] = fiop->f_acct[1][0];
3587 old->f_acct[1][1] = fiop->f_acct[1][1];
3588 old->f_ipf6[0][0] = NULL;
3589 old->f_ipf6[0][1] = NULL;
3590 old->f_ipf6[1][0] = NULL;
3591 old->f_ipf6[1][1] = NULL;
3592 old->f_acct6[0][0] = NULL;
3593 old->f_acct6[0][1] = NULL;
3594 old->f_acct6[1][0] = NULL;
3595 old->f_acct6[1][1] = NULL;
3596 old->f_auth = fiop->f_auth;
3597 bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
3598 bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
3599 old->f_ticks = fiop->f_ticks;
3600 old->f_ipf[0][0] = fiop->f_ipf[0][0];
3601 old->f_ipf[0][1] = fiop->f_ipf[0][1];
3602 old->f_ipf[1][0] = fiop->f_ipf[1][0];
3603 old->f_ipf[1][1] = fiop->f_ipf[1][1];
3604 old->f_acct[0][0] = fiop->f_acct[0][0];
3605 old->f_acct[0][1] = fiop->f_acct[0][1];
3606 old->f_acct[1][0] = fiop->f_acct[1][0];
3607 old->f_acct[1][1] = fiop->f_acct[1][1];
3608 old->f_ipf6[0][0] = NULL;
3609 old->f_ipf6[0][1] = NULL;
3610 old->f_ipf6[1][0] = NULL;
3611 old->f_ipf6[1][1] = NULL;
3612 old->f_acct6[0][0] = NULL;
3613 old->f_acct6[0][1] = NULL;
3614 old->f_acct6[1][0] = NULL;
3615 old->f_acct6[1][1] = NULL;
3616 old->f_auth = fiop->f_auth;
3617 bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
3618 bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
3619 old->f_ticks = fiop->f_ticks;
3620 bcopy(&fiop->f_locks, &old->f_locks, sizeof(old->f_locks));
3621 old->f_kmutex_sz = 0;
3622 old->f_krwlock_sz = 0;
3623 old->f_defpass = fiop->f_defpass;
3624 old->f_active = fiop->f_active;
3625 old->f_running = fiop->f_running;
3626 old->f_logging = fiop->f_logging;
3627 old->f_features = fiop->f_features;
3628 sprintf(old->f_version, "IP Filter: v%d.%d.%d",
3629 (rev / 1000000) % 100,
3630 (rev / 10000) % 100,
3636 * nflags is v5 flags, returns v4 flags.
3639 fr_frflags5to4(nflags)
3644 switch (nflags & FR_CMDMASK) {
3670 if (nflags & FR_LOG)
3672 if (nflags & FR_CALLNOW)
3674 if (nflags & FR_NOTSRCIP)
3676 if (nflags & FR_NOTDSTIP)
3678 if (nflags & FR_QUICK)
3680 if (nflags & FR_KEEPFRAG)
3682 if (nflags & FR_KEEPSTATE)
3684 if (nflags & FR_FASTROUTE)
3686 if (nflags & FR_RETRST)
3688 if (nflags & FR_RETICMP)
3690 if (nflags & FR_FAKEICMP)
3692 if (nflags & FR_OUTQUE)
3694 if (nflags & FR_INQUE)
3696 if (nflags & FR_LOGBODY)
3698 if (nflags & FR_LOGFIRST)
3700 if (nflags & FR_LOGORBLOCK)
3702 if (nflags & FR_FRSTRICT)
3704 if (nflags & FR_STSTRICT)
3706 if (nflags & FR_NEWISN)
3708 if (nflags & FR_NOICMPERR)
3710 if (nflags & FR_STATESYNC)
3711 oflags |= 0x1000000;
3712 if (nflags & FR_NOMATCH)
3713 oflags |= 0x8000000;
3714 if (nflags & FR_COPIED)
3715 oflags |= 0x40000000;
3716 if (nflags & FR_INACTIVE)
3717 oflags |= 0x80000000;
3724 frentry_current_to_4_1_34(current, old)
3726 frentry_4_1_34_t *old;
3728 frentry_t *fr = (frentry_t *)current;
3730 old->fr_lock = fr->fr_lock;
3731 old->fr_next = fr->fr_next;
3732 old->fr_grp = (void *)fr->fr_grp;
3733 old->fr_isc = fr->fr_isc;
3734 old->fr_ifas[0] = fr->fr_ifas[0];
3735 old->fr_ifas[1] = fr->fr_ifas[1];
3736 old->fr_ifas[2] = fr->fr_ifas[2];
3737 old->fr_ifas[3] = fr->fr_ifas[3];
3738 old->fr_ptr = fr->fr_ptr;
3739 old->fr_comment = NULL;
3740 old->fr_ref = fr->fr_ref;
3741 old->fr_statecnt = fr->fr_statecnt;
3742 old->fr_hits = fr->fr_hits;
3743 old->fr_bytes = fr->fr_bytes;
3744 old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
3745 old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
3746 old->fr_curpps = fr->fr_curpps;
3747 old->fr_dun.fru_data = fr->fr_dun.fru_data;
3748 old->fr_func = fr->fr_func;
3749 old->fr_dsize = fr->fr_dsize;
3750 old->fr_pps = fr->fr_pps;
3751 old->fr_statemax = fr->fr_statemax;
3752 old->fr_flineno = fr->fr_flineno;
3753 old->fr_type = fr->fr_type;
3754 old->fr_flags = fr_frflags5to4(fr->fr_flags);
3755 old->fr_logtag = fr->fr_logtag;
3756 old->fr_collect = fr->fr_collect;
3757 old->fr_arg = fr->fr_arg;
3758 old->fr_loglevel = fr->fr_loglevel;
3759 old->fr_age[0] = fr->fr_age[0];
3760 old->fr_age[1] = fr->fr_age[1];
3761 if (fr->fr_family == AF_INET)
3763 if (fr->fr_family == AF_INET6)
3765 old->fr_icode = fr->fr_icode;
3766 old->fr_cksum = fr->fr_cksum;
3767 old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3768 old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3769 old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
3770 if (fr->fr_ifnames[0] >= 0) {
3771 strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
3773 old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
3775 if (fr->fr_ifnames[1] >= 0) {
3776 strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
3778 old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
3780 if (fr->fr_ifnames[2] >= 0) {
3781 strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
3783 old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
3785 if (fr->fr_ifnames[3] >= 0) {
3786 strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
3788 old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
3790 if (fr->fr_tifs[0].fd_name >= 0) {
3791 strncpy(old->fr_tifs[0].fd_ifname,
3792 fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
3793 old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
3795 if (fr->fr_tifs[1].fd_name >= 0) {
3796 strncpy(old->fr_tifs[1].fd_ifname,
3797 fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
3798 old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
3800 if (fr->fr_dif.fd_name >= 0) {
3801 strncpy(old->fr_dif.fd_ifname,
3802 fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
3803 old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
3805 if (fr->fr_group >= 0) {
3806 strncpy(old->fr_group, fr->fr_names + fr->fr_group,
3808 old->fr_group[FR_GROUPLEN - 1] = '\0';
3810 if (fr->fr_grhead >= 0) {
3811 strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
3813 old->fr_grhead[FR_GROUPLEN - 1] = '\0';
3819 frentry_current_to_4_1_16(current, old)
3821 frentry_4_1_16_t *old;
3823 frentry_t *fr = (frentry_t *)current;
3825 old->fr_lock = fr->fr_lock;
3826 old->fr_next = fr->fr_next;
3827 old->fr_grp = (void *)fr->fr_grp;
3828 old->fr_isc = fr->fr_isc;
3829 old->fr_ifas[0] = fr->fr_ifas[0];
3830 old->fr_ifas[1] = fr->fr_ifas[1];
3831 old->fr_ifas[2] = fr->fr_ifas[2];
3832 old->fr_ifas[3] = fr->fr_ifas[3];
3833 old->fr_ptr = fr->fr_ptr;
3834 old->fr_comment = NULL;
3835 old->fr_ref = fr->fr_ref;
3836 old->fr_statecnt = fr->fr_statecnt;
3837 old->fr_hits = fr->fr_hits;
3838 old->fr_bytes = fr->fr_bytes;
3839 old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
3840 old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
3841 old->fr_curpps = fr->fr_curpps;
3842 old->fr_dun.fru_data = fr->fr_dun.fru_data;
3843 old->fr_func = fr->fr_func;
3844 old->fr_dsize = fr->fr_dsize;
3845 old->fr_pps = fr->fr_pps;
3846 old->fr_statemax = fr->fr_statemax;
3847 old->fr_flineno = fr->fr_flineno;
3848 old->fr_type = fr->fr_type;
3849 old->fr_flags = fr_frflags5to4(fr->fr_flags);
3850 old->fr_logtag = fr->fr_logtag;
3851 old->fr_collect = fr->fr_collect;
3852 old->fr_arg = fr->fr_arg;
3853 old->fr_loglevel = fr->fr_loglevel;
3854 old->fr_age[0] = fr->fr_age[0];
3855 old->fr_age[1] = fr->fr_age[1];
3857 fr->fr_family = AF_INET;
3859 fr->fr_family = AF_INET6;
3860 old->fr_icode = fr->fr_icode;
3861 old->fr_cksum = fr->fr_cksum;
3862 old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3863 old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3864 old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
3865 if (fr->fr_ifnames[0] >= 0) {
3866 strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
3868 old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
3870 if (fr->fr_ifnames[1] >= 0) {
3871 strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
3873 old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
3875 if (fr->fr_ifnames[2] >= 0) {
3876 strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
3878 old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
3880 if (fr->fr_ifnames[3] >= 0) {
3881 strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
3883 old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
3885 if (fr->fr_tifs[0].fd_name >= 0) {
3886 strncpy(old->fr_tifs[0].fd_ifname,
3887 fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
3888 old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
3890 if (fr->fr_tifs[1].fd_name >= 0) {
3891 strncpy(old->fr_tifs[1].fd_ifname,
3892 fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
3893 old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
3895 if (fr->fr_dif.fd_name >= 0) {
3896 strncpy(old->fr_dif.fd_ifname,
3897 fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
3898 old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
3900 if (fr->fr_group >= 0) {
3901 strncpy(old->fr_group, fr->fr_names + fr->fr_group,
3903 old->fr_group[FR_GROUPLEN - 1] = '\0';
3905 if (fr->fr_grhead >= 0) {
3906 strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
3908 old->fr_grhead[FR_GROUPLEN - 1] = '\0';
3914 frentry_current_to_4_1_0(current, old)
3916 frentry_4_1_0_t *old;
3918 frentry_t *fr = (frentry_t *)current;
3920 old->fr_lock = fr->fr_lock;
3921 old->fr_next = fr->fr_next;
3922 old->fr_grp = (void *)fr->fr_grp;
3923 old->fr_isc = fr->fr_isc;
3924 old->fr_ifas[0] = fr->fr_ifas[0];
3925 old->fr_ifas[1] = fr->fr_ifas[1];
3926 old->fr_ifas[2] = fr->fr_ifas[2];
3927 old->fr_ifas[3] = fr->fr_ifas[3];
3928 old->fr_ptr = fr->fr_ptr;
3929 old->fr_comment = NULL;
3930 old->fr_ref = fr->fr_ref;
3931 old->fr_statecnt = fr->fr_statecnt;
3932 old->fr_hits = fr->fr_hits;
3933 old->fr_bytes = fr->fr_bytes;
3934 old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
3935 old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
3936 old->fr_curpps = fr->fr_curpps;
3937 old->fr_dun.fru_data = fr->fr_dun.fru_data;
3938 old->fr_func = fr->fr_func;
3939 old->fr_dsize = fr->fr_dsize;
3940 old->fr_pps = fr->fr_pps;
3941 old->fr_statemax = fr->fr_statemax;
3942 old->fr_flineno = fr->fr_flineno;
3943 old->fr_type = fr->fr_type;
3944 old->fr_flags = fr_frflags5to4(fr->fr_flags);
3945 old->fr_logtag = fr->fr_logtag;
3946 old->fr_collect = fr->fr_collect;
3947 old->fr_arg = fr->fr_arg;
3948 old->fr_loglevel = fr->fr_loglevel;
3949 old->fr_age[0] = fr->fr_age[0];
3950 old->fr_age[1] = fr->fr_age[1];
3952 fr->fr_family = AF_INET;
3954 fr->fr_family = AF_INET6;
3955 old->fr_icode = fr->fr_icode;
3956 old->fr_cksum = fr->fr_cksum;
3957 old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3958 old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3959 old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
3960 if (fr->fr_ifnames[0] >= 0) {
3961 strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
3963 old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
3965 if (fr->fr_ifnames[1] >= 0) {
3966 strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
3968 old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
3970 if (fr->fr_ifnames[2] >= 0) {
3971 strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
3973 old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
3975 if (fr->fr_ifnames[3] >= 0) {
3976 strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
3978 old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
3980 if (fr->fr_tifs[0].fd_name >= 0) {
3981 strncpy(old->fr_tifs[0].fd_ifname,
3982 fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
3983 old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
3985 if (fr->fr_tifs[1].fd_name >= 0) {
3986 strncpy(old->fr_tifs[1].fd_ifname,
3987 fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
3988 old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
3990 if (fr->fr_dif.fd_name >= 0) {
3991 strncpy(old->fr_dif.fd_ifname,
3992 fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
3993 old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
3995 if (fr->fr_group >= 0) {
3996 strncpy(old->fr_group, fr->fr_names + fr->fr_group,
3998 old->fr_group[FR_GROUPLEN - 1] = '\0';
4000 if (fr->fr_grhead >= 0) {
4001 strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
4003 old->fr_grhead[FR_GROUPLEN - 1] = '\0';
4009 fr_info_current_to_4_1_24(current, old)
4011 fr_info_4_1_24_t *old;
4013 fr_info_t *fin = (fr_info_t *)current;
4015 old->fin_ifp = fin->fin_ifp;
4016 ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
4017 bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
4018 old->fin_out = fin->fin_out;
4019 old->fin_rev = fin->fin_rev;
4020 old->fin_hlen = fin->fin_hlen;
4021 old->ofin_tcpf = fin->fin_tcpf;
4022 old->fin_icode = fin->fin_icode;
4023 old->fin_rule = fin->fin_rule;
4024 bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
4025 old->fin_fr = fin->fin_fr;
4026 old->fin_dp = fin->fin_dp;
4027 old->fin_dlen = fin->fin_dlen;
4028 old->fin_plen = fin->fin_plen;
4029 old->fin_ipoff = fin->fin_ipoff;
4030 old->fin_id = fin->fin_id;
4031 old->fin_off = fin->fin_off;
4032 old->fin_depth = fin->fin_depth;
4033 old->fin_error = fin->fin_error;
4034 old->fin_cksum = fin->fin_cksum;
4035 old->fin_state = NULL;
4036 old->fin_nat = NULL;
4037 old->fin_nattag = fin->fin_nattag;
4038 old->fin_exthdr = NULL;
4039 old->ofin_ip = fin->fin_ip;
4040 old->fin_mp = fin->fin_mp;
4041 old->fin_m = fin->fin_m;
4043 old->fin_qfm = fin->fin_qfm;
4044 old->fin_qpi = fin->fin_qpi;
4045 old->fin_ifname[0] = '\0';
4051 fr_info_current_to_4_1_23(current, old)
4053 fr_info_4_1_23_t *old;
4055 fr_info_t *fin = (fr_info_t *)current;
4057 old->fin_ifp = fin->fin_ifp;
4058 ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
4059 bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
4060 old->fin_out = fin->fin_out;
4061 old->fin_rev = fin->fin_rev;
4062 old->fin_hlen = fin->fin_hlen;
4063 old->ofin_tcpf = fin->fin_tcpf;
4064 old->fin_icode = fin->fin_icode;
4065 old->fin_rule = fin->fin_rule;
4066 bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
4067 old->fin_fr = fin->fin_fr;
4068 old->fin_dp = fin->fin_dp;
4069 old->fin_dlen = fin->fin_dlen;
4070 old->fin_plen = fin->fin_plen;
4071 old->fin_ipoff = fin->fin_ipoff;
4072 old->fin_id = fin->fin_id;
4073 old->fin_off = fin->fin_off;
4074 old->fin_depth = fin->fin_depth;
4075 old->fin_error = fin->fin_error;
4076 old->fin_state = NULL;
4077 old->fin_nat = NULL;
4078 old->fin_nattag = fin->fin_nattag;
4079 old->ofin_ip = fin->fin_ip;
4080 old->fin_mp = fin->fin_mp;
4081 old->fin_m = fin->fin_m;
4083 old->fin_qfm = fin->fin_qfm;
4084 old->fin_qpi = fin->fin_qpi;
4085 old->fin_ifname[0] = '\0';
4091 fr_info_current_to_4_1_11(current, old)
4093 fr_info_4_1_11_t *old;
4095 fr_info_t *fin = (fr_info_t *)current;
4097 old->fin_ifp = fin->fin_ifp;
4098 ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
4099 bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
4100 old->fin_out = fin->fin_out;
4101 old->fin_rev = fin->fin_rev;
4102 old->fin_hlen = fin->fin_hlen;
4103 old->ofin_tcpf = fin->fin_tcpf;
4104 old->fin_icode = fin->fin_icode;
4105 old->fin_rule = fin->fin_rule;
4106 bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
4107 old->fin_fr = fin->fin_fr;
4108 old->fin_dp = fin->fin_dp;
4109 old->fin_dlen = fin->fin_dlen;
4110 old->fin_plen = fin->fin_plen;
4111 old->fin_ipoff = fin->fin_ipoff;
4112 old->fin_id = fin->fin_id;
4113 old->fin_off = fin->fin_off;
4114 old->fin_depth = fin->fin_depth;
4115 old->fin_error = fin->fin_error;
4116 old->fin_state = NULL;
4117 old->fin_nat = NULL;
4118 old->fin_nattag = fin->fin_nattag;
4119 old->ofin_ip = fin->fin_ip;
4120 old->fin_mp = fin->fin_mp;
4121 old->fin_m = fin->fin_m;
4123 old->fin_qfm = fin->fin_qfm;
4124 old->fin_qpi = fin->fin_qpi;
4125 old->fin_ifname[0] = '\0';
4131 frauth_current_to_4_1_29(current, old)
4133 frauth_4_1_29_t *old;
4135 frauth_t *fra = (frauth_t *)current;
4137 old->fra_age = fra->fra_age;
4138 old->fra_len = fra->fra_len;
4139 old->fra_index = fra->fra_index;
4140 old->fra_pass = fra->fra_pass;
4141 fr_info_current_to_4_1_24(&fra->fra_info, &old->fra_info);
4142 old->fra_buf = fra->fra_buf;
4143 old->fra_flx = fra->fra_flx;
4145 old->fra_q = fra->fra_q;
4146 old->fra_m = fra->fra_m;
4152 frauth_current_to_4_1_24(current, old)
4154 frauth_4_1_24_t *old;
4156 frauth_t *fra = (frauth_t *)current;
4158 old->fra_age = fra->fra_age;
4159 old->fra_len = fra->fra_len;
4160 old->fra_index = fra->fra_index;
4161 old->fra_pass = fra->fra_pass;
4162 fr_info_current_to_4_1_24(&fra->fra_info, &old->fra_info);
4163 old->fra_buf = fra->fra_buf;
4165 old->fra_q = fra->fra_q;
4166 old->fra_m = fra->fra_m;
4172 frauth_current_to_4_1_23(current, old)
4174 frauth_4_1_23_t *old;
4176 frauth_t *fra = (frauth_t *)current;
4178 old->fra_age = fra->fra_age;
4179 old->fra_len = fra->fra_len;
4180 old->fra_index = fra->fra_index;
4181 old->fra_pass = fra->fra_pass;
4182 fr_info_current_to_4_1_23(&fra->fra_info, &old->fra_info);
4183 old->fra_buf = fra->fra_buf;
4185 old->fra_q = fra->fra_q;
4186 old->fra_m = fra->fra_m;
4192 frauth_current_to_4_1_11(current, old)
4194 frauth_4_1_11_t *old;
4196 frauth_t *fra = (frauth_t *)current;
4198 old->fra_age = fra->fra_age;
4199 old->fra_len = fra->fra_len;
4200 old->fra_index = fra->fra_index;
4201 old->fra_pass = fra->fra_pass;
4202 fr_info_current_to_4_1_11(&fra->fra_info, &old->fra_info);
4203 old->fra_buf = fra->fra_buf;
4205 old->fra_q = fra->fra_q;
4206 old->fra_m = fra->fra_m;
4212 ipnat_current_to_4_1_14(current, old)
4214 ipnat_4_1_14_t *old;
4216 ipnat_t *np = (ipnat_t *)current;
4218 old->in_next = np->in_next;
4219 old->in_rnext = np->in_rnext;
4220 old->in_prnext = np->in_prnext;
4221 old->in_mnext = np->in_mnext;
4222 old->in_pmnext = np->in_pmnext;
4223 old->in_tqehead[0] = np->in_tqehead[0];
4224 old->in_tqehead[1] = np->in_tqehead[1];
4225 old->in_ifps[0] = np->in_ifps[0];
4226 old->in_ifps[1] = np->in_ifps[1];
4227 old->in_apr = np->in_apr;
4228 old->in_comment = np->in_comment;
4229 old->in_space = np->in_space;
4230 old->in_hits = np->in_hits;
4231 old->in_use = np->in_use;
4232 old->in_hv = np->in_hv[0];
4233 old->in_flineno = np->in_flineno;
4234 if (old->in_redir == NAT_REDIRECT)
4235 old->in_pnext = np->in_dpnext;
4237 old->in_pnext = np->in_spnext;
4238 old->in_v = np->in_v[0];
4239 old->in_flags = np->in_flags;
4240 old->in_mssclamp = np->in_mssclamp;
4241 old->in_age[0] = np->in_age[0];
4242 old->in_age[1] = np->in_age[1];
4243 old->in_redir = np->in_redir;
4244 old->in_p = np->in_pr[0];
4245 if (np->in_redir == NAT_REDIRECT) {
4246 old->in_next6 = np->in_ndst.na_nextaddr;
4247 old->in_in[0] = np->in_ndst.na_addr[0];
4248 old->in_in[1] = np->in_ndst.na_addr[1];
4249 old->in_out[0] = np->in_odst.na_addr[0];
4250 old->in_out[1] = np->in_odst.na_addr[1];
4251 old->in_src[0] = np->in_osrc.na_addr[0];
4252 old->in_src[1] = np->in_osrc.na_addr[1];
4254 old->in_next6 = np->in_nsrc.na_nextaddr;
4255 old->in_out[0] = np->in_nsrc.na_addr[0];
4256 old->in_out[1] = np->in_nsrc.na_addr[1];
4257 old->in_in[0] = np->in_osrc.na_addr[0];
4258 old->in_in[1] = np->in_osrc.na_addr[1];
4259 old->in_src[0] = np->in_odst.na_addr[0];
4260 old->in_src[1] = np->in_odst.na_addr[1];
4262 ipfv5tuctov4(&np->in_tuc, &old->in_tuc);
4263 if (np->in_redir == NAT_REDIRECT) {
4264 old->in_port[0] = np->in_dpmin;
4265 old->in_port[1] = np->in_dpmax;
4267 old->in_port[0] = np->in_spmin;
4268 old->in_port[1] = np->in_spmax;
4270 old->in_ppip = np->in_ppip;
4271 old->in_ippip = np->in_ippip;
4272 bcopy(&np->in_tag, &old->in_tag, sizeof(np->in_tag));
4274 if (np->in_ifnames[0] >= 0) {
4275 strncpy(old->in_ifnames[0], np->in_names + np->in_ifnames[0],
4277 old->in_ifnames[0][LIFNAMSIZ - 1] = '\0';
4279 if (np->in_ifnames[1] >= 0) {
4280 strncpy(old->in_ifnames[1], np->in_names + np->in_ifnames[1],
4282 old->in_ifnames[1][LIFNAMSIZ - 1] = '\0';
4284 if (np->in_plabel >= 0) {
4285 strncpy(old->in_plabel, np->in_names + np->in_plabel,
4287 old->in_plabel[APR_LABELLEN - 1] = '\0';
4293 ipnat_current_to_4_1_0(current, old)
4297 ipnat_t *np = (ipnat_t *)current;
4299 old->in_next = np->in_next;
4300 old->in_rnext = np->in_rnext;
4301 old->in_prnext = np->in_prnext;
4302 old->in_mnext = np->in_mnext;
4303 old->in_pmnext = np->in_pmnext;
4304 old->in_tqehead[0] = np->in_tqehead[0];
4305 old->in_tqehead[1] = np->in_tqehead[1];
4306 old->in_ifps[0] = np->in_ifps[0];
4307 old->in_ifps[1] = np->in_ifps[1];
4308 old->in_apr = np->in_apr;
4309 old->in_comment = np->in_comment;
4310 old->in_space = np->in_space;
4311 old->in_hits = np->in_hits;
4312 old->in_use = np->in_use;
4313 old->in_hv = np->in_hv[0];
4314 old->in_flineno = np->in_flineno;
4315 if (old->in_redir == NAT_REDIRECT)
4316 old->in_pnext = np->in_dpnext;
4318 old->in_pnext = np->in_spnext;
4319 old->in_v = np->in_v[0];
4320 old->in_flags = np->in_flags;
4321 old->in_mssclamp = np->in_mssclamp;
4322 old->in_age[0] = np->in_age[0];
4323 old->in_age[1] = np->in_age[1];
4324 old->in_redir = np->in_redir;
4325 old->in_p = np->in_pr[0];
4326 if (np->in_redir == NAT_REDIRECT) {
4327 old->in_next6 = np->in_ndst.na_nextaddr;
4328 old->in_in[0] = np->in_ndst.na_addr[0];
4329 old->in_in[1] = np->in_ndst.na_addr[1];
4330 old->in_out[0] = np->in_odst.na_addr[0];
4331 old->in_out[1] = np->in_odst.na_addr[1];
4332 old->in_src[0] = np->in_osrc.na_addr[0];
4333 old->in_src[1] = np->in_osrc.na_addr[1];
4335 old->in_next6 = np->in_nsrc.na_nextaddr;
4336 old->in_out[0] = np->in_nsrc.na_addr[0];
4337 old->in_out[1] = np->in_nsrc.na_addr[1];
4338 old->in_in[0] = np->in_osrc.na_addr[0];
4339 old->in_in[1] = np->in_osrc.na_addr[1];
4340 old->in_src[0] = np->in_odst.na_addr[0];
4341 old->in_src[1] = np->in_odst.na_addr[1];
4343 ipfv5tuctov4(&np->in_tuc, &old->in_tuc);
4344 if (np->in_redir == NAT_REDIRECT) {
4345 old->in_port[0] = np->in_dpmin;
4346 old->in_port[1] = np->in_dpmax;
4348 old->in_port[0] = np->in_spmin;
4349 old->in_port[1] = np->in_spmax;
4351 old->in_ppip = np->in_ppip;
4352 old->in_ippip = np->in_ippip;
4353 bcopy(&np->in_tag, &old->in_tag, sizeof(np->in_tag));
4355 if (np->in_ifnames[0] >= 0) {
4356 strncpy(old->in_ifnames[0], np->in_names + np->in_ifnames[0],
4358 old->in_ifnames[0][LIFNAMSIZ - 1] = '\0';
4360 if (np->in_ifnames[1] >= 0) {
4361 strncpy(old->in_ifnames[1], np->in_names + np->in_ifnames[1],
4363 old->in_ifnames[1][LIFNAMSIZ - 1] = '\0';
4365 if (np->in_plabel >= 0) {
4366 strncpy(old->in_plabel, np->in_names + np->in_plabel,
4368 old->in_plabel[APR_LABELLEN - 1] = '\0';
4374 ipstate_current_to_4_1_16(current, old)
4376 ipstate_4_1_16_t *old;
4378 ipstate_t *is = (ipstate_t *)current;
4380 old->is_lock = is->is_lock;
4381 old->is_next = is->is_next;
4382 old->is_pnext = is->is_pnext;
4383 old->is_hnext = is->is_hnext;
4384 old->is_phnext = is->is_phnext;
4385 old->is_me = is->is_me;
4386 old->is_ifp[0] = is->is_ifp[0];
4387 old->is_ifp[1] = is->is_ifp[1];
4388 old->is_sync = is->is_sync;
4389 old->is_rule = is->is_rule;
4390 old->is_tqehead[0] = is->is_tqehead[0];
4391 old->is_tqehead[1] = is->is_tqehead[1];
4392 old->is_isc = is->is_isc;
4393 old->is_pkts[0] = is->is_pkts[0];
4394 old->is_pkts[1] = is->is_pkts[1];
4395 old->is_pkts[2] = is->is_pkts[2];
4396 old->is_pkts[3] = is->is_pkts[3];
4397 old->is_bytes[0] = is->is_bytes[0];
4398 old->is_bytes[1] = is->is_bytes[1];
4399 old->is_bytes[2] = is->is_bytes[2];
4400 old->is_bytes[3] = is->is_bytes[3];
4401 old->is_icmppkts[0] = is->is_icmppkts[0];
4402 old->is_icmppkts[1] = is->is_icmppkts[1];
4403 old->is_icmppkts[2] = is->is_icmppkts[2];
4404 old->is_icmppkts[3] = is->is_icmppkts[3];
4405 old->is_sti = is->is_sti;
4406 old->is_frage[0] = is->is_frage[0];
4407 old->is_frage[1] = is->is_frage[1];
4408 old->is_ref = is->is_ref;
4409 old->is_isninc[0] = is->is_isninc[0];
4410 old->is_isninc[1] = is->is_isninc[1];
4411 old->is_sumd[0] = is->is_sumd[0];
4412 old->is_sumd[1] = is->is_sumd[1];
4413 old->is_src = is->is_src;
4414 old->is_dst = is->is_dst;
4415 old->is_pass = is->is_pass;
4416 old->is_p = is->is_p;
4417 old->is_v = is->is_v;
4418 old->is_hv = is->is_hv;
4419 old->is_tag = is->is_tag;
4420 old->is_opt[0] = is->is_opt[0];
4421 old->is_opt[1] = is->is_opt[1];
4422 old->is_optmsk[0] = is->is_optmsk[0];
4423 old->is_optmsk[1] = is->is_optmsk[1];
4424 old->is_sec = is->is_sec;
4425 old->is_secmsk = is->is_secmsk;
4426 old->is_auth = is->is_auth;
4427 old->is_authmsk = is->is_authmsk;
4428 ipf_v5tcpinfoto4(&is->is_tcp, &old->is_tcp);
4429 old->is_flags = is->is_flags;
4430 old->is_flx[0][0] = is->is_flx[0][0];
4431 old->is_flx[0][1] = is->is_flx[0][1];
4432 old->is_flx[1][0] = is->is_flx[1][0];
4433 old->is_flx[1][1] = is->is_flx[1][1];
4434 old->is_rulen = is->is_rulen;
4435 old->is_s0[0] = is->is_s0[0];
4436 old->is_s0[1] = is->is_s0[1];
4437 old->is_smsk[0] = is->is_smsk[0];
4438 old->is_smsk[1] = is->is_smsk[1];
4439 bcopy(is->is_group, old->is_group, sizeof(is->is_group));
4440 bcopy(is->is_sbuf, old->is_sbuf, sizeof(is->is_sbuf));
4441 bcopy(is->is_ifname, old->is_ifname, sizeof(is->is_ifname));
4446 ipstate_current_to_4_1_0(current, old)
4448 ipstate_4_1_0_t *old;
4450 ipstate_t *is = (ipstate_t *)current;
4452 old->is_lock = is->is_lock;
4453 old->is_next = is->is_next;
4454 old->is_pnext = is->is_pnext;
4455 old->is_hnext = is->is_hnext;
4456 old->is_phnext = is->is_phnext;
4457 old->is_me = is->is_me;
4458 old->is_ifp[0] = is->is_ifp[0];
4459 old->is_ifp[1] = is->is_ifp[1];
4460 old->is_sync = is->is_sync;
4461 bzero(&old->is_nat, sizeof(old->is_nat));
4462 old->is_rule = is->is_rule;
4463 old->is_tqehead[0] = is->is_tqehead[0];
4464 old->is_tqehead[1] = is->is_tqehead[1];
4465 old->is_isc = is->is_isc;
4466 old->is_pkts[0] = is->is_pkts[0];
4467 old->is_pkts[1] = is->is_pkts[1];
4468 old->is_pkts[2] = is->is_pkts[2];
4469 old->is_pkts[3] = is->is_pkts[3];
4470 old->is_bytes[0] = is->is_bytes[0];
4471 old->is_bytes[1] = is->is_bytes[1];
4472 old->is_bytes[2] = is->is_bytes[2];
4473 old->is_bytes[3] = is->is_bytes[3];
4474 old->is_icmppkts[0] = is->is_icmppkts[0];
4475 old->is_icmppkts[1] = is->is_icmppkts[1];
4476 old->is_icmppkts[2] = is->is_icmppkts[2];
4477 old->is_icmppkts[3] = is->is_icmppkts[3];
4478 old->is_sti = is->is_sti;
4479 old->is_frage[0] = is->is_frage[0];
4480 old->is_frage[1] = is->is_frage[1];
4481 old->is_ref = is->is_ref;
4482 old->is_isninc[0] = is->is_isninc[0];
4483 old->is_isninc[1] = is->is_isninc[1];
4484 old->is_sumd[0] = is->is_sumd[0];
4485 old->is_sumd[1] = is->is_sumd[1];
4486 old->is_src = is->is_src;
4487 old->is_dst = is->is_dst;
4488 old->is_pass = is->is_pass;
4489 old->is_p = is->is_p;
4490 old->is_v = is->is_v;
4491 old->is_hv = is->is_hv;
4492 old->is_tag = is->is_tag;
4493 old->is_opt[0] = is->is_opt[0];
4494 old->is_opt[1] = is->is_opt[1];
4495 old->is_optmsk[0] = is->is_optmsk[0];
4496 old->is_optmsk[1] = is->is_optmsk[1];
4497 old->is_sec = is->is_sec;
4498 old->is_secmsk = is->is_secmsk;
4499 old->is_auth = is->is_auth;
4500 old->is_authmsk = is->is_authmsk;
4501 ipf_v5tcpinfoto4(&is->is_tcp, &old->is_tcp);
4502 old->is_flags = is->is_flags;
4503 old->is_flx[0][0] = is->is_flx[0][0];
4504 old->is_flx[0][1] = is->is_flx[0][1];
4505 old->is_flx[1][0] = is->is_flx[1][0];
4506 old->is_flx[1][1] = is->is_flx[1][1];
4507 old->is_rulen = is->is_rulen;
4508 old->is_s0[0] = is->is_s0[0];
4509 old->is_s0[1] = is->is_s0[1];
4510 old->is_smsk[0] = is->is_smsk[0];
4511 old->is_smsk[1] = is->is_smsk[1];
4512 bcopy(is->is_group, old->is_group, sizeof(is->is_group));
4513 bcopy(is->is_sbuf, old->is_sbuf, sizeof(is->is_sbuf));
4514 bcopy(is->is_ifname, old->is_ifname, sizeof(is->is_ifname));
4519 ips_stat_current_to_4_1_21(current, old)
4521 ips_stat_4_1_21_t *old;
4523 ips_stat_t *st = (ips_stat_t *)current;
4525 old->iss_hits = st->iss_hits;
4526 old->iss_miss = st->iss_check_miss;
4527 old->iss_max = st->iss_max;
4528 old->iss_maxref = st->iss_max_ref;
4529 old->iss_tcp = st->iss_proto[IPPROTO_TCP];
4530 old->iss_udp = st->iss_proto[IPPROTO_UDP];
4531 old->iss_icmp = st->iss_proto[IPPROTO_ICMP];
4532 old->iss_nomem = st->iss_nomem;
4533 old->iss_expire = st->iss_expire;
4534 old->iss_fin = st->iss_fin;
4535 old->iss_active = st->iss_active;
4536 old->iss_logged = st->iss_log_ok;
4537 old->iss_logfail = st->iss_log_fail;
4538 old->iss_inuse = st->iss_inuse;
4539 old->iss_wild = st->iss_wild;
4540 old->iss_ticks = st->iss_ticks;
4541 old->iss_bucketfull = st->iss_bucket_full;
4542 old->iss_statesize = st->iss_state_size;
4543 old->iss_statemax = st->iss_state_max;
4544 old->iss_table = st->iss_table;
4545 old->iss_list = st->iss_list;
4546 old->iss_bucketlen = (void *)st->iss_bucketlen;
4547 old->iss_tcptab = st->iss_tcptab;
4552 ips_stat_current_to_4_1_0(current, old)
4554 ips_stat_4_1_0_t *old;
4556 ips_stat_t *st = (ips_stat_t *)current;
4558 old->iss_hits = st->iss_hits;
4559 old->iss_miss = st->iss_check_miss;
4560 old->iss_max = st->iss_max;
4561 old->iss_maxref = st->iss_max_ref;
4562 old->iss_tcp = st->iss_proto[IPPROTO_TCP];
4563 old->iss_udp = st->iss_proto[IPPROTO_UDP];
4564 old->iss_icmp = st->iss_proto[IPPROTO_ICMP];
4565 old->iss_nomem = st->iss_nomem;
4566 old->iss_expire = st->iss_expire;
4567 old->iss_fin = st->iss_fin;
4568 old->iss_active = st->iss_active;
4569 old->iss_logged = st->iss_log_ok;
4570 old->iss_logfail = st->iss_log_fail;
4571 old->iss_inuse = st->iss_inuse;
4572 old->iss_wild = st->iss_wild;
4573 old->iss_ticks = st->iss_ticks;
4574 old->iss_bucketfull = st->iss_bucket_full;
4575 old->iss_statesize = st->iss_state_size;
4576 old->iss_statemax = st->iss_state_max;
4577 old->iss_table = st->iss_table;
4578 old->iss_list = st->iss_list;
4579 old->iss_bucketlen = (void *)st->iss_bucketlen;
4584 nat_save_current_to_4_1_16(current, old)
4586 nat_save_4_1_16_t *old;
4588 nat_save_t *nats = (nat_save_t *)current;
4590 old->ipn_next = nats->ipn_next;
4591 bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
4592 bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
4593 frentry_current_to_4_1_16(&nats->ipn_fr, &old->ipn_fr);
4594 old->ipn_dsize = nats->ipn_dsize;
4595 bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
4600 nat_save_current_to_4_1_14(current, old)
4602 nat_save_4_1_14_t *old;
4604 nat_save_t *nats = (nat_save_t *)current;
4606 old->ipn_next = nats->ipn_next;
4607 bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
4608 bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
4609 frentry_current_to_4_1_0(&nats->ipn_fr, &old->ipn_fr);
4610 old->ipn_dsize = nats->ipn_dsize;
4611 bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
4616 nat_save_current_to_4_1_3(current, old)
4618 nat_save_4_1_3_t *old;
4620 nat_save_t *nats = (nat_save_t *)current;
4622 old->ipn_next = nats->ipn_next;
4623 bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
4624 bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
4625 frentry_current_to_4_1_0(&nats->ipn_fr, &old->ipn_fr);
4626 old->ipn_dsize = nats->ipn_dsize;
4627 bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
4632 nat_current_to_4_1_25(current, old)
4636 nat_t *nat = (nat_t *)current;
4638 old->nat_lock = nat->nat_lock;
4639 old->nat_next = (void *)nat->nat_next;
4640 old->nat_pnext = (void *)nat->nat_pnext;
4641 old->nat_hnext[0] = (void *)nat->nat_hnext[0];
4642 old->nat_hnext[1] = (void *)nat->nat_hnext[1];
4643 old->nat_phnext[0] = (void *)nat->nat_phnext[0];
4644 old->nat_phnext[1] = (void *)nat->nat_phnext[1];
4645 old->nat_hm = nat->nat_hm;
4646 old->nat_data = nat->nat_data;
4647 old->nat_me = (void *)nat->nat_me;
4648 old->nat_state = nat->nat_state;
4649 old->nat_aps = nat->nat_aps;
4650 old->nat_fr = nat->nat_fr;
4651 old->nat_ptr = (void *)nat->nat_ptr;
4652 old->nat_ifps[0] = nat->nat_ifps[0];
4653 old->nat_ifps[1] = nat->nat_ifps[1];
4654 old->nat_sync = nat->nat_sync;
4655 old->nat_tqe = nat->nat_tqe;
4656 old->nat_flags = nat->nat_flags;
4657 old->nat_sumd[0] = nat->nat_sumd[0];
4658 old->nat_sumd[1] = nat->nat_sumd[1];
4659 old->nat_ipsumd = nat->nat_ipsumd;
4660 old->nat_mssclamp = nat->nat_mssclamp;
4661 old->nat_pkts[0] = nat->nat_pkts[0];
4662 old->nat_pkts[1] = nat->nat_pkts[1];
4663 old->nat_bytes[0] = nat->nat_bytes[0];
4664 old->nat_bytes[1] = nat->nat_bytes[1];
4665 old->nat_ref = nat->nat_ref;
4666 old->nat_dir = nat->nat_dir;
4667 old->nat_p = nat->nat_pr[0];
4668 old->nat_use = nat->nat_use;
4669 old->nat_hv[0] = nat->nat_hv[0];
4670 old->nat_hv[1] = nat->nat_hv[1];
4671 old->nat_rev = nat->nat_rev;
4672 old->nat_redir = nat->nat_redir;
4673 bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
4674 bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
4676 if (nat->nat_redir == NAT_REDIRECT) {
4677 old->nat_inip6 = nat->nat_ndst6;
4678 old->nat_outip6 = nat->nat_odst6;
4679 old->nat_oip6 = nat->nat_osrc6;
4680 old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
4681 old->nat_un.nat_unt.ts_dport = nat->nat_odport;
4683 old->nat_inip6 = nat->nat_osrc6;
4684 old->nat_outip6 = nat->nat_nsrc6;
4685 old->nat_oip6 = nat->nat_odst6;
4686 old->nat_un.nat_unt.ts_sport = nat->nat_osport;
4687 old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
4693 nat_current_to_4_1_14(current, old)
4697 nat_t *nat = (nat_t *)current;
4699 old->nat_lock = nat->nat_lock;
4700 old->nat_next = nat->nat_next;
4701 old->nat_pnext = NULL;
4702 old->nat_hnext[0] = NULL;
4703 old->nat_hnext[1] = NULL;
4704 old->nat_phnext[0] = NULL;
4705 old->nat_phnext[1] = NULL;
4706 old->nat_hm = nat->nat_hm;
4707 old->nat_data = nat->nat_data;
4708 old->nat_me = (void *)nat->nat_me;
4709 old->nat_state = nat->nat_state;
4710 old->nat_aps = nat->nat_aps;
4711 old->nat_fr = nat->nat_fr;
4712 old->nat_ptr = nat->nat_ptr;
4713 old->nat_ifps[0] = nat->nat_ifps[0];
4714 old->nat_ifps[1] = nat->nat_ifps[1];
4715 old->nat_sync = nat->nat_sync;
4716 old->nat_tqe = nat->nat_tqe;
4717 old->nat_flags = nat->nat_flags;
4718 old->nat_sumd[0] = nat->nat_sumd[0];
4719 old->nat_sumd[1] = nat->nat_sumd[1];
4720 old->nat_ipsumd = nat->nat_ipsumd;
4721 old->nat_mssclamp = nat->nat_mssclamp;
4722 old->nat_pkts[0] = nat->nat_pkts[0];
4723 old->nat_pkts[1] = nat->nat_pkts[1];
4724 old->nat_bytes[0] = nat->nat_bytes[0];
4725 old->nat_bytes[1] = nat->nat_bytes[1];
4726 old->nat_ref = nat->nat_ref;
4727 old->nat_dir = nat->nat_dir;
4728 old->nat_p = nat->nat_pr[0];
4729 old->nat_use = nat->nat_use;
4730 old->nat_hv[0] = nat->nat_hv[0];
4731 old->nat_hv[1] = nat->nat_hv[1];
4732 old->nat_rev = nat->nat_rev;
4733 bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
4734 bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
4736 if (nat->nat_redir == NAT_REDIRECT) {
4737 old->nat_inip6 = nat->nat_ndst6;
4738 old->nat_outip6 = nat->nat_odst6;
4739 old->nat_oip6 = nat->nat_osrc6;
4740 old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
4741 old->nat_un.nat_unt.ts_dport = nat->nat_odport;
4743 old->nat_inip6 = nat->nat_osrc6;
4744 old->nat_outip6 = nat->nat_nsrc6;
4745 old->nat_oip6 = nat->nat_odst6;
4746 old->nat_un.nat_unt.ts_sport = nat->nat_osport;
4747 old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
4753 nat_current_to_4_1_3(current, old)
4757 nat_t *nat = (nat_t *)current;
4759 old->nat_lock = nat->nat_lock;
4760 old->nat_next = nat->nat_next;
4761 old->nat_pnext = NULL;
4762 old->nat_hnext[0] = NULL;
4763 old->nat_hnext[1] = NULL;
4764 old->nat_phnext[0] = NULL;
4765 old->nat_phnext[1] = NULL;
4766 old->nat_hm = nat->nat_hm;
4767 old->nat_data = nat->nat_data;
4768 old->nat_me = (void *)nat->nat_me;
4769 old->nat_state = nat->nat_state;
4770 old->nat_aps = nat->nat_aps;
4771 old->nat_fr = nat->nat_fr;
4772 old->nat_ptr = nat->nat_ptr;
4773 old->nat_ifps[0] = nat->nat_ifps[0];
4774 old->nat_ifps[1] = nat->nat_ifps[1];
4775 old->nat_sync = nat->nat_sync;
4776 old->nat_tqe = nat->nat_tqe;
4777 old->nat_flags = nat->nat_flags;
4778 old->nat_sumd[0] = nat->nat_sumd[0];
4779 old->nat_sumd[1] = nat->nat_sumd[1];
4780 old->nat_ipsumd = nat->nat_ipsumd;
4781 old->nat_mssclamp = nat->nat_mssclamp;
4782 old->nat_pkts[0] = nat->nat_pkts[0];
4783 old->nat_pkts[1] = nat->nat_pkts[1];
4784 old->nat_bytes[0] = nat->nat_bytes[0];
4785 old->nat_bytes[1] = nat->nat_bytes[1];
4786 old->nat_ref = nat->nat_ref;
4787 old->nat_dir = nat->nat_dir;
4788 old->nat_p = nat->nat_pr[0];
4789 old->nat_use = nat->nat_use;
4790 old->nat_hv[0] = nat->nat_hv[0];
4791 old->nat_hv[1] = nat->nat_hv[1];
4792 old->nat_rev = nat->nat_rev;
4793 bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
4794 bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
4796 if (nat->nat_redir == NAT_REDIRECT) {
4797 old->nat_inip6 = nat->nat_ndst6;
4798 old->nat_outip6 = nat->nat_odst6;
4799 old->nat_oip6 = nat->nat_osrc6;
4800 old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
4801 old->nat_un.nat_unt.ts_dport = nat->nat_odport;
4803 old->nat_inip6 = nat->nat_osrc6;
4804 old->nat_outip6 = nat->nat_nsrc6;
4805 old->nat_oip6 = nat->nat_odst6;
4806 old->nat_un.nat_unt.ts_sport = nat->nat_osport;
4807 old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
4811 #endif /* IPFILTER_COMPAT */