2 * Copyright (C) 2002-2012 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 #if defined(KERNEL) || defined(_KERNEL)
13 # define _PROTO_NET_H_
15 #include <sys/param.h>
16 #include <sys/errno.h>
17 #include <sys/types.h>
20 #if __FreeBSD_version >= 220000 && defined(_KERNEL)
21 # include <sys/fcntl.h>
22 # include <sys/filio.h>
24 # include <sys/ioctl.h>
35 #include <sys/socket.h>
36 #if (defined(__osf__) || defined(AIX) || defined(__hpux) || defined(__sgi)) && defined(_KERNEL)
37 # include "radix_ipf_local.h"
41 #if defined(__FreeBSD__)
42 # include <sys/cdefs.h>
43 # include <sys/proc.h>
46 # include <sys/systm.h>
47 # if !defined(__SVR4) && !defined(__svr4__)
48 # include <sys/mbuf.h>
51 #include <netinet/in.h>
53 #include "netinet/ip_compat.h"
54 #include "netinet/ip_fil.h"
55 #include "netinet/ip_pool.h"
56 #include "netinet/ip_htable.h"
57 #include "netinet/ip_lookup.h"
58 #include "netinet/ip_nat.h"
59 #include "netinet/ip_state.h"
60 #include "netinet/ip_proxy.h"
61 #include "netinet/ip_auth.h"
65 * NetBSD has moved to 64bit time_t for all architectures.
66 * For some, such as sparc64, there is no change because long is already
67 * 64bit, but for others (i386), there is...
69 #ifdef IPFILTER_COMPAT
72 typedef struct timeval_l {
78 /* ------------------------------------------------------------------------ */
80 typedef struct tcpinfo4 {
86 static void ipf_v5tcpinfoto4 __P((tcpinfo_t *, tcpinfo4_t *));
89 ipf_v5tcpinfoto4(v5, v4)
93 v4->ts_sport = v5->ts_sport;
94 v4->ts_dport = v5->ts_dport;
95 v4->ts_data[0] = v5->ts_data[0];
96 v4->ts_data[1] = v5->ts_data[1];
99 typedef struct fr_ip4 {
115 typedef struct frpcmp4 {
121 typedef struct frtuc4 {
128 typedef struct fripf4 {
142 typedef struct frdest_4 {
145 char fd_ifname[LIFNAMSIZ];
148 /* ------------------------------------------------------------------------ */
150 /* 5.1.0 new release (current)
151 * 4.1.34 changed the size of the time structure used for pps
152 * 4.1.16 moved the location of fr_flineno
155 typedef struct frentry_4_1_34 {
157 struct frentry *fr_next;
158 struct frentry **fr_grp;
159 struct ipscan *fr_isc;
161 void *fr_ptr; /* for use with fr_arg */
162 char *fr_comment; /* text comment for rule */
163 int fr_ref; /* reference count - for grouping */
164 int fr_statecnt; /* state count - for limit rules */
165 int fr_flineno; /* line number from conf file */
169 struct timeval frp_lastpkt;
177 frentfunc_t fru_func;
179 ipfunc_t fr_func; /* call this function */
182 int fr_statemax; /* max reference count */
184 u_32_t fr_flags; /* per-rule flags && options (see below) */
185 u_32_t fr_logtag; /* user defined log tag # */
186 u_32_t fr_collect; /* collection number */
187 u_int fr_arg; /* misc. numeric arg for rule */
188 u_int fr_loglevel; /* syslog log facility + priority */
189 u_int fr_age[2]; /* non-TCP timeouts */
191 u_char fr_icode; /* return ICMP code */
192 char fr_group[FR_GROUPLEN]; /* group to which this rule belongs */
193 char fr_grhead[FR_GROUPLEN]; /* group # which this rule starts */
195 char fr_ifnames[4][LIFNAMSIZ];
197 frdest_4_t fr_tifs[2]; /* "to"/"reply-to" interface */
198 frdest_4_t fr_dif; /* duplicate packet interface */
199 u_int fr_cksum; /* checksum on filter rules for performance */
202 typedef struct frentry_4_1_16 {
204 struct frentry *fr_next;
205 struct frentry **fr_grp;
206 struct ipscan *fr_isc;
217 timeval_l_t frp_lastpkt;
219 struct timeval frp_lastpkt;
227 frentfunc_t fru_func;
242 char fr_group[FR_GROUPLEN];
243 char fr_grhead[FR_GROUPLEN];
245 char fr_ifnames[4][LIFNAMSIZ];
247 frdest_4_t fr_tifs[2];
252 typedef struct frentry_4_1_0 {
254 struct frentry *fr_next;
255 struct frentry **fr_grp;
256 struct ipscan *fr_isc;
266 timeval_l_t frp_lastpkt;
268 struct timeval frp_lastpkt;
277 frentfunc_t fru_func;
280 * Fields after this may not change whilst in the kernel.
296 char fr_group[FR_GROUPLEN];
297 char fr_grhead[FR_GROUPLEN];
299 char fr_ifnames[4][LIFNAMSIZ];
301 frdest_4_t fr_tifs[2];
306 /* ------------------------------------------------------------------------ */
309 * 5.1.0 new release (current)
310 * 4.1.32 removed both fin_state and fin_nat, added fin_pktnum
311 * 4.1.24 added fin_cksum
312 * 4.1.23 added fin_exthdr
313 * 4.1.11 added fin_ifname
314 * 4.1.4 added fin_hbuf
316 typedef struct fr_info_4_1_32 {
317 void *fin_ifp; /* interface packet is `on' */
318 frip4_t fin_fi; /* IP Packet summary */
320 u_short fid_16[2]; /* TCP/UDP ports, ICMP code/type */
323 int fin_out; /* in or out ? 1 == out, 0 == in */
324 int fin_rev; /* state only: 1 = reverse */
325 u_short fin_hlen; /* length of IP header in bytes */
326 u_char ofin_tcpf; /* TCP header flags (SYN, ACK, etc) */
327 u_char fin_icode; /* ICMP error to return */
328 u_32_t fin_rule; /* rule # last matched */
329 char fin_group[FR_GROUPLEN]; /* group number, -1 for none */
330 struct frentry *fin_fr; /* last matching rule */
331 void *fin_dp; /* start of data past IP header */
332 int fin_dlen; /* length of data portion of packet */
334 int fin_ipoff; /* # bytes from buffer start to hdr */
335 u_short fin_id; /* IP packet id field */
337 int fin_depth; /* Group nesting depth */
338 int fin_error; /* Error code to return */
339 int fin_cksum; /* -1 bad, 1 good, 0 not done */
344 mb_t **fin_mp; /* pointer to pointer to mbuf */
345 mb_t *fin_m; /* pointer to mbuf */
347 mb_t *fin_qfm; /* pointer to mblk where pkt starts */
349 char fin_ifname[LIFNAMSIZ];
356 typedef struct fr_info_4_1_24 {
369 char fin_group[FR_GROUPLEN];
370 struct frentry *fin_fr;
390 char fin_ifname[LIFNAMSIZ];
397 typedef struct fr_info_4_1_23 {
410 char fin_group[FR_GROUPLEN];
411 struct frentry *fin_fr;
430 char fin_ifname[LIFNAMSIZ];
437 typedef struct fr_info_4_1_11 {
450 char fin_group[FR_GROUPLEN];
451 struct frentry *fin_fr;
469 char fin_ifname[LIFNAMSIZ];
476 /* ------------------------------------------------------------------------ */
478 typedef struct filterstats_4_1 {
479 u_long fr_pass; /* packets allowed */
480 u_long fr_block; /* packets denied */
481 u_long fr_nom; /* packets which don't match any rule */
482 u_long fr_short; /* packets which are short */
483 u_long fr_ppkl; /* packets allowed and logged */
484 u_long fr_bpkl; /* packets denied and logged */
485 u_long fr_npkl; /* packets unmatched and logged */
486 u_long fr_pkl; /* packets logged */
487 u_long fr_skip; /* packets to be logged but buffer full */
488 u_long fr_ret; /* packets for which a return is sent */
489 u_long fr_acct; /* packets for which counting was performed */
490 u_long fr_bnfr; /* bad attempts to allocate fragment state */
491 u_long fr_nfr; /* new fragment state kept */
492 u_long fr_cfr; /* add new fragment state but complete pkt */
493 u_long fr_bads; /* bad attempts to allocate packet state */
494 u_long fr_ads; /* new packet state kept */
495 u_long fr_chit; /* cached hit */
496 u_long fr_tcpbad; /* TCP checksum check failures */
497 u_long fr_pull[2]; /* good and bad pullup attempts */
498 u_long fr_badsrc; /* source received doesn't match route */
499 u_long fr_badttl; /* TTL in packet doesn't reach minimum */
500 u_long fr_bad; /* bad IP packets to the filter */
501 u_long fr_ipv6; /* IPv6 packets in/out */
502 u_long fr_ppshit; /* dropped because of pps ceiling */
503 u_long fr_ipud; /* IP id update failures */
507 * 5.1.0 new release (current)
508 * 4.1.33 changed the size of f_locks from IPL_LOGMAX to IPL_LOGSIZE
510 typedef struct friostat_4_1_33 {
511 struct filterstats_4_1 of_st[2];
512 struct frentry *f_ipf[2][2];
513 struct frentry *f_acct[2][2];
514 struct frentry *f_ipf6[2][2];
515 struct frentry *f_acct6[2][2];
516 struct frentry *f_auth;
517 struct frgroup *f_groups[IPL_LOGSIZE][2];
520 int f_locks[IPL_LOGSIZE];
523 int f_defpass; /* default pass - from fr_pass */
524 int f_active; /* 1 or 0 - active rule set */
525 int f_running; /* 1 if running, else 0 */
526 int f_logging; /* 1 if enabled, else 0 */
528 char f_version[32]; /* version string */
531 typedef struct friostat_4_1_0 {
532 struct filterstats_4_1 of_st[2];
533 struct frentry *f_ipf[2][2];
534 struct frentry *f_acct[2][2];
535 struct frentry *f_ipf6[2][2];
536 struct frentry *f_acct6[2][2];
537 struct frentry *f_auth;
538 struct frgroup *f_groups[IPL_LOGSIZE][2];
541 int f_locks[IPL_LOGMAX];
552 /* ------------------------------------------------------------------------ */
555 * 5.1.0 new release (current)
556 * 4.1.14 added in_lock
558 typedef struct ipnat_4_1_14 {
560 struct ipnat *in_next; /* NAT rule list next */
561 struct ipnat *in_rnext; /* rdr rule hash next */
562 struct ipnat **in_prnext; /* prior rdr next ptr */
563 struct ipnat *in_mnext; /* map rule hash next */
564 struct ipnat **in_pmnext; /* prior map next ptr */
565 struct ipftq *in_tqehead[2];
574 int in_flineno; /* conf. file line number */
578 /* From here to the end is covered by IPN_CMPSIZ */
580 u_32_t in_mssclamp; /* if != 0 clamp MSS to this */
582 int in_redir; /* see below for values */
583 int in_p; /* protocol. */
589 u_short in_ppip; /* ports per IP. */
590 u_short in_ippip; /* IP #'s per IP# */
591 char in_ifnames[2][LIFNAMSIZ];
592 char in_plabel[APR_LABELLEN]; /* proxy label. */
596 typedef struct ipnat_4_1_0 {
597 struct ipnat *in_next;
598 struct ipnat *in_rnext;
599 struct ipnat **in_prnext;
600 struct ipnat *in_mnext;
601 struct ipnat **in_pmnext;
602 struct ipftq *in_tqehead[2];
627 char in_ifnames[2][LIFNAMSIZ];
628 char in_plabel[APR_LABELLEN];
632 /* ------------------------------------------------------------------------ */
634 typedef struct natlookup_4_1_1 {
635 struct in_addr onl_inip;
636 struct in_addr onl_outip;
637 struct in_addr onl_realip;
644 /* ------------------------------------------------------------------------ */
647 * 4.1.25 added nat_seqnext (current)
648 * 4.1.14 added nat_redir
649 * 4.1.3 moved nat_rev
650 * 4.1.2 added nat_rev
652 typedef struct nat_4_1_25 {
654 struct nat_4_1_25 *nat_next;
655 struct nat_4_1_25 **nat_pnext;
656 struct nat_4_1_25 *nat_hnext[2];
657 struct nat_4_1_25 **nat_phnext[2];
658 struct hostmap *nat_hm;
660 struct nat_4_1_25 **nat_me;
661 struct ipstate *nat_state;
662 struct ap_session *nat_aps;
664 struct ipnat_4_1_14 *nat_ptr;
675 U_QUAD_T nat_pkts[2];
676 U_QUAD_T nat_bytes[2];
689 char nat_ifnames[2][LIFNAMSIZ];
692 u_32_t nat_seqnext[2];
695 typedef struct nat_4_1_14 {
697 struct nat *nat_next;
698 struct nat **nat_pnext;
699 struct nat *nat_hnext[2];
700 struct nat **nat_phnext[2];
701 struct hostmap *nat_hm;
704 struct ipstate *nat_state;
705 struct ap_session *nat_aps;
707 struct ipnat *nat_ptr;
718 U_QUAD_T nat_pkts[2];
719 U_QUAD_T nat_bytes[2];
732 char nat_ifnames[2][LIFNAMSIZ];
737 typedef struct nat_4_1_3 {
739 struct nat *nat_next;
740 struct nat **nat_pnext;
741 struct nat *nat_hnext[2];
742 struct nat **nat_phnext[2];
743 struct hostmap *nat_hm;
746 struct ipstate *nat_state;
747 struct ap_session *nat_aps;
749 struct ipnat *nat_ptr;
760 U_QUAD_T nat_pkts[2];
761 U_QUAD_T nat_bytes[2];
774 char nat_ifnames[2][LIFNAMSIZ];
780 typedef struct nat_save_4_1_34 {
782 struct nat_4_1_25 ipn_nat;
783 struct ipnat_4_1_14 ipn_ipnat;
784 struct frentry_4_1_34 ipn_fr;
789 typedef struct nat_save_4_1_16 {
791 nat_4_1_14_t ipn_nat;
793 frentry_4_1_16_t ipn_fr;
798 typedef struct nat_save_4_1_14 {
800 nat_4_1_14_t ipn_nat;
802 frentry_4_1_0_t ipn_fr;
807 typedef struct nat_save_4_1_3 {
810 ipnat_4_1_0_t ipn_ipnat;
811 frentry_4_1_0_t ipn_fr;
816 /* ------------------------------------------------------------------------ */
819 * 5.1.0 new release (current)
820 * 4.1.32 added ns_uncreate
821 * 4.1.27 added ns_orphans
822 * 4.1.16 added ns_ticks
824 typedef struct natstat_4_1_32 {
836 hostmap_t **ns_maptable;
847 hostmap_t *ns_maplist;
848 u_long *ns_bucketlen[2];
851 u_long ns_uncreate[2][2];
854 typedef struct natstat_4_1_27 {
866 hostmap_t **ns_maptable;
877 hostmap_t *ns_maplist;
878 u_long *ns_bucketlen[2];
883 typedef struct natstat_4_1_16 {
895 hostmap_t **ns_maptable;
906 hostmap_t *ns_maplist;
907 u_long *ns_bucketlen[2];
911 typedef struct natstat_4_1_0 {
923 hostmap_t **ns_maptable;
934 hostmap_t *ns_maplist;
935 u_long *ns_bucketlen[2];
938 /* ------------------------------------------------------------------------ */
941 * 5.1.0 new release (current)
942 * 4.1.32 fra_info:removed both fin_state & fin_nat, added fin_pktnum
943 * 4.1.29 added fra_flx
944 * 4.1.24 fra_info:added fin_cksum
945 * 4.1.23 fra_info:added fin_exthdr
946 * 4.1.11 fra_info:added fin_ifname
947 * 4.1.4 fra_info:added fin_hbuf
950 typedef struct frauth_4_1_32 {
955 fr_info_4_1_32_t fra_info;
964 typedef struct frauth_4_1_29 {
969 fr_info_4_1_24_t fra_info;
978 typedef struct frauth_4_1_24 {
983 fr_info_4_1_24_t fra_info;
991 typedef struct frauth_4_1_23 {
996 fr_info_4_1_23_t fra_info;
1004 typedef struct frauth_4_1_11 {
1009 fr_info_4_1_11_t fra_info;
1017 /* ------------------------------------------------------------------------ */
1020 * 5.1.0 new release (current)
1021 * 4.1.16 removed is_nat
1023 typedef struct ipstate_4_1_16 {
1025 struct ipstate *is_next;
1026 struct ipstate **is_pnext;
1027 struct ipstate *is_hnext;
1028 struct ipstate **is_phnext;
1029 struct ipstate **is_me;
1033 struct ipftq *is_tqehead[2];
1034 struct ipscan *is_isc;
1035 U_QUAD_T is_pkts[4];
1036 U_QUAD_T is_bytes[4];
1037 U_QUAD_T is_icmppkts[4];
1038 struct ipftqent is_sti;
1040 int is_ref; /* reference count */
1046 u_char is_p; /* Protocol */
1050 u_32_t is_opt[2]; /* packet options set */
1051 u_32_t is_optmsk[2]; /* " " mask */
1052 u_short is_sec; /* security options set */
1053 u_short is_secmsk; /* " " mask */
1054 u_short is_auth; /* authentication options set */
1055 u_short is_authmsk; /* " " mask */
1064 u_32_t is_rulen; /* rule number when created */
1067 char is_group[FR_GROUPLEN];
1068 char is_sbuf[2][16];
1069 char is_ifname[4][LIFNAMSIZ];
1072 typedef struct ipstate_4_1_0 {
1074 struct ipstate *is_next;
1075 struct ipstate **is_pnext;
1076 struct ipstate *is_hnext;
1077 struct ipstate **is_phnext;
1078 struct ipstate **is_me;
1083 struct ipftq *is_tqehead[2];
1084 struct ipscan *is_isc;
1085 U_QUAD_T is_pkts[4];
1086 U_QUAD_T is_bytes[4];
1087 U_QUAD_T is_icmppkts[4];
1088 struct ipftqent is_sti;
1101 u_32_t is_optmsk[2];
1117 char is_group[FR_GROUPLEN];
1118 char is_sbuf[2][16];
1119 char is_ifname[4][LIFNAMSIZ];
1122 typedef struct ipstate_save_4_1_34 {
1124 struct ipstate_4_1_16 ips_is;
1125 struct frentry_4_1_34 ips_fr;
1126 } ipstate_save_4_1_34_t;
1128 typedef struct ipstate_save_4_1_16 {
1130 ipstate_4_1_0_t ips_is;
1131 frentry_4_1_16_t ips_fr;
1132 } ipstate_save_4_1_16_t;
1134 typedef struct ipstate_save_4_1_0 {
1136 ipstate_4_1_0_t ips_is;
1137 frentry_4_1_0_t ips_fr;
1138 } ipstate_save_4_1_0_t;
1140 /* ------------------------------------------------------------------------ */
1143 * 5.1.0 new release (current)
1144 * 4.1.21 added iss_tcptab
1146 typedef struct ips_stat_4_1_21 {
1164 u_long iss_bucketfull;
1167 ipstate_t **iss_table;
1168 ipstate_t *iss_list;
1169 u_long *iss_bucketlen;
1170 ipftq_t *iss_tcptab;
1171 } ips_stat_4_1_21_t;
1173 typedef struct ips_stat_4_1_0 {
1191 u_long iss_bucketfull;
1194 ipstate_t **iss_table;
1195 ipstate_t *iss_list;
1196 u_long *iss_bucketlen;
1199 /* ------------------------------------------------------------------------ */
1201 typedef struct ipfrstat_4_1_1 {
1202 u_long ifs_exists; /* add & already exists */
1208 u_long ifs_retrans0;
1210 struct ipfr **ifs_table;
1211 struct ipfr **ifs_nattab;
1214 /* ------------------------------------------------------------------------ */
1215 static int ipf_addfrstr __P((char *, int, char *, int));
1216 static void ipf_v4iptov5 __P((frip4_t *, fr_ip_t *));
1217 static void ipf_v5iptov4 __P((fr_ip_t *, frip4_t *));
1218 static void ipfv4tuctov5 __P((frtuc4_t *, frtuc_t *));
1219 static void ipfv5tuctov4 __P((frtuc_t *, frtuc4_t *));
1220 static int ipf_v4fripftov5 __P((fripf4_t *, char *));
1221 static void ipf_v5fripftov4 __P((fripf_t *, fripf4_t *));
1222 static int fr_frflags4to5 __P((u_32_t));
1223 static int fr_frflags5to4 __P((u_32_t));
1225 static void friostat_current_to_4_1_0 __P((void *, friostat_4_1_0_t *, int));
1226 static void friostat_current_to_4_1_33 __P((void *, friostat_4_1_33_t *, int));
1227 static void ipstate_current_to_4_1_0 __P((void *, ipstate_4_1_0_t *));
1228 static void ipstate_current_to_4_1_16 __P((void *, ipstate_4_1_16_t *));
1229 static void ipnat_current_to_4_1_0 __P((void *, ipnat_4_1_0_t *));
1230 static void ipnat_current_to_4_1_14 __P((void *, ipnat_4_1_14_t *));
1231 static void frauth_current_to_4_1_11 __P((void *, frauth_4_1_11_t *));
1232 static void frauth_current_to_4_1_23 __P((void *, frauth_4_1_23_t *));
1233 static void frauth_current_to_4_1_24 __P((void *, frauth_4_1_24_t *));
1234 static void frauth_current_to_4_1_29 __P((void *, frauth_4_1_29_t *));
1235 static void frentry_current_to_4_1_0 __P((void *, frentry_4_1_0_t *));
1236 static void frentry_current_to_4_1_16 __P((void *, frentry_4_1_16_t *));
1237 static void frentry_current_to_4_1_34 __P((void *, frentry_4_1_34_t *));
1238 static void fr_info_current_to_4_1_11 __P((void *, fr_info_4_1_11_t *));
1239 static void fr_info_current_to_4_1_23 __P((void *, fr_info_4_1_23_t *));
1240 static void fr_info_current_to_4_1_24 __P((void *, fr_info_4_1_24_t *));
1241 static void nat_save_current_to_4_1_3 __P((void *, nat_save_4_1_3_t *));
1242 static void nat_save_current_to_4_1_14 __P((void *, nat_save_4_1_14_t *));
1243 static void nat_save_current_to_4_1_16 __P((void *, nat_save_4_1_16_t *));
1244 static void ipstate_save_current_to_4_1_0 __P((void *, ipstate_save_4_1_0_t *));
1245 static void ipstate_save_current_to_4_1_16 __P((void *, ipstate_save_4_1_16_t *));
1246 static void ips_stat_current_to_4_1_0 __P((void *, ips_stat_4_1_0_t *));
1247 static void ips_stat_current_to_4_1_21 __P((void *, ips_stat_4_1_21_t *));
1248 static void natstat_current_to_4_1_0 __P((void *, natstat_4_1_0_t *));
1249 static void natstat_current_to_4_1_16 __P((void *, natstat_4_1_16_t *));
1250 static void natstat_current_to_4_1_27 __P((void *, natstat_4_1_27_t *));
1251 static void natstat_current_to_4_1_32 __P((void *, natstat_4_1_32_t *));
1252 static void nat_current_to_4_1_3 __P((void *, nat_4_1_3_t *));
1253 static void nat_current_to_4_1_14 __P((void *, nat_4_1_14_t *));
1254 static void nat_current_to_4_1_25 __P((void *, nat_4_1_25_t *));
1256 static void friostat_4_1_0_to_current __P((friostat_4_1_0_t *, void *));
1257 static void friostat_4_1_33_to_current __P((friostat_4_1_33_t *, void *));
1258 static void ipnat_4_1_0_to_current __P((ipnat_4_1_0_t *, void *, int));
1259 static void ipnat_4_1_14_to_current __P((ipnat_4_1_14_t *, void *, int));
1260 static void frauth_4_1_11_to_current __P((frauth_4_1_11_t *, void *));
1261 static void frauth_4_1_23_to_current __P((frauth_4_1_23_t *, void *));
1262 static void frauth_4_1_24_to_current __P((frauth_4_1_24_t *, void *));
1263 static void frauth_4_1_29_to_current __P((frauth_4_1_29_t *, void *));
1264 static void frauth_4_1_32_to_current __P((frauth_4_1_32_t *, void *));
1265 static void frentry_4_1_0_to_current __P((ipf_main_softc_t *, frentry_4_1_0_t *, void *, int));
1266 static void frentry_4_1_16_to_current __P((ipf_main_softc_t *, frentry_4_1_16_t *, void *, int));
1267 static void frentry_4_1_34_to_current __P((ipf_main_softc_t *, frentry_4_1_34_t *, void *, int));
1268 static void fr_info_4_1_11_to_current __P((fr_info_4_1_11_t *, void *));
1269 static void fr_info_4_1_23_to_current __P((fr_info_4_1_23_t *, void *));
1270 static void fr_info_4_1_24_to_current __P((fr_info_4_1_24_t *, void *));
1271 static void fr_info_4_1_32_to_current __P((fr_info_4_1_32_t *, void *));
1272 static void nat_save_4_1_3_to_current __P((ipf_main_softc_t *, nat_save_4_1_3_t *, void *));
1273 static void nat_save_4_1_14_to_current __P((ipf_main_softc_t *, nat_save_4_1_14_t *, void *));
1274 static void nat_save_4_1_16_to_current __P((ipf_main_softc_t *, nat_save_4_1_16_t *, void *));
1276 /* ------------------------------------------------------------------------ */
1277 /* In this section is a series of short routines that deal with translating */
1278 /* the smaller data structures used above as their internal changes make */
1279 /* them inappropriate for simple assignment. */
1280 /* ------------------------------------------------------------------------ */
1284 ipf_addfrstr(char *names, int namelen, char *str, int maxlen)
1289 for (i = maxlen, t = str; (*t != '\0') && (i > 0); i--) {
1290 names[namelen++] = *t++;
1292 names[namelen++] = '\0';
1298 ipf_v4iptov5(v4, v5)
1302 v5->fi_v = v4->fi_v;
1303 v5->fi_p = v4->fi_p;
1304 v5->fi_xx = v4->fi_xx;
1305 v5->fi_tos = v4->fi_tos;
1306 v5->fi_ttl = v4->fi_ttl;
1307 v5->fi_p = v4->fi_p;
1308 v5->fi_optmsk = v4->fi_optmsk;
1309 v5->fi_src = v4->fi_src;
1310 v5->fi_dst = v4->fi_dst;
1311 v5->fi_secmsk = v4->ofi_secmsk;
1312 v5->fi_auth = v4->ofi_auth;
1313 v5->fi_flx = v4->fi_flx;
1314 v5->fi_tcpmsk = v4->fi_tcpmsk;
1318 ipf_v5iptov4(v5, v4)
1322 v4->fi_v = v5->fi_v;
1323 v4->fi_p = v5->fi_p;
1324 v4->fi_xx = v5->fi_xx;
1325 v4->fi_tos = v5->fi_tos;
1326 v4->fi_ttl = v5->fi_ttl;
1327 v4->fi_p = v5->fi_p;
1328 v4->fi_optmsk = v5->fi_optmsk;
1329 v4->fi_src = v5->fi_src;
1330 v4->fi_dst = v5->fi_dst;
1331 v4->ofi_secmsk = v5->fi_secmsk;
1332 v4->ofi_auth = v5->fi_auth;
1333 v4->fi_flx = v5->fi_flx;
1334 v4->fi_tcpmsk = v5->fi_tcpmsk;
1339 ipfv4tuctov5(v4, v5)
1343 v5->ftu_src.frp_cmp = v4->ftu_src.frp_cmp;
1344 v5->ftu_src.frp_port = v4->ftu_src.frp_port;
1345 v5->ftu_src.frp_top = v4->ftu_src.frp_top;
1346 v5->ftu_dst.frp_cmp = v4->ftu_dst.frp_cmp;
1347 v5->ftu_dst.frp_port = v4->ftu_dst.frp_port;
1348 v5->ftu_dst.frp_top = v4->ftu_dst.frp_top;
1353 ipfv5tuctov4(v5, v4)
1357 v4->ftu_src.frp_cmp = v5->ftu_src.frp_cmp;
1358 v4->ftu_src.frp_port = v5->ftu_src.frp_port;
1359 v4->ftu_src.frp_top = v5->ftu_src.frp_top;
1360 v4->ftu_dst.frp_cmp = v5->ftu_dst.frp_cmp;
1361 v4->ftu_dst.frp_port = v5->ftu_dst.frp_port;
1362 v4->ftu_dst.frp_top = v5->ftu_dst.frp_top;
1367 ipf_v4fripftov5(frp4, dst)
1373 frp = (fripf_t *)dst;
1375 ipf_v4iptov5(&frp4->fri_ip, &frp->fri_ip);
1376 ipf_v4iptov5(&frp4->fri_mip, &frp->fri_mip);
1377 frp->fri_icmpm = frp4->fri_icmpm;
1378 frp->fri_icmp = frp4->fri_icmp;
1379 frp->fri_tuc.ftu_tcpfm = frp4->fri_tuc.ftu_tcpfm;
1380 frp->fri_tuc.ftu_tcpf = frp4->fri_tuc.ftu_tcpf;
1381 ipfv4tuctov5(&frp4->fri_tuc, &frp->fri_tuc);
1382 frp->fri_satype = frp4->fri_satype;
1383 frp->fri_datype = frp4->fri_datype;
1384 frp->fri_sifpidx = frp4->fri_sifpidx;
1385 frp->fri_difpidx = frp4->fri_difpidx;
1391 ipf_v5fripftov4(frp, frp4)
1396 ipf_v5iptov4(&frp->fri_ip, &frp4->fri_ip);
1397 ipf_v5iptov4(&frp->fri_mip, &frp4->fri_mip);
1398 frp4->fri_icmpm = frp->fri_icmpm;
1399 frp4->fri_icmp = frp->fri_icmp;
1400 frp4->fri_tuc.ftu_tcpfm = frp->fri_tuc.ftu_tcpfm;
1401 frp4->fri_tuc.ftu_tcpf = frp->fri_tuc.ftu_tcpf;
1402 ipfv5tuctov4(&frp->fri_tuc, &frp4->fri_tuc);
1403 frp4->fri_satype = frp->fri_satype;
1404 frp4->fri_datype = frp->fri_datype;
1405 frp4->fri_sifpidx = frp->fri_sifpidx;
1406 frp4->fri_difpidx = frp->fri_difpidx;
1410 /* ------------------------------------------------------------------------ */
1411 /* ipf_in_compat is the first of two service routines. It is responsible for*/
1412 /* converting data structures from user space into what's required by the */
1413 /* kernel module. */
1414 /* ------------------------------------------------------------------------ */
1416 ipf_in_compat(softc, obj, ptr, size)
1417 ipf_main_softc_t *softc;
1428 switch (obj->ipfo_type)
1433 case IPFOBJ_FRENTRY :
1434 if (obj->ipfo_rev >= 4013400) {
1435 frentry_4_1_34_t *old;
1437 KMALLOC(old, frentry_4_1_34_t *);
1443 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1445 if (old->fr_type != FR_T_NONE &&
1446 old->fr_type != FR_T_IPF) {
1452 frentry_4_1_34_to_current(softc, old,
1458 } else if (obj->ipfo_rev >= 4011600) {
1459 frentry_4_1_16_t *old;
1461 KMALLOC(old, frentry_4_1_16_t *);
1467 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1469 if (old->fr_type != FR_T_NONE &&
1470 old->fr_type != FR_T_IPF) {
1476 frentry_4_1_16_to_current(softc, old,
1483 frentry_4_1_0_t *old;
1485 KMALLOC(old, frentry_4_1_0_t *);
1491 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1493 if (old->fr_type != FR_T_NONE &&
1494 old->fr_type != FR_T_IPF) {
1500 frentry_4_1_0_to_current(softc, old, ptr, size);
1508 case IPFOBJ_IPFSTAT :
1509 if (obj->ipfo_rev >= 4013300) {
1510 friostat_4_1_33_t *old;
1512 KMALLOC(old, friostat_4_1_33_t *);
1518 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1520 friostat_4_1_33_to_current(old, ptr);
1525 friostat_4_1_0_t *old;
1527 KMALLOC(old, friostat_4_1_0_t *);
1533 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1535 friostat_4_1_0_to_current(old, ptr);
1542 case IPFOBJ_IPFINFO : /* unused */
1546 if (obj->ipfo_rev >= 4011400) {
1547 ipnat_4_1_14_t *old;
1549 KMALLOC(old, ipnat_4_1_14_t *);
1555 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1557 ipnat_4_1_14_to_current(old, ptr, size);
1565 KMALLOC(old, ipnat_4_1_0_t *);
1571 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1573 ipnat_4_1_0_to_current(old, ptr, size);
1581 case IPFOBJ_NATSTAT :
1583 * Statistics are not copied in.
1587 case IPFOBJ_NATSAVE :
1588 if (obj->ipfo_rev >= 4011600) {
1589 nat_save_4_1_16_t *old16;
1591 KMALLOC(old16, nat_save_4_1_16_t *);
1592 if (old16 == NULL) {
1597 error = COPYIN(obj->ipfo_ptr, old16, sizeof(*old16));
1599 nat_save_4_1_16_to_current(softc, old16, ptr);
1604 } else if (obj->ipfo_rev >= 4011400) {
1605 nat_save_4_1_14_t *old14;
1607 KMALLOC(old14, nat_save_4_1_14_t *);
1608 if (old14 == NULL) {
1613 error = COPYIN(obj->ipfo_ptr, old14, sizeof(*old14));
1615 nat_save_4_1_14_to_current(softc, old14, ptr);
1620 } else if (obj->ipfo_rev >= 4010300) {
1621 nat_save_4_1_3_t *old3;
1623 KMALLOC(old3, nat_save_4_1_3_t *);
1629 error = COPYIN(obj->ipfo_ptr, old3, sizeof(*old3));
1631 nat_save_4_1_3_to_current(softc, old3, ptr);
1639 case IPFOBJ_STATESAVE :
1640 if (obj->ipfo_rev >= 4013400) {
1641 ipstate_save_4_1_34_t *old;
1643 KMALLOC(old, ipstate_save_4_1_34_t *);
1649 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1654 } else if (obj->ipfo_rev >= 4011600) {
1655 ipstate_save_4_1_16_t *old;
1657 KMALLOC(old, ipstate_save_4_1_16_t *);
1663 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1669 ipstate_save_4_1_0_t *old;
1671 KMALLOC(old, ipstate_save_4_1_0_t *);
1677 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1685 case IPFOBJ_IPSTATE :
1687 * This structure is not copied in by itself.
1691 case IPFOBJ_STATESTAT :
1693 * Statistics are not copied in.
1697 case IPFOBJ_FRAUTH :
1698 if (obj->ipfo_rev >= 4013200) {
1699 frauth_4_1_32_t *old32;
1701 KMALLOC(old32, frauth_4_1_32_t *);
1702 if (old32 == NULL) {
1707 error = COPYIN(obj->ipfo_ptr, old32, sizeof(*old32));
1709 frauth_4_1_32_to_current(old32, ptr);
1714 } else if (obj->ipfo_rev >= 4012900) {
1715 frauth_4_1_29_t *old29;
1717 KMALLOC(old29, frauth_4_1_29_t *);
1718 if (old29 == NULL) {
1723 error = COPYIN(obj->ipfo_ptr, old29, sizeof(*old29));
1725 frauth_4_1_29_to_current(old29, ptr);
1730 } else if (obj->ipfo_rev >= 4012400) {
1731 frauth_4_1_24_t *old24;
1733 KMALLOC(old24, frauth_4_1_24_t *);
1734 if (old24 == NULL) {
1739 error = COPYIN(obj->ipfo_ptr, old24, sizeof(*old24));
1741 frauth_4_1_24_to_current(old24, ptr);
1746 } else if (obj->ipfo_rev >= 4012300) {
1747 frauth_4_1_23_t *old23;
1749 KMALLOC(old23, frauth_4_1_23_t *);
1750 if (old23 == NULL) {
1755 error = COPYIN(obj->ipfo_ptr, old23, sizeof(*old23));
1757 frauth_4_1_23_to_current(old23, ptr);
1759 } else if (obj->ipfo_rev >= 4011100) {
1760 frauth_4_1_11_t *old11;
1762 KMALLOC(old11, frauth_4_1_11_t *);
1763 if (old11 == NULL) {
1768 error = COPYIN(obj->ipfo_ptr, old11, sizeof(*old11));
1770 frauth_4_1_11_to_current(old11, ptr);
1779 if (obj->ipfo_rev >= 4011400) {
1780 sz = sizeof(nat_4_1_14_t);
1781 } else if (obj->ipfo_rev >= 4010300) {
1782 sz = sizeof(nat_4_1_3_t);
1786 bzero(ptr, sizeof(nat_t));
1787 error = COPYIN(obj->ipfo_ptr, ptr, sz);
1794 if (obj->ipfo_rev < 5000000) {
1797 KMALLOC(old, fripf4_t *);
1803 error = COPYIN(obj->ipfo_ptr, old, sizeof(*old));
1805 ipf_v4fripftov5(old, ptr);
1816 /* ------------------------------------------------------------------------ */
1820 * flags is v4 flags, returns v5 flags.
1823 fr_frflags4to5(flags)
1828 switch (flags & 0xf) {
1842 nflags |= FR_PREAUTH;
1845 nflags |= FR_ACCOUNT;
1854 if (flags & 0x00010)
1856 if (flags & 0x00020)
1857 nflags |= FR_CALLNOW;
1858 if (flags & 0x00080)
1859 nflags |= FR_NOTSRCIP;
1860 if (flags & 0x00040)
1861 nflags |= FR_NOTDSTIP;
1862 if (flags & 0x00100)
1864 if (flags & 0x00200)
1865 nflags |= FR_KEEPFRAG;
1866 if (flags & 0x00400)
1867 nflags |= FR_KEEPSTATE;
1868 if (flags & 0x00800)
1869 nflags |= FR_FASTROUTE;
1870 if (flags & 0x01000)
1871 nflags |= FR_RETRST;
1872 if (flags & 0x02000)
1873 nflags |= FR_RETICMP;
1874 if (flags & 0x03000)
1875 nflags |= FR_FAKEICMP;
1876 if (flags & 0x04000)
1877 nflags |= FR_OUTQUE;
1878 if (flags & 0x08000)
1880 if (flags & 0x10000)
1881 nflags |= FR_LOGBODY;
1882 if (flags & 0x20000)
1883 nflags |= FR_LOGFIRST;
1884 if (flags & 0x40000)
1885 nflags |= FR_LOGORBLOCK;
1886 if (flags & 0x100000)
1887 nflags |= FR_FRSTRICT;
1888 if (flags & 0x200000)
1889 nflags |= FR_STSTRICT;
1890 if (flags & 0x400000)
1891 nflags |= FR_NEWISN;
1892 if (flags & 0x800000)
1893 nflags |= FR_NOICMPERR;
1894 if (flags & 0x1000000)
1895 nflags |= FR_STATESYNC;
1896 if (flags & 0x8000000)
1897 nflags |= FR_NOMATCH;
1898 if (flags & 0x40000000)
1899 nflags |= FR_COPIED;
1900 if (flags & 0x80000000)
1901 nflags |= FR_INACTIVE;
1907 frentry_4_1_34_to_current(softc, old, current, size)
1908 ipf_main_softc_t *softc;
1909 frentry_4_1_34_t *old;
1913 frentry_t *fr = (frentry_t *)current;
1915 fr->fr_comment = -1;
1916 fr->fr_ref = old->fr_ref;
1917 fr->fr_statecnt = old->fr_statecnt;
1918 fr->fr_hits = old->fr_hits;
1919 fr->fr_bytes = old->fr_bytes;
1920 fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
1921 fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
1922 bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
1923 fr->fr_func = old->fr_func;
1924 fr->fr_dsize = old->fr_dsize;
1925 fr->fr_pps = old->fr_pps;
1926 fr->fr_statemax = old->fr_statemax;
1927 fr->fr_flineno = old->fr_flineno;
1928 fr->fr_type = old->fr_type;
1929 fr->fr_flags = fr_frflags4to5(old->fr_flags);
1930 fr->fr_logtag = old->fr_logtag;
1931 fr->fr_collect = old->fr_collect;
1932 fr->fr_arg = old->fr_arg;
1933 fr->fr_loglevel = old->fr_loglevel;
1934 fr->fr_age[0] = old->fr_age[0];
1935 fr->fr_age[1] = old->fr_age[1];
1936 fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
1937 fr->fr_tifs[0].fd_type = FRD_NORMAL;
1938 fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
1939 fr->fr_tifs[1].fd_type = FRD_NORMAL;
1940 fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
1941 fr->fr_dif.fd_type = FRD_NORMAL;
1943 fr->fr_family = AF_INET;
1945 fr->fr_family = AF_INET6;
1946 fr->fr_icode = old->fr_icode;
1947 fr->fr_cksum = old->fr_cksum;
1949 fr->fr_ifnames[0] = -1;
1950 fr->fr_ifnames[1] = -1;
1951 fr->fr_ifnames[2] = -1;
1952 fr->fr_ifnames[3] = -1;
1953 fr->fr_dif.fd_name = -1;
1954 fr->fr_tifs[0].fd_name = -1;
1955 fr->fr_tifs[1].fd_name = -1;
1958 fr->fr_icmphead = -1;
1960 fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
1961 fr->fr_size += sizeof(fripf_t) + 16;
1962 fr->fr_size += 9; /* room for \0's */
1964 char *names = fr->fr_names;
1965 int nlen = fr->fr_namelen;
1968 if (old->fr_ifnames[0][0] != '\0') {
1969 fr->fr_ifnames[0] = nlen;
1970 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
1973 if (old->fr_ifnames[1][0] != '\0') {
1974 fr->fr_ifnames[1] = nlen;
1975 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
1978 if (old->fr_ifnames[2][0] != '\0') {
1979 fr->fr_ifnames[2] = nlen;
1980 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
1983 if (old->fr_ifnames[3][0] != '\0') {
1984 fr->fr_ifnames[3] = nlen;
1985 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
1988 if (old->fr_tifs[0].fd_ifname[0] != '\0') {
1989 fr->fr_tifs[0].fd_name = nlen;
1990 nlen = ipf_addfrstr(names, nlen,
1991 old->fr_tifs[0].fd_ifname,
1994 if (old->fr_tifs[1].fd_ifname[0] != '\0') {
1995 fr->fr_tifs[1].fd_name = nlen;
1996 nlen = ipf_addfrstr(names, nlen,
1997 old->fr_tifs[1].fd_ifname,
2000 if (old->fr_dif.fd_ifname[0] != '\0') {
2001 fr->fr_dif.fd_name = nlen;
2002 nlen = ipf_addfrstr(names, nlen,
2003 old->fr_dif.fd_ifname, LIFNAMSIZ);
2005 if (old->fr_group[0] != '\0') {
2006 fr->fr_group = nlen;
2007 nlen = ipf_addfrstr(names, nlen,
2008 old->fr_group, LIFNAMSIZ);
2010 if (old->fr_grhead[0] != '\0') {
2011 fr->fr_grhead = nlen;
2012 nlen = ipf_addfrstr(names, nlen,
2013 old->fr_grhead, LIFNAMSIZ);
2015 fr->fr_namelen = nlen;
2017 if (old->fr_type == FR_T_IPF) {
2018 int offset = fr->fr_namelen;
2022 obj.ipfo_type = IPFOBJ_FRIPF;
2023 obj.ipfo_rev = 4010100;
2024 obj.ipfo_ptr = old->fr_data;
2026 if ((offset & 7) != 0)
2027 offset += 8 - (offset & 7);
2028 error = ipf_in_compat(softc, &obj,
2029 fr->fr_names + offset, 0);
2031 fr->fr_data = fr->fr_names + offset;
2032 fr->fr_dsize = sizeof(fripf_t);
2039 frentry_4_1_16_to_current(softc, old, current, size)
2040 ipf_main_softc_t *softc;
2041 frentry_4_1_16_t *old;
2045 frentry_t *fr = (frentry_t *)current;
2047 fr->fr_comment = -1;
2048 fr->fr_ref = old->fr_ref;
2049 fr->fr_statecnt = old->fr_statecnt;
2050 fr->fr_hits = old->fr_hits;
2051 fr->fr_bytes = old->fr_bytes;
2052 fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
2053 fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
2054 bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
2055 fr->fr_func = old->fr_func;
2056 fr->fr_dsize = old->fr_dsize;
2057 fr->fr_pps = old->fr_pps;
2058 fr->fr_statemax = old->fr_statemax;
2059 fr->fr_flineno = old->fr_flineno;
2060 fr->fr_type = old->fr_type;
2061 fr->fr_flags = fr_frflags4to5(old->fr_flags);
2062 fr->fr_logtag = old->fr_logtag;
2063 fr->fr_collect = old->fr_collect;
2064 fr->fr_arg = old->fr_arg;
2065 fr->fr_loglevel = old->fr_loglevel;
2066 fr->fr_age[0] = old->fr_age[0];
2067 fr->fr_age[1] = old->fr_age[1];
2068 fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
2069 fr->fr_tifs[0].fd_type = FRD_NORMAL;
2070 fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
2071 fr->fr_tifs[1].fd_type = FRD_NORMAL;
2072 fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
2073 fr->fr_dif.fd_type = FRD_NORMAL;
2075 fr->fr_family = AF_INET;
2077 fr->fr_family = AF_INET6;
2078 fr->fr_icode = old->fr_icode;
2079 fr->fr_cksum = old->fr_cksum;
2081 fr->fr_ifnames[0] = -1;
2082 fr->fr_ifnames[1] = -1;
2083 fr->fr_ifnames[2] = -1;
2084 fr->fr_ifnames[3] = -1;
2085 fr->fr_dif.fd_name = -1;
2086 fr->fr_tifs[0].fd_name = -1;
2087 fr->fr_tifs[1].fd_name = -1;
2090 fr->fr_icmphead = -1;
2092 fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
2093 fr->fr_size += 9; /* room for \0's */
2095 char *names = fr->fr_names;
2096 int nlen = fr->fr_namelen;
2099 if (old->fr_ifnames[0][0] != '\0') {
2100 fr->fr_ifnames[0] = nlen;
2101 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
2104 if (old->fr_ifnames[1][0] != '\0') {
2105 fr->fr_ifnames[1] = nlen;
2106 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
2109 if (old->fr_ifnames[2][0] != '\0') {
2110 fr->fr_ifnames[2] = nlen;
2111 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
2114 if (old->fr_ifnames[3][0] != '\0') {
2115 fr->fr_ifnames[3] = nlen;
2116 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
2119 if (old->fr_tifs[0].fd_ifname[0] != '\0') {
2120 fr->fr_tifs[0].fd_name = nlen;
2121 nlen = ipf_addfrstr(names, nlen,
2122 old->fr_tifs[0].fd_ifname,
2125 if (old->fr_tifs[1].fd_ifname[0] != '\0') {
2126 fr->fr_tifs[1].fd_name = nlen;
2127 nlen = ipf_addfrstr(names, nlen,
2128 old->fr_tifs[1].fd_ifname,
2131 if (old->fr_dif.fd_ifname[0] != '\0') {
2132 fr->fr_dif.fd_name = nlen;
2133 nlen = ipf_addfrstr(names, nlen,
2134 old->fr_dif.fd_ifname, LIFNAMSIZ);
2136 if (old->fr_group[0] != '\0') {
2137 fr->fr_group = nlen;
2138 nlen = ipf_addfrstr(names, nlen,
2139 old->fr_group, LIFNAMSIZ);
2141 if (old->fr_grhead[0] != '\0') {
2142 fr->fr_grhead = nlen;
2143 nlen = ipf_addfrstr(names, nlen,
2144 old->fr_grhead, LIFNAMSIZ);
2146 fr->fr_namelen = nlen;
2148 if (old->fr_type == FR_T_IPF) {
2149 int offset = fr->fr_namelen;
2153 obj.ipfo_type = IPFOBJ_FRIPF;
2154 obj.ipfo_rev = 4010100;
2155 obj.ipfo_ptr = old->fr_data;
2157 if ((offset & 7) != 0)
2158 offset += 8 - (offset & 7);
2159 error = ipf_in_compat(softc, &obj,
2160 fr->fr_names + offset, 0);
2162 fr->fr_data = fr->fr_names + offset;
2163 fr->fr_dsize = sizeof(fripf_t);
2171 frentry_4_1_0_to_current(softc, old, current, size)
2172 ipf_main_softc_t *softc;
2173 frentry_4_1_0_t *old;
2177 frentry_t *fr = (frentry_t *)current;
2179 fr->fr_size = sizeof(*fr);
2180 fr->fr_comment = -1;
2181 fr->fr_ref = old->fr_ref;
2182 fr->fr_statecnt = old->fr_statecnt;
2183 fr->fr_hits = old->fr_hits;
2184 fr->fr_bytes = old->fr_bytes;
2185 fr->fr_lastpkt.tv_sec = old->fr_lastpkt.tv_sec;
2186 fr->fr_lastpkt.tv_usec = old->fr_lastpkt.tv_usec;
2187 bcopy(&old->fr_dun, &fr->fr_dun, sizeof(old->fr_dun));
2188 fr->fr_func = old->fr_func;
2189 fr->fr_dsize = old->fr_dsize;
2190 fr->fr_pps = old->fr_pps;
2191 fr->fr_statemax = old->fr_statemax;
2192 fr->fr_flineno = old->fr_flineno;
2193 fr->fr_type = old->fr_type;
2194 fr->fr_flags = fr_frflags4to5(old->fr_flags);
2195 fr->fr_logtag = old->fr_logtag;
2196 fr->fr_collect = old->fr_collect;
2197 fr->fr_arg = old->fr_arg;
2198 fr->fr_loglevel = old->fr_loglevel;
2199 fr->fr_age[0] = old->fr_age[0];
2200 fr->fr_age[1] = old->fr_age[1];
2201 fr->fr_tifs[0].fd_ip6 = old->fr_tifs[0].ofd_ip6;
2202 fr->fr_tifs[0].fd_type = FRD_NORMAL;
2203 fr->fr_tifs[1].fd_ip6 = old->fr_tifs[1].ofd_ip6;
2204 fr->fr_tifs[1].fd_type = FRD_NORMAL;
2205 fr->fr_dif.fd_ip6 = old->fr_dif.ofd_ip6;
2206 fr->fr_dif.fd_type = FRD_NORMAL;
2208 fr->fr_family = AF_INET;
2210 fr->fr_family = AF_INET6;
2211 fr->fr_icode = old->fr_icode;
2212 fr->fr_cksum = old->fr_cksum;
2214 fr->fr_ifnames[0] = -1;
2215 fr->fr_ifnames[1] = -1;
2216 fr->fr_ifnames[2] = -1;
2217 fr->fr_ifnames[3] = -1;
2218 fr->fr_dif.fd_name = -1;
2219 fr->fr_tifs[0].fd_name = -1;
2220 fr->fr_tifs[1].fd_name = -1;
2223 fr->fr_icmphead = -1;
2225 fr->fr_size = sizeof(*fr) + LIFNAMSIZ * 7 + FR_GROUPLEN * 2;
2226 fr->fr_size += 9; /* room for \0's */
2228 char *names = fr->fr_names;
2229 int nlen = fr->fr_namelen;
2232 if (old->fr_ifnames[0][0] != '\0') {
2233 fr->fr_ifnames[0] = nlen;
2234 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[0],
2237 if (old->fr_ifnames[1][0] != '\0') {
2238 fr->fr_ifnames[1] = nlen;
2239 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[1],
2242 if (old->fr_ifnames[2][0] != '\0') {
2243 fr->fr_ifnames[2] = nlen;
2244 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[2],
2247 if (old->fr_ifnames[3][0] != '\0') {
2248 fr->fr_ifnames[3] = nlen;
2249 nlen = ipf_addfrstr(names, nlen, old->fr_ifnames[3],
2252 if (old->fr_tifs[0].fd_ifname[0] != '\0') {
2253 fr->fr_tifs[0].fd_name = nlen;
2254 nlen = ipf_addfrstr(names, nlen,
2255 old->fr_tifs[0].fd_ifname,
2258 if (old->fr_tifs[1].fd_ifname[0] != '\0') {
2259 fr->fr_tifs[1].fd_name = nlen;
2260 nlen = ipf_addfrstr(names, nlen,
2261 old->fr_tifs[1].fd_ifname,
2264 if (old->fr_dif.fd_ifname[0] != '\0') {
2265 fr->fr_dif.fd_name = nlen;
2266 nlen = ipf_addfrstr(names, nlen,
2267 old->fr_dif.fd_ifname, LIFNAMSIZ);
2269 if (old->fr_group[0] != '\0') {
2270 fr->fr_group = nlen;
2271 nlen = ipf_addfrstr(names, nlen,
2272 old->fr_group, LIFNAMSIZ);
2274 if (old->fr_grhead[0] != '\0') {
2275 fr->fr_grhead = nlen;
2276 nlen = ipf_addfrstr(names, nlen,
2277 old->fr_grhead, LIFNAMSIZ);
2279 fr->fr_namelen = nlen;
2281 if (old->fr_type == FR_T_IPF) {
2282 int offset = fr->fr_namelen;
2286 obj.ipfo_type = IPFOBJ_FRIPF;
2287 obj.ipfo_rev = 4010100;
2288 obj.ipfo_ptr = old->fr_data;
2290 if ((offset & 7) != 0)
2291 offset += 8 - (offset & 7);
2292 offset += 8 - (offset & 7);
2293 error = ipf_in_compat(softc, &obj,
2294 fr->fr_names + offset, 0);
2296 fr->fr_data = fr->fr_names + offset;
2297 fr->fr_dsize = sizeof(fripf_t);
2305 friostat_4_1_33_to_current(old, current)
2306 friostat_4_1_33_t *old;
2309 friostat_t *fiop = (friostat_t *)current;
2311 bcopy(&old->of_st[0], &fiop->f_st[0].fr_pass, sizeof(old->of_st[0]));
2312 bcopy(&old->of_st[1], &fiop->f_st[1].fr_pass, sizeof(old->of_st[1]));
2314 fiop->f_ipf[0][0] = old->f_ipf[0][0];
2315 fiop->f_ipf[0][1] = old->f_ipf[0][1];
2316 fiop->f_ipf[1][0] = old->f_ipf[1][0];
2317 fiop->f_ipf[1][1] = old->f_ipf[1][1];
2318 fiop->f_acct[0][0] = old->f_acct[0][0];
2319 fiop->f_acct[0][1] = old->f_acct[0][1];
2320 fiop->f_acct[1][0] = old->f_acct[1][0];
2321 fiop->f_acct[1][1] = old->f_acct[1][1];
2322 fiop->f_auth = fiop->f_auth;
2323 bcopy(&old->f_groups, &fiop->f_groups, sizeof(old->f_groups));
2324 bcopy(&old->f_froute, &fiop->f_froute, sizeof(old->f_froute));
2325 fiop->f_ticks = old->f_ticks;
2326 bcopy(&old->f_locks, &fiop->f_locks, sizeof(old->f_locks));
2327 fiop->f_defpass = old->f_defpass;
2328 fiop->f_active = old->f_active;
2329 fiop->f_running = old->f_running;
2330 fiop->f_logging = old->f_logging;
2331 fiop->f_features = old->f_features;
2332 bcopy(old->f_version, fiop->f_version, sizeof(old->f_version));
2337 friostat_4_1_0_to_current(old, current)
2338 friostat_4_1_0_t *old;
2341 friostat_t *fiop = (friostat_t *)current;
2343 bcopy(&old->of_st[0], &fiop->f_st[0].fr_pass, sizeof(old->of_st[0]));
2344 bcopy(&old->of_st[1], &fiop->f_st[1].fr_pass, sizeof(old->of_st[1]));
2346 fiop->f_ipf[0][0] = old->f_ipf[0][0];
2347 fiop->f_ipf[0][1] = old->f_ipf[0][1];
2348 fiop->f_ipf[1][0] = old->f_ipf[1][0];
2349 fiop->f_ipf[1][1] = old->f_ipf[1][1];
2350 fiop->f_acct[0][0] = old->f_acct[0][0];
2351 fiop->f_acct[0][1] = old->f_acct[0][1];
2352 fiop->f_acct[1][0] = old->f_acct[1][0];
2353 fiop->f_acct[1][1] = old->f_acct[1][1];
2354 fiop->f_auth = fiop->f_auth;
2355 bcopy(&old->f_groups, &fiop->f_groups, sizeof(old->f_groups));
2356 bcopy(&old->f_froute, &fiop->f_froute, sizeof(old->f_froute));
2357 fiop->f_ticks = old->f_ticks;
2358 bcopy(&old->f_locks, &fiop->f_locks, sizeof(old->f_locks));
2359 fiop->f_defpass = old->f_defpass;
2360 fiop->f_active = old->f_active;
2361 fiop->f_running = old->f_running;
2362 fiop->f_logging = old->f_logging;
2363 fiop->f_features = old->f_features;
2364 bcopy(old->f_version, fiop->f_version, sizeof(old->f_version));
2369 ipnat_4_1_14_to_current(old, current, size)
2370 ipnat_4_1_14_t *old;
2374 ipnat_t *np = (ipnat_t *)current;
2376 np->in_space = old->in_space;
2377 np->in_hv[0] = old->in_hv;
2378 np->in_hv[1] = old->in_hv;
2379 np->in_flineno = old->in_flineno;
2380 if (old->in_redir == NAT_REDIRECT)
2381 np->in_dpnext = old->in_pnext;
2383 np->in_spnext = old->in_pnext;
2384 np->in_v[0] = old->in_v;
2385 np->in_v[1] = old->in_v;
2386 np->in_flags = old->in_flags;
2387 np->in_mssclamp = old->in_mssclamp;
2388 np->in_age[0] = old->in_age[0];
2389 np->in_age[1] = old->in_age[1];
2390 np->in_redir = old->in_redir;
2391 np->in_pr[0] = old->in_p;
2392 np->in_pr[1] = old->in_p;
2393 if (np->in_redir == NAT_REDIRECT) {
2394 np->in_ndst.na_nextaddr = old->in_next6;
2395 np->in_ndst.na_addr[0] = old->in_in[0];
2396 np->in_ndst.na_addr[1] = old->in_in[1];
2397 np->in_ndst.na_atype = FRI_NORMAL;
2398 np->in_odst.na_addr[0] = old->in_out[0];
2399 np->in_odst.na_addr[1] = old->in_out[1];
2400 np->in_odst.na_atype = FRI_NORMAL;
2401 np->in_osrc.na_addr[0] = old->in_src[0];
2402 np->in_osrc.na_addr[1] = old->in_src[1];
2403 np->in_osrc.na_atype = FRI_NORMAL;
2405 np->in_nsrc.na_nextaddr = old->in_next6;
2406 np->in_nsrc.na_addr[0] = old->in_out[0];
2407 np->in_nsrc.na_addr[1] = old->in_out[1];
2408 np->in_nsrc.na_atype = FRI_NORMAL;
2409 np->in_osrc.na_addr[0] = old->in_in[0];
2410 np->in_osrc.na_addr[1] = old->in_in[1];
2411 np->in_osrc.na_atype = FRI_NORMAL;
2412 np->in_odst.na_addr[0] = old->in_src[0];
2413 np->in_odst.na_addr[1] = old->in_src[1];
2414 np->in_odst.na_atype = FRI_NORMAL;
2416 ipfv4tuctov5(&old->in_tuc, &np->in_tuc);
2417 if (np->in_redir == NAT_REDIRECT) {
2418 np->in_dpmin = old->in_port[0];
2419 np->in_dpmax = old->in_port[1];
2421 np->in_spmin = old->in_port[0];
2422 np->in_spmax = old->in_port[1];
2424 np->in_ppip = old->in_ppip;
2425 np->in_ippip = old->in_ippip;
2426 np->in_tag = old->in_tag;
2430 np->in_ifnames[0] = -1;
2431 np->in_ifnames[1] = -1;
2434 np->in_size = sizeof(*np);
2435 np->in_size += LIFNAMSIZ * 2 + APR_LABELLEN;
2438 int nlen = np->in_namelen;
2439 char *names = np->in_names;
2441 if (old->in_ifnames[0][0] != '\0') {
2442 np->in_ifnames[0] = nlen;
2443 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[0],
2446 if (old->in_ifnames[1][0] != '\0') {
2447 np->in_ifnames[0] = nlen;
2448 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[1],
2451 if (old->in_plabel[0] != '\0') {
2452 np->in_plabel = nlen;
2453 nlen = ipf_addfrstr(names, nlen, old->in_plabel,
2456 np->in_namelen = nlen;
2463 ipnat_4_1_0_to_current(old, current, size)
2468 ipnat_t *np = (ipnat_t *)current;
2470 np->in_space = old->in_space;
2471 np->in_hv[0] = old->in_hv;
2472 np->in_hv[1] = old->in_hv;
2473 np->in_flineno = old->in_flineno;
2474 if (old->in_redir == NAT_REDIRECT)
2475 np->in_dpnext = old->in_pnext;
2477 np->in_spnext = old->in_pnext;
2478 np->in_v[0] = old->in_v;
2479 np->in_v[1] = old->in_v;
2480 np->in_flags = old->in_flags;
2481 np->in_mssclamp = old->in_mssclamp;
2482 np->in_age[0] = old->in_age[0];
2483 np->in_age[1] = old->in_age[1];
2484 np->in_redir = old->in_redir;
2485 np->in_pr[0] = old->in_p;
2486 np->in_pr[1] = old->in_p;
2487 if (np->in_redir == NAT_REDIRECT) {
2488 np->in_ndst.na_nextaddr = old->in_next6;
2489 bcopy(&old->in_in, &np->in_ndst.na_addr, sizeof(old->in_in));
2490 bcopy(&old->in_out, &np->in_odst.na_addr, sizeof(old->in_out));
2491 bcopy(&old->in_src, &np->in_osrc.na_addr, sizeof(old->in_src));
2493 np->in_nsrc.na_nextaddr = old->in_next6;
2494 bcopy(&old->in_in, &np->in_osrc.na_addr, sizeof(old->in_in));
2495 bcopy(&old->in_out, &np->in_nsrc.na_addr, sizeof(old->in_out));
2496 bcopy(&old->in_src, &np->in_odst.na_addr, sizeof(old->in_src));
2498 ipfv4tuctov5(&old->in_tuc, &np->in_tuc);
2499 if (np->in_redir == NAT_REDIRECT) {
2500 np->in_dpmin = old->in_port[0];
2501 np->in_dpmax = old->in_port[1];
2503 np->in_spmin = old->in_port[0];
2504 np->in_spmax = old->in_port[1];
2506 np->in_ppip = old->in_ppip;
2507 np->in_ippip = old->in_ippip;
2508 bcopy(&old->in_tag, &np->in_tag, sizeof(np->in_tag));
2512 np->in_ifnames[0] = -1;
2513 np->in_ifnames[1] = -1;
2516 np->in_size = sizeof(*np);
2517 np->in_size += LIFNAMSIZ * 2 + APR_LABELLEN;
2520 int nlen = np->in_namelen;
2521 char *names = np->in_names;
2523 if (old->in_ifnames[0][0] != '\0') {
2524 np->in_ifnames[0] = nlen;
2525 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[0],
2528 if (old->in_ifnames[1][0] != '\0') {
2529 np->in_ifnames[0] = nlen;
2530 nlen = ipf_addfrstr(names, nlen, old->in_ifnames[1],
2533 if (old->in_plabel[0] != '\0') {
2534 np->in_plabel = nlen;
2535 nlen = ipf_addfrstr(names, nlen, old->in_plabel,
2538 np->in_namelen = nlen;
2545 frauth_4_1_32_to_current(old, current)
2546 frauth_4_1_32_t *old;
2549 frauth_t *fra = (frauth_t *)current;
2551 fra->fra_age = old->fra_age;
2552 fra->fra_len = old->fra_len;
2553 fra->fra_index = old->fra_index;
2554 fra->fra_pass = old->fra_pass;
2555 fr_info_4_1_32_to_current(&old->fra_info, &fra->fra_info);
2556 fra->fra_buf = old->fra_buf;
2557 fra->fra_flx = old->fra_flx;
2559 fra->fra_q = old->fra_q;
2560 fra->fra_m = old->fra_m;
2566 frauth_4_1_29_to_current(old, current)
2567 frauth_4_1_29_t *old;
2570 frauth_t *fra = (frauth_t *)current;
2572 fra->fra_age = old->fra_age;
2573 fra->fra_len = old->fra_len;
2574 fra->fra_index = old->fra_index;
2575 fra->fra_pass = old->fra_pass;
2576 fr_info_4_1_24_to_current(&old->fra_info, &fra->fra_info);
2577 fra->fra_buf = old->fra_buf;
2578 fra->fra_flx = old->fra_flx;
2580 fra->fra_q = old->fra_q;
2581 fra->fra_m = old->fra_m;
2587 frauth_4_1_24_to_current(old, current)
2588 frauth_4_1_24_t *old;
2591 frauth_t *fra = (frauth_t *)current;
2593 fra->fra_age = old->fra_age;
2594 fra->fra_len = old->fra_len;
2595 fra->fra_index = old->fra_index;
2596 fra->fra_pass = old->fra_pass;
2597 fr_info_4_1_24_to_current(&old->fra_info, &fra->fra_info);
2598 fra->fra_buf = old->fra_buf;
2600 fra->fra_q = old->fra_q;
2601 fra->fra_m = old->fra_m;
2607 frauth_4_1_23_to_current(old, current)
2608 frauth_4_1_23_t *old;
2611 frauth_t *fra = (frauth_t *)current;
2613 fra->fra_age = old->fra_age;
2614 fra->fra_len = old->fra_len;
2615 fra->fra_index = old->fra_index;
2616 fra->fra_pass = old->fra_pass;
2617 fr_info_4_1_23_to_current(&old->fra_info, &fra->fra_info);
2618 fra->fra_buf = old->fra_buf;
2620 fra->fra_q = old->fra_q;
2621 fra->fra_m = old->fra_m;
2627 frauth_4_1_11_to_current(old, current)
2628 frauth_4_1_11_t *old;
2631 frauth_t *fra = (frauth_t *)current;
2633 fra->fra_age = old->fra_age;
2634 fra->fra_len = old->fra_len;
2635 fra->fra_index = old->fra_index;
2636 fra->fra_pass = old->fra_pass;
2637 fr_info_4_1_11_to_current(&old->fra_info, &fra->fra_info);
2638 fra->fra_buf = old->fra_buf;
2640 fra->fra_q = old->fra_q;
2641 fra->fra_m = old->fra_m;
2647 fr_info_4_1_32_to_current(old, current)
2648 fr_info_4_1_32_t *old;
2651 fr_info_t *fin = (fr_info_t *)current;
2653 fin->fin_ifp = old->fin_ifp;
2654 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2655 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2656 fin->fin_out = old->fin_out;
2657 fin->fin_rev = old->fin_rev;
2658 fin->fin_hlen = old->fin_hlen;
2659 fin->fin_tcpf = old->ofin_tcpf;
2660 fin->fin_icode = old->fin_icode;
2661 fin->fin_rule = old->fin_rule;
2662 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2663 fin->fin_fr = old->fin_fr;
2664 fin->fin_dp = old->fin_dp;
2665 fin->fin_dlen = old->fin_dlen;
2666 fin->fin_plen = old->fin_plen;
2667 fin->fin_ipoff = old->fin_ipoff;
2668 fin->fin_id = old->fin_id;
2669 fin->fin_off = old->fin_off;
2670 fin->fin_depth = old->fin_depth;
2671 fin->fin_error = old->fin_error;
2672 fin->fin_cksum = old->fin_cksum;
2673 fin->fin_nattag = old->fin_nattag;
2674 fin->fin_ip = old->ofin_ip;
2675 fin->fin_mp = old->fin_mp;
2676 fin->fin_m = old->fin_m;
2678 fin->fin_qfm = old->fin_qfm;
2679 fin->fin_qpi = old->fin_qpi;
2682 fin->fin_hbuf = old->fin_hbuf;
2688 fr_info_4_1_24_to_current(old, current)
2689 fr_info_4_1_24_t *old;
2692 fr_info_t *fin = (fr_info_t *)current;
2694 fin->fin_ifp = old->fin_ifp;
2695 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2696 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2697 fin->fin_out = old->fin_out;
2698 fin->fin_rev = old->fin_rev;
2699 fin->fin_hlen = old->fin_hlen;
2700 fin->fin_tcpf = old->ofin_tcpf;
2701 fin->fin_icode = old->fin_icode;
2702 fin->fin_rule = old->fin_rule;
2703 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2704 fin->fin_fr = old->fin_fr;
2705 fin->fin_dp = old->fin_dp;
2706 fin->fin_dlen = old->fin_dlen;
2707 fin->fin_plen = old->fin_plen;
2708 fin->fin_ipoff = old->fin_ipoff;
2709 fin->fin_id = old->fin_id;
2710 fin->fin_off = old->fin_off;
2711 fin->fin_depth = old->fin_depth;
2712 fin->fin_error = old->fin_error;
2713 fin->fin_cksum = old->fin_cksum;
2714 fin->fin_nattag = old->fin_nattag;
2715 fin->fin_ip = old->ofin_ip;
2716 fin->fin_mp = old->fin_mp;
2717 fin->fin_m = old->fin_m;
2719 fin->fin_qfm = old->fin_qfm;
2720 fin->fin_qpi = old->fin_qpi;
2723 fin->fin_hbuf = old->fin_hbuf;
2729 fr_info_4_1_23_to_current(old, current)
2730 fr_info_4_1_23_t *old;
2733 fr_info_t *fin = (fr_info_t *)current;
2735 fin->fin_ifp = old->fin_ifp;
2736 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2737 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2738 fin->fin_out = old->fin_out;
2739 fin->fin_rev = old->fin_rev;
2740 fin->fin_hlen = old->fin_hlen;
2741 fin->fin_tcpf = old->ofin_tcpf;
2742 fin->fin_icode = old->fin_icode;
2743 fin->fin_rule = old->fin_rule;
2744 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2745 fin->fin_fr = old->fin_fr;
2746 fin->fin_dp = old->fin_dp;
2747 fin->fin_dlen = old->fin_dlen;
2748 fin->fin_plen = old->fin_plen;
2749 fin->fin_ipoff = old->fin_ipoff;
2750 fin->fin_id = old->fin_id;
2751 fin->fin_off = old->fin_off;
2752 fin->fin_depth = old->fin_depth;
2753 fin->fin_error = old->fin_error;
2754 fin->fin_nattag = old->fin_nattag;
2755 fin->fin_ip = old->ofin_ip;
2756 fin->fin_mp = old->fin_mp;
2757 fin->fin_m = old->fin_m;
2759 fin->fin_qfm = old->fin_qfm;
2760 fin->fin_qpi = old->fin_qpi;
2763 fin->fin_hbuf = fin->fin_hbuf;
2769 fr_info_4_1_11_to_current(old, current)
2770 fr_info_4_1_11_t *old;
2773 fr_info_t *fin = (fr_info_t *)current;
2775 fin->fin_ifp = old->fin_ifp;
2776 ipf_v4iptov5(&old->fin_fi, &fin->fin_fi);
2777 bcopy(&old->fin_dat, &fin->fin_dat, sizeof(old->fin_dat));
2778 fin->fin_out = old->fin_out;
2779 fin->fin_rev = old->fin_rev;
2780 fin->fin_hlen = old->fin_hlen;
2781 fin->fin_tcpf = old->ofin_tcpf;
2782 fin->fin_icode = old->fin_icode;
2783 fin->fin_rule = old->fin_rule;
2784 bcopy(old->fin_group, fin->fin_group, sizeof(old->fin_group));
2785 fin->fin_fr = old->fin_fr;
2786 fin->fin_dp = old->fin_dp;
2787 fin->fin_dlen = old->fin_dlen;
2788 fin->fin_plen = old->fin_plen;
2789 fin->fin_ipoff = old->fin_ipoff;
2790 fin->fin_id = old->fin_id;
2791 fin->fin_off = old->fin_off;
2792 fin->fin_depth = old->fin_depth;
2793 fin->fin_error = old->fin_error;
2794 fin->fin_nattag = old->fin_nattag;
2795 fin->fin_ip = old->ofin_ip;
2796 fin->fin_mp = old->fin_mp;
2797 fin->fin_m = old->fin_m;
2799 fin->fin_qfm = old->fin_qfm;
2800 fin->fin_qpi = old->fin_qpi;
2803 fin->fin_hbuf = fin->fin_hbuf;
2809 nat_4_1_3_to_current(nat_4_1_3_t *old, nat_t *current)
2811 bzero((void *)current, sizeof(*current));
2812 bcopy((void *)old, (void *)current, sizeof(*old));
2817 nat_4_1_14_to_current(nat_4_1_14_t *old, nat_t *current)
2819 bzero((void *)current, sizeof(*current));
2820 bcopy((void *)old, (void *)current, sizeof(*old));
2825 nat_save_4_1_16_to_current(softc, old, current)
2826 ipf_main_softc_t *softc;
2827 nat_save_4_1_16_t *old;
2830 nat_save_t *nats = (nat_save_t *)current;
2832 nats->ipn_next = old->ipn_next;
2833 nat_4_1_14_to_current(&old->ipn_nat, &nats->ipn_nat);
2834 bcopy(&old->ipn_ipnat, &nats->ipn_ipnat, sizeof(old->ipn_ipnat));
2835 frentry_4_1_16_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 nat_save_4_1_14_to_current(softc, old, current)
2843 ipf_main_softc_t *softc;
2844 nat_save_4_1_14_t *old;
2847 nat_save_t *nats = (nat_save_t *)current;
2849 nats->ipn_next = old->ipn_next;
2850 nat_4_1_14_to_current(&old->ipn_nat, &nats->ipn_nat);
2851 bcopy(&old->ipn_ipnat, &nats->ipn_ipnat, sizeof(old->ipn_ipnat));
2852 frentry_4_1_0_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
2853 nats->ipn_dsize = old->ipn_dsize;
2854 bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
2859 nat_save_4_1_3_to_current(softc, old, current)
2860 ipf_main_softc_t *softc;
2861 nat_save_4_1_3_t *old;
2864 nat_save_t *nats = (nat_save_t *)current;
2866 nats->ipn_next = old->ipn_next;
2867 nat_4_1_3_to_current(&old->ipn_nat, &nats->ipn_nat);
2868 ipnat_4_1_0_to_current(&old->ipn_ipnat, &nats->ipn_ipnat, 0);
2869 frentry_4_1_0_to_current(softc, &old->ipn_fr, &nats->ipn_fr, 0);
2870 nats->ipn_dsize = old->ipn_dsize;
2871 bcopy(old->ipn_data, nats->ipn_data, sizeof(nats->ipn_data));
2876 natstat_current_to_4_1_32(current, old)
2878 natstat_4_1_32_t *old;
2880 natstat_t *ns = (natstat_t *)current;
2882 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
2883 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
2884 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2885 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
2886 old->ns_expire = ns->ns_expire;
2887 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2888 old->ns_logged = ns->ns_log_ok;
2889 old->ns_logfail = ns->ns_log_fail;
2890 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
2891 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
2892 old->ns_addtrpnt = ns->ns_addtrpnt;
2893 old->ns_table[0] = ns->ns_side[0].ns_table;
2894 old->ns_table[1] = ns->ns_side[1].ns_table;
2895 old->ns_maptable = NULL;
2896 old->ns_list = ns->ns_list;
2897 old->ns_apslist = NULL;
2898 old->ns_wilds = ns->ns_wilds;
2899 old->ns_nattab_sz = ns->ns_nattab_sz;
2900 old->ns_nattab_max = ns->ns_nattab_max;
2901 old->ns_rultab_sz = ns->ns_rultab_sz;
2902 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
2903 old->ns_trpntab_sz = ns->ns_trpntab_sz;
2904 old->ns_hostmap_sz = 0;
2905 old->ns_instances = ns->ns_instances;
2906 old->ns_maplist = ns->ns_maplist;
2907 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
2908 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
2909 old->ns_ticks = ns->ns_ticks;
2910 old->ns_orphans = ns->ns_orphans;
2911 old->ns_uncreate[0][0] = ns->ns_side[0].ns_uncreate[0];
2912 old->ns_uncreate[0][1] = ns->ns_side[0].ns_uncreate[1];
2913 old->ns_uncreate[1][0] = ns->ns_side[1].ns_uncreate[0];
2914 old->ns_uncreate[1][1] = ns->ns_side[1].ns_uncreate[1];
2919 natstat_current_to_4_1_27(current, old)
2921 natstat_4_1_27_t *old;
2923 natstat_t *ns = (natstat_t *)current;
2925 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
2926 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
2927 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2928 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
2929 old->ns_expire = ns->ns_expire;
2930 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2931 old->ns_logged = ns->ns_log_ok;
2932 old->ns_logfail = ns->ns_log_fail;
2933 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
2934 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
2935 old->ns_addtrpnt = ns->ns_addtrpnt;
2936 old->ns_table[0] = ns->ns_side[0].ns_table;
2937 old->ns_table[1] = ns->ns_side[1].ns_table;
2938 old->ns_maptable = NULL;
2939 old->ns_list = ns->ns_list;
2940 old->ns_apslist = NULL;
2941 old->ns_wilds = ns->ns_wilds;
2942 old->ns_nattab_sz = ns->ns_nattab_sz;
2943 old->ns_nattab_max = ns->ns_nattab_max;
2944 old->ns_rultab_sz = ns->ns_rultab_sz;
2945 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
2946 old->ns_trpntab_sz = ns->ns_trpntab_sz;
2947 old->ns_hostmap_sz = 0;
2948 old->ns_instances = ns->ns_instances;
2949 old->ns_maplist = ns->ns_maplist;
2950 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
2951 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
2952 old->ns_ticks = ns->ns_ticks;
2953 old->ns_orphans = ns->ns_orphans;
2958 natstat_current_to_4_1_16(current, old)
2960 natstat_4_1_16_t *old;
2962 natstat_t *ns = (natstat_t *)current;
2964 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
2965 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
2966 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2967 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
2968 old->ns_expire = ns->ns_expire;
2969 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
2970 old->ns_logged = ns->ns_log_ok;
2971 old->ns_logfail = ns->ns_log_fail;
2972 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
2973 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
2974 old->ns_addtrpnt = ns->ns_addtrpnt;
2975 old->ns_table[0] = ns->ns_side[0].ns_table;
2976 old->ns_table[1] = ns->ns_side[1].ns_table;
2977 old->ns_maptable = NULL;
2978 old->ns_list = ns->ns_list;
2979 old->ns_apslist = NULL;
2980 old->ns_wilds = ns->ns_wilds;
2981 old->ns_nattab_sz = ns->ns_nattab_sz;
2982 old->ns_nattab_max = ns->ns_nattab_max;
2983 old->ns_rultab_sz = ns->ns_rultab_sz;
2984 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
2985 old->ns_trpntab_sz = ns->ns_trpntab_sz;
2986 old->ns_hostmap_sz = 0;
2987 old->ns_instances = ns->ns_instances;
2988 old->ns_maplist = ns->ns_maplist;
2989 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
2990 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
2991 old->ns_ticks = ns->ns_ticks;
2996 natstat_current_to_4_1_0(current, old)
2998 natstat_4_1_0_t *old;
3000 natstat_t *ns = (natstat_t *)current;
3002 old->ns_mapped[0] = ns->ns_side[0].ns_translated;
3003 old->ns_mapped[1] = ns->ns_side[1].ns_translated;
3004 old->ns_rules = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
3005 old->ns_added = ns->ns_side[0].ns_added + ns->ns_side[1].ns_added;
3006 old->ns_expire = ns->ns_expire;
3007 old->ns_inuse = ns->ns_side[0].ns_inuse + ns->ns_side[1].ns_inuse;
3008 old->ns_logged = ns->ns_log_ok;
3009 old->ns_logfail = ns->ns_log_fail;
3010 old->ns_memfail = ns->ns_side[0].ns_memfail + ns->ns_side[1].ns_memfail;
3011 old->ns_badnat = ns->ns_side[0].ns_badnat + ns->ns_side[1].ns_badnat;
3012 old->ns_addtrpnt = ns->ns_addtrpnt;
3013 old->ns_table[0] = ns->ns_side[0].ns_table;
3014 old->ns_table[1] = ns->ns_side[1].ns_table;
3015 old->ns_maptable = NULL;
3016 old->ns_list = ns->ns_list;
3017 old->ns_apslist = NULL;
3018 old->ns_wilds = ns->ns_wilds;
3019 old->ns_nattab_sz = ns->ns_nattab_sz;
3020 old->ns_nattab_max = ns->ns_nattab_max;
3021 old->ns_rultab_sz = ns->ns_rultab_sz;
3022 old->ns_rdrtab_sz = ns->ns_rdrtab_sz;
3023 old->ns_trpntab_sz = ns->ns_trpntab_sz;
3024 old->ns_hostmap_sz = 0;
3025 old->ns_instances = ns->ns_instances;
3026 old->ns_maplist = ns->ns_maplist;
3027 old->ns_bucketlen[0] = (u_long *)ns->ns_side[0].ns_bucketlen;
3028 old->ns_bucketlen[1] = (u_long *)ns->ns_side[1].ns_bucketlen;
3033 ipstate_save_current_to_4_1_16(current, old)
3035 ipstate_save_4_1_16_t *old;
3037 ipstate_save_t *ips = (ipstate_save_t *)current;
3039 old->ips_next = ips->ips_next;
3040 ipstate_current_to_4_1_0(&ips->ips_is, &old->ips_is);
3041 frentry_current_to_4_1_16(&ips->ips_fr, &old->ips_fr);
3046 ipstate_save_current_to_4_1_0(current, old)
3048 ipstate_save_4_1_0_t *old;
3050 ipstate_save_t *ips = (ipstate_save_t *)current;
3052 old->ips_next = ips->ips_next;
3053 ipstate_current_to_4_1_0(&ips->ips_is, &old->ips_is);
3054 frentry_current_to_4_1_0(&ips->ips_fr, &old->ips_fr);
3059 ipf_out_compat(softc, obj, ptr)
3060 ipf_main_softc_t *softc;
3070 switch (obj->ipfo_type)
3075 case IPFOBJ_FRENTRY :
3076 if (obj->ipfo_rev >= 4013400) {
3077 frentry_4_1_34_t *old;
3079 KMALLOC(old, frentry_4_1_34_t *);
3085 frentry_current_to_4_1_34(ptr, old);
3086 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3087 if (error == 0 && old->fr_dsize > 0) {
3088 char *dst = obj->ipfo_ptr;
3091 dst += sizeof(*old);
3092 error = COPYOUT(fr->fr_data, dst,
3099 obj->ipfo_size = sizeof(*old);
3100 } else if (obj->ipfo_rev >= 4011600) {
3101 frentry_4_1_16_t *old;
3103 KMALLOC(old, frentry_4_1_16_t *);
3109 frentry_current_to_4_1_16(ptr, old);
3110 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3115 obj->ipfo_size = sizeof(*old);
3117 frentry_4_1_0_t *old;
3119 KMALLOC(old, frentry_4_1_0_t *);
3125 frentry_current_to_4_1_0(ptr, old);
3126 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3131 obj->ipfo_size = sizeof(*old);
3135 case IPFOBJ_IPFSTAT :
3136 if (obj->ipfo_rev >= 4013300) {
3137 friostat_4_1_33_t *old;
3139 KMALLOC(old, friostat_4_1_33_t *);
3145 friostat_current_to_4_1_33(ptr, old, obj->ipfo_rev);
3146 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3152 friostat_4_1_0_t *old;
3154 KMALLOC(old, friostat_4_1_0_t *);
3160 friostat_current_to_4_1_0(ptr, old, obj->ipfo_rev);
3161 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3169 case IPFOBJ_IPFINFO : /* unused */
3173 if (obj->ipfo_rev >= 4011400) {
3174 ipnat_4_1_14_t *old;
3176 KMALLOC(old, ipnat_4_1_14_t *);
3182 ipnat_current_to_4_1_14(ptr, old);
3183 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3191 KMALLOC(old, ipnat_4_1_0_t *);
3197 ipnat_current_to_4_1_0(ptr, old);
3198 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3206 case IPFOBJ_NATSTAT :
3207 if (obj->ipfo_rev >= 4013200) {
3208 natstat_4_1_32_t *old;
3210 KMALLOC(old, natstat_4_1_32_t *);
3216 natstat_current_to_4_1_32(ptr, old);
3217 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3222 } else if (obj->ipfo_rev >= 4012700) {
3223 natstat_4_1_27_t *old;
3225 KMALLOC(old, natstat_4_1_27_t *);
3231 natstat_current_to_4_1_27(ptr, old);
3232 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3237 } else if (obj->ipfo_rev >= 4011600) {
3238 natstat_4_1_16_t *old;
3240 KMALLOC(old, natstat_4_1_16_t *);
3246 natstat_current_to_4_1_16(ptr, old);
3247 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3253 natstat_4_1_0_t *old;
3255 KMALLOC(old, natstat_4_1_0_t *);
3261 natstat_current_to_4_1_0(ptr, old);
3262 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3270 case IPFOBJ_STATESAVE :
3271 if (obj->ipfo_rev >= 4011600) {
3272 ipstate_save_4_1_16_t *old;
3274 KMALLOC(old, ipstate_save_4_1_16_t *);
3280 ipstate_save_current_to_4_1_16(ptr, old);
3281 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3287 ipstate_save_4_1_0_t *old;
3289 KMALLOC(old, ipstate_save_4_1_0_t *);
3295 ipstate_save_current_to_4_1_0(ptr, old);
3296 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3304 case IPFOBJ_NATSAVE :
3305 if (obj->ipfo_rev >= 4011600) {
3306 nat_save_4_1_16_t *old16;
3308 KMALLOC(old16, nat_save_4_1_16_t *);
3309 if (old16 == NULL) {
3314 nat_save_current_to_4_1_16(ptr, old16);
3315 error = COPYOUT(&old16, obj->ipfo_ptr, sizeof(*old16));
3320 } else if (obj->ipfo_rev >= 4011400) {
3321 nat_save_4_1_14_t *old14;
3323 KMALLOC(old14, nat_save_4_1_14_t *);
3324 if (old14 == NULL) {
3329 nat_save_current_to_4_1_14(ptr, old14);
3330 error = COPYOUT(&old14, obj->ipfo_ptr, sizeof(*old14));
3335 } else if (obj->ipfo_rev >= 4010300) {
3336 nat_save_4_1_3_t *old3;
3338 KMALLOC(old3, nat_save_4_1_3_t *);
3344 nat_save_current_to_4_1_3(ptr, old3);
3345 error = COPYOUT(&old3, obj->ipfo_ptr, sizeof(*old3));
3353 case IPFOBJ_IPSTATE :
3354 if (obj->ipfo_rev >= 4011600) {
3355 ipstate_4_1_16_t *old;
3357 KMALLOC(old, ipstate_4_1_16_t *);
3363 ipstate_current_to_4_1_16(ptr, old);
3364 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3370 ipstate_4_1_0_t *old;
3372 KMALLOC(old, ipstate_4_1_0_t *);
3378 ipstate_current_to_4_1_0(ptr, old);
3379 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3387 case IPFOBJ_STATESTAT :
3388 if (obj->ipfo_rev >= 4012100) {
3389 ips_stat_4_1_21_t *old;
3391 KMALLOC(old, ips_stat_4_1_21_t *);
3397 ips_stat_current_to_4_1_21(ptr, old);
3398 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3404 ips_stat_4_1_0_t *old;
3406 KMALLOC(old, ips_stat_4_1_0_t *);
3412 ips_stat_current_to_4_1_0(ptr, old);
3413 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3421 case IPFOBJ_FRAUTH :
3422 if (obj->ipfo_rev >= 4012900) {
3423 frauth_4_1_29_t *old29;
3425 KMALLOC(old29, frauth_4_1_29_t *);
3426 if (old29 == NULL) {
3431 frauth_current_to_4_1_29(ptr, old29);
3432 error = COPYOUT(old29, obj->ipfo_ptr, sizeof(*old29));
3437 } else if (obj->ipfo_rev >= 4012400) {
3438 frauth_4_1_24_t *old24;
3440 KMALLOC(old24, frauth_4_1_24_t *);
3441 if (old24 == NULL) {
3446 frauth_current_to_4_1_24(ptr, old24);
3447 error = COPYOUT(old24, obj->ipfo_ptr, sizeof(*old24));
3452 } else if (obj->ipfo_rev >= 4012300) {
3453 frauth_4_1_23_t *old23;
3455 KMALLOC(old23, frauth_4_1_23_t *);
3456 if (old23 == NULL) {
3461 frauth_current_to_4_1_23(ptr, old23);
3462 error = COPYOUT(old23, obj->ipfo_ptr, sizeof(*old23));
3467 } else if (obj->ipfo_rev >= 4011100) {
3468 frauth_4_1_11_t *old11;
3470 KMALLOC(old11, frauth_4_1_11_t *);
3471 if (old11 == NULL) {
3476 frauth_current_to_4_1_11(ptr, old11);
3477 error = COPYOUT(old11, obj->ipfo_ptr, sizeof(*old11));
3486 if (obj->ipfo_rev >= 4012500) {
3489 KMALLOC(old, nat_4_1_25_t *);
3495 nat_current_to_4_1_25(ptr, old);
3496 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3501 } else if (obj->ipfo_rev >= 4011400) {
3504 KMALLOC(old, nat_4_1_14_t *);
3510 nat_current_to_4_1_14(ptr, old);
3511 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3516 } else if (obj->ipfo_rev >= 4010300) {
3519 KMALLOC(old, nat_4_1_3_t *);
3525 nat_current_to_4_1_3(ptr, old);
3526 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3535 if (obj->ipfo_rev < 5000000) {
3538 KMALLOC(old, fripf4_t *);
3544 ipf_v5fripftov4(ptr, old);
3545 error = COPYOUT(old, obj->ipfo_ptr, sizeof(*old));
3558 friostat_current_to_4_1_33(current, old, rev)
3560 friostat_4_1_33_t *old;
3563 friostat_t *fiop = (friostat_t *)current;
3565 bcopy(&fiop->f_st[0].fr_pass, &old->of_st[0], sizeof(old->of_st[0]));
3566 bcopy(&fiop->f_st[1].fr_pass, &old->of_st[1], sizeof(old->of_st[1]));
3568 old->f_ipf[0][0] = fiop->f_ipf[0][0];
3569 old->f_ipf[0][1] = fiop->f_ipf[0][1];
3570 old->f_ipf[1][0] = fiop->f_ipf[1][0];
3571 old->f_ipf[1][1] = fiop->f_ipf[1][1];
3572 old->f_acct[0][0] = fiop->f_acct[0][0];
3573 old->f_acct[0][1] = fiop->f_acct[0][1];
3574 old->f_acct[1][0] = fiop->f_acct[1][0];
3575 old->f_acct[1][1] = fiop->f_acct[1][1];
3576 old->f_ipf6[0][0] = NULL;
3577 old->f_ipf6[0][1] = NULL;
3578 old->f_ipf6[1][0] = NULL;
3579 old->f_ipf6[1][1] = NULL;
3580 old->f_acct6[0][0] = NULL;
3581 old->f_acct6[0][1] = NULL;
3582 old->f_acct6[1][0] = NULL;
3583 old->f_acct6[1][1] = NULL;
3584 old->f_auth = fiop->f_auth;
3585 bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
3586 bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
3587 old->f_ticks = fiop->f_ticks;
3588 bcopy(&fiop->f_locks, &old->f_locks, sizeof(old->f_locks));
3589 old->f_kmutex_sz = 0;
3590 old->f_krwlock_sz = 0;
3591 old->f_defpass = fiop->f_defpass;
3592 old->f_active = fiop->f_active;
3593 old->f_running = fiop->f_running;
3594 old->f_logging = fiop->f_logging;
3595 old->f_features = fiop->f_features;
3596 sprintf(old->f_version, "IP Filter: v%d.%d.%d",
3597 (rev / 1000000) % 100,
3598 (rev / 10000) % 100,
3604 friostat_current_to_4_1_0(current, old, rev)
3606 friostat_4_1_0_t *old;
3609 friostat_t *fiop = (friostat_t *)current;
3611 bcopy(&fiop->f_st[0].fr_pass, &old->of_st[0], sizeof(old->of_st[0]));
3612 bcopy(&fiop->f_st[1].fr_pass, &old->of_st[1], sizeof(old->of_st[1]));
3614 old->f_ipf[0][0] = fiop->f_ipf[0][0];
3615 old->f_ipf[0][1] = fiop->f_ipf[0][1];
3616 old->f_ipf[1][0] = fiop->f_ipf[1][0];
3617 old->f_ipf[1][1] = fiop->f_ipf[1][1];
3618 old->f_acct[0][0] = fiop->f_acct[0][0];
3619 old->f_acct[0][1] = fiop->f_acct[0][1];
3620 old->f_acct[1][0] = fiop->f_acct[1][0];
3621 old->f_acct[1][1] = fiop->f_acct[1][1];
3622 old->f_ipf6[0][0] = NULL;
3623 old->f_ipf6[0][1] = NULL;
3624 old->f_ipf6[1][0] = NULL;
3625 old->f_ipf6[1][1] = NULL;
3626 old->f_acct6[0][0] = NULL;
3627 old->f_acct6[0][1] = NULL;
3628 old->f_acct6[1][0] = NULL;
3629 old->f_acct6[1][1] = NULL;
3630 old->f_auth = fiop->f_auth;
3631 bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
3632 bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
3633 old->f_ticks = fiop->f_ticks;
3634 old->f_ipf[0][0] = fiop->f_ipf[0][0];
3635 old->f_ipf[0][1] = fiop->f_ipf[0][1];
3636 old->f_ipf[1][0] = fiop->f_ipf[1][0];
3637 old->f_ipf[1][1] = fiop->f_ipf[1][1];
3638 old->f_acct[0][0] = fiop->f_acct[0][0];
3639 old->f_acct[0][1] = fiop->f_acct[0][1];
3640 old->f_acct[1][0] = fiop->f_acct[1][0];
3641 old->f_acct[1][1] = fiop->f_acct[1][1];
3642 old->f_ipf6[0][0] = NULL;
3643 old->f_ipf6[0][1] = NULL;
3644 old->f_ipf6[1][0] = NULL;
3645 old->f_ipf6[1][1] = NULL;
3646 old->f_acct6[0][0] = NULL;
3647 old->f_acct6[0][1] = NULL;
3648 old->f_acct6[1][0] = NULL;
3649 old->f_acct6[1][1] = NULL;
3650 old->f_auth = fiop->f_auth;
3651 bcopy(&fiop->f_groups, &old->f_groups, sizeof(old->f_groups));
3652 bcopy(&fiop->f_froute, &old->f_froute, sizeof(old->f_froute));
3653 old->f_ticks = fiop->f_ticks;
3654 bcopy(&fiop->f_locks, &old->f_locks, sizeof(old->f_locks));
3655 old->f_kmutex_sz = 0;
3656 old->f_krwlock_sz = 0;
3657 old->f_defpass = fiop->f_defpass;
3658 old->f_active = fiop->f_active;
3659 old->f_running = fiop->f_running;
3660 old->f_logging = fiop->f_logging;
3661 old->f_features = fiop->f_features;
3662 sprintf(old->f_version, "IP Filter: v%d.%d.%d",
3663 (rev / 1000000) % 100,
3664 (rev / 10000) % 100,
3670 * nflags is v5 flags, returns v4 flags.
3673 fr_frflags5to4(nflags)
3678 switch (nflags & FR_CMDMASK) {
3704 if (nflags & FR_LOG)
3706 if (nflags & FR_CALLNOW)
3708 if (nflags & FR_NOTSRCIP)
3710 if (nflags & FR_NOTDSTIP)
3712 if (nflags & FR_QUICK)
3714 if (nflags & FR_KEEPFRAG)
3716 if (nflags & FR_KEEPSTATE)
3718 if (nflags & FR_FASTROUTE)
3720 if (nflags & FR_RETRST)
3722 if (nflags & FR_RETICMP)
3724 if (nflags & FR_FAKEICMP)
3726 if (nflags & FR_OUTQUE)
3728 if (nflags & FR_INQUE)
3730 if (nflags & FR_LOGBODY)
3732 if (nflags & FR_LOGFIRST)
3734 if (nflags & FR_LOGORBLOCK)
3736 if (nflags & FR_FRSTRICT)
3738 if (nflags & FR_STSTRICT)
3740 if (nflags & FR_NEWISN)
3742 if (nflags & FR_NOICMPERR)
3744 if (nflags & FR_STATESYNC)
3745 oflags |= 0x1000000;
3746 if (nflags & FR_NOMATCH)
3747 oflags |= 0x8000000;
3748 if (nflags & FR_COPIED)
3749 oflags |= 0x40000000;
3750 if (nflags & FR_INACTIVE)
3751 oflags |= 0x80000000;
3758 frentry_current_to_4_1_34(current, old)
3760 frentry_4_1_34_t *old;
3762 frentry_t *fr = (frentry_t *)current;
3764 old->fr_lock = fr->fr_lock;
3765 old->fr_next = fr->fr_next;
3766 old->fr_grp = (void *)fr->fr_grp;
3767 old->fr_isc = fr->fr_isc;
3768 old->fr_ifas[0] = fr->fr_ifas[0];
3769 old->fr_ifas[1] = fr->fr_ifas[1];
3770 old->fr_ifas[2] = fr->fr_ifas[2];
3771 old->fr_ifas[3] = fr->fr_ifas[3];
3772 old->fr_ptr = fr->fr_ptr;
3773 old->fr_comment = NULL;
3774 old->fr_ref = fr->fr_ref;
3775 old->fr_statecnt = fr->fr_statecnt;
3776 old->fr_hits = fr->fr_hits;
3777 old->fr_bytes = fr->fr_bytes;
3778 old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
3779 old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
3780 old->fr_curpps = fr->fr_curpps;
3781 old->fr_dun.fru_data = fr->fr_dun.fru_data;
3782 old->fr_func = fr->fr_func;
3783 old->fr_dsize = fr->fr_dsize;
3784 old->fr_pps = fr->fr_pps;
3785 old->fr_statemax = fr->fr_statemax;
3786 old->fr_flineno = fr->fr_flineno;
3787 old->fr_type = fr->fr_type;
3788 old->fr_flags = fr_frflags5to4(fr->fr_flags);
3789 old->fr_logtag = fr->fr_logtag;
3790 old->fr_collect = fr->fr_collect;
3791 old->fr_arg = fr->fr_arg;
3792 old->fr_loglevel = fr->fr_loglevel;
3793 old->fr_age[0] = fr->fr_age[0];
3794 old->fr_age[1] = fr->fr_age[1];
3795 if (fr->fr_family == AF_INET)
3797 if (fr->fr_family == AF_INET6)
3799 old->fr_icode = fr->fr_icode;
3800 old->fr_cksum = fr->fr_cksum;
3801 old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3802 old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3803 old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
3804 if (fr->fr_ifnames[0] >= 0) {
3805 strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
3807 old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
3809 if (fr->fr_ifnames[1] >= 0) {
3810 strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
3812 old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
3814 if (fr->fr_ifnames[2] >= 0) {
3815 strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
3817 old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
3819 if (fr->fr_ifnames[3] >= 0) {
3820 strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
3822 old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
3824 if (fr->fr_tifs[0].fd_name >= 0) {
3825 strncpy(old->fr_tifs[0].fd_ifname,
3826 fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
3827 old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
3829 if (fr->fr_tifs[1].fd_name >= 0) {
3830 strncpy(old->fr_tifs[1].fd_ifname,
3831 fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
3832 old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
3834 if (fr->fr_dif.fd_name >= 0) {
3835 strncpy(old->fr_dif.fd_ifname,
3836 fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
3837 old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
3839 if (fr->fr_group >= 0) {
3840 strncpy(old->fr_group, fr->fr_names + fr->fr_group,
3842 old->fr_group[FR_GROUPLEN - 1] = '\0';
3844 if (fr->fr_grhead >= 0) {
3845 strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
3847 old->fr_grhead[FR_GROUPLEN - 1] = '\0';
3853 frentry_current_to_4_1_16(current, old)
3855 frentry_4_1_16_t *old;
3857 frentry_t *fr = (frentry_t *)current;
3859 old->fr_lock = fr->fr_lock;
3860 old->fr_next = fr->fr_next;
3861 old->fr_grp = (void *)fr->fr_grp;
3862 old->fr_isc = fr->fr_isc;
3863 old->fr_ifas[0] = fr->fr_ifas[0];
3864 old->fr_ifas[1] = fr->fr_ifas[1];
3865 old->fr_ifas[2] = fr->fr_ifas[2];
3866 old->fr_ifas[3] = fr->fr_ifas[3];
3867 old->fr_ptr = fr->fr_ptr;
3868 old->fr_comment = NULL;
3869 old->fr_ref = fr->fr_ref;
3870 old->fr_statecnt = fr->fr_statecnt;
3871 old->fr_hits = fr->fr_hits;
3872 old->fr_bytes = fr->fr_bytes;
3873 old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
3874 old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
3875 old->fr_curpps = fr->fr_curpps;
3876 old->fr_dun.fru_data = fr->fr_dun.fru_data;
3877 old->fr_func = fr->fr_func;
3878 old->fr_dsize = fr->fr_dsize;
3879 old->fr_pps = fr->fr_pps;
3880 old->fr_statemax = fr->fr_statemax;
3881 old->fr_flineno = fr->fr_flineno;
3882 old->fr_type = fr->fr_type;
3883 old->fr_flags = fr_frflags5to4(fr->fr_flags);
3884 old->fr_logtag = fr->fr_logtag;
3885 old->fr_collect = fr->fr_collect;
3886 old->fr_arg = fr->fr_arg;
3887 old->fr_loglevel = fr->fr_loglevel;
3888 old->fr_age[0] = fr->fr_age[0];
3889 old->fr_age[1] = fr->fr_age[1];
3891 fr->fr_family = AF_INET;
3893 fr->fr_family = AF_INET6;
3894 old->fr_icode = fr->fr_icode;
3895 old->fr_cksum = fr->fr_cksum;
3896 old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3897 old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3898 old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
3899 if (fr->fr_ifnames[0] >= 0) {
3900 strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
3902 old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
3904 if (fr->fr_ifnames[1] >= 0) {
3905 strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
3907 old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
3909 if (fr->fr_ifnames[2] >= 0) {
3910 strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
3912 old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
3914 if (fr->fr_ifnames[3] >= 0) {
3915 strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
3917 old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
3919 if (fr->fr_tifs[0].fd_name >= 0) {
3920 strncpy(old->fr_tifs[0].fd_ifname,
3921 fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
3922 old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
3924 if (fr->fr_tifs[1].fd_name >= 0) {
3925 strncpy(old->fr_tifs[1].fd_ifname,
3926 fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
3927 old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
3929 if (fr->fr_dif.fd_name >= 0) {
3930 strncpy(old->fr_dif.fd_ifname,
3931 fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
3932 old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
3934 if (fr->fr_group >= 0) {
3935 strncpy(old->fr_group, fr->fr_names + fr->fr_group,
3937 old->fr_group[FR_GROUPLEN - 1] = '\0';
3939 if (fr->fr_grhead >= 0) {
3940 strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
3942 old->fr_grhead[FR_GROUPLEN - 1] = '\0';
3948 frentry_current_to_4_1_0(current, old)
3950 frentry_4_1_0_t *old;
3952 frentry_t *fr = (frentry_t *)current;
3954 old->fr_lock = fr->fr_lock;
3955 old->fr_next = fr->fr_next;
3956 old->fr_grp = (void *)fr->fr_grp;
3957 old->fr_isc = fr->fr_isc;
3958 old->fr_ifas[0] = fr->fr_ifas[0];
3959 old->fr_ifas[1] = fr->fr_ifas[1];
3960 old->fr_ifas[2] = fr->fr_ifas[2];
3961 old->fr_ifas[3] = fr->fr_ifas[3];
3962 old->fr_ptr = fr->fr_ptr;
3963 old->fr_comment = NULL;
3964 old->fr_ref = fr->fr_ref;
3965 old->fr_statecnt = fr->fr_statecnt;
3966 old->fr_hits = fr->fr_hits;
3967 old->fr_bytes = fr->fr_bytes;
3968 old->fr_lastpkt.tv_sec = fr->fr_lastpkt.tv_sec;
3969 old->fr_lastpkt.tv_usec = fr->fr_lastpkt.tv_usec;
3970 old->fr_curpps = fr->fr_curpps;
3971 old->fr_dun.fru_data = fr->fr_dun.fru_data;
3972 old->fr_func = fr->fr_func;
3973 old->fr_dsize = fr->fr_dsize;
3974 old->fr_pps = fr->fr_pps;
3975 old->fr_statemax = fr->fr_statemax;
3976 old->fr_flineno = fr->fr_flineno;
3977 old->fr_type = fr->fr_type;
3978 old->fr_flags = fr_frflags5to4(fr->fr_flags);
3979 old->fr_logtag = fr->fr_logtag;
3980 old->fr_collect = fr->fr_collect;
3981 old->fr_arg = fr->fr_arg;
3982 old->fr_loglevel = fr->fr_loglevel;
3983 old->fr_age[0] = fr->fr_age[0];
3984 old->fr_age[1] = fr->fr_age[1];
3986 fr->fr_family = AF_INET;
3988 fr->fr_family = AF_INET6;
3989 old->fr_icode = fr->fr_icode;
3990 old->fr_cksum = fr->fr_cksum;
3991 old->fr_tifs[0].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3992 old->fr_tifs[1].ofd_ip6 = fr->fr_tifs[0].fd_ip6;
3993 old->fr_dif.ofd_ip6 = fr->fr_dif.fd_ip6;
3994 if (fr->fr_ifnames[0] >= 0) {
3995 strncpy(old->fr_ifnames[0], fr->fr_names + fr->fr_ifnames[0],
3997 old->fr_ifnames[0][LIFNAMSIZ - 1] = '\0';
3999 if (fr->fr_ifnames[1] >= 0) {
4000 strncpy(old->fr_ifnames[1], fr->fr_names + fr->fr_ifnames[1],
4002 old->fr_ifnames[1][LIFNAMSIZ - 1] = '\0';
4004 if (fr->fr_ifnames[2] >= 0) {
4005 strncpy(old->fr_ifnames[2], fr->fr_names + fr->fr_ifnames[2],
4007 old->fr_ifnames[2][LIFNAMSIZ - 1] = '\0';
4009 if (fr->fr_ifnames[3] >= 0) {
4010 strncpy(old->fr_ifnames[3], fr->fr_names + fr->fr_ifnames[3],
4012 old->fr_ifnames[3][LIFNAMSIZ - 1] = '\0';
4014 if (fr->fr_tifs[0].fd_name >= 0) {
4015 strncpy(old->fr_tifs[0].fd_ifname,
4016 fr->fr_names + fr->fr_tifs[0].fd_name, LIFNAMSIZ);
4017 old->fr_tifs[0].fd_ifname[LIFNAMSIZ - 1] = '\0';
4019 if (fr->fr_tifs[1].fd_name >= 0) {
4020 strncpy(old->fr_tifs[1].fd_ifname,
4021 fr->fr_names + fr->fr_tifs[1].fd_name, LIFNAMSIZ);
4022 old->fr_tifs[1].fd_ifname[LIFNAMSIZ - 1] = '\0';
4024 if (fr->fr_dif.fd_name >= 0) {
4025 strncpy(old->fr_dif.fd_ifname,
4026 fr->fr_names + fr->fr_dif.fd_name, LIFNAMSIZ);
4027 old->fr_dif.fd_ifname[LIFNAMSIZ - 1] = '\0';
4029 if (fr->fr_group >= 0) {
4030 strncpy(old->fr_group, fr->fr_names + fr->fr_group,
4032 old->fr_group[FR_GROUPLEN - 1] = '\0';
4034 if (fr->fr_grhead >= 0) {
4035 strncpy(old->fr_grhead, fr->fr_names + fr->fr_grhead,
4037 old->fr_grhead[FR_GROUPLEN - 1] = '\0';
4043 fr_info_current_to_4_1_24(current, old)
4045 fr_info_4_1_24_t *old;
4047 fr_info_t *fin = (fr_info_t *)current;
4049 old->fin_ifp = fin->fin_ifp;
4050 ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
4051 bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
4052 old->fin_out = fin->fin_out;
4053 old->fin_rev = fin->fin_rev;
4054 old->fin_hlen = fin->fin_hlen;
4055 old->ofin_tcpf = fin->fin_tcpf;
4056 old->fin_icode = fin->fin_icode;
4057 old->fin_rule = fin->fin_rule;
4058 bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
4059 old->fin_fr = fin->fin_fr;
4060 old->fin_dp = fin->fin_dp;
4061 old->fin_dlen = fin->fin_dlen;
4062 old->fin_plen = fin->fin_plen;
4063 old->fin_ipoff = fin->fin_ipoff;
4064 old->fin_id = fin->fin_id;
4065 old->fin_off = fin->fin_off;
4066 old->fin_depth = fin->fin_depth;
4067 old->fin_error = fin->fin_error;
4068 old->fin_cksum = fin->fin_cksum;
4069 old->fin_state = NULL;
4070 old->fin_nat = NULL;
4071 old->fin_nattag = fin->fin_nattag;
4072 old->fin_exthdr = NULL;
4073 old->ofin_ip = fin->fin_ip;
4074 old->fin_mp = fin->fin_mp;
4075 old->fin_m = fin->fin_m;
4077 old->fin_qfm = fin->fin_qfm;
4078 old->fin_qpi = fin->fin_qpi;
4079 old->fin_ifname[0] = '\0';
4082 old->fin_hbuf = fin->fin_hbuf;
4088 fr_info_current_to_4_1_23(current, old)
4090 fr_info_4_1_23_t *old;
4092 fr_info_t *fin = (fr_info_t *)current;
4094 old->fin_ifp = fin->fin_ifp;
4095 ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
4096 bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
4097 old->fin_out = fin->fin_out;
4098 old->fin_rev = fin->fin_rev;
4099 old->fin_hlen = fin->fin_hlen;
4100 old->ofin_tcpf = fin->fin_tcpf;
4101 old->fin_icode = fin->fin_icode;
4102 old->fin_rule = fin->fin_rule;
4103 bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
4104 old->fin_fr = fin->fin_fr;
4105 old->fin_dp = fin->fin_dp;
4106 old->fin_dlen = fin->fin_dlen;
4107 old->fin_plen = fin->fin_plen;
4108 old->fin_ipoff = fin->fin_ipoff;
4109 old->fin_id = fin->fin_id;
4110 old->fin_off = fin->fin_off;
4111 old->fin_depth = fin->fin_depth;
4112 old->fin_error = fin->fin_error;
4113 old->fin_state = NULL;
4114 old->fin_nat = NULL;
4115 old->fin_nattag = fin->fin_nattag;
4116 old->ofin_ip = fin->fin_ip;
4117 old->fin_mp = fin->fin_mp;
4118 old->fin_m = fin->fin_m;
4120 old->fin_qfm = fin->fin_qfm;
4121 old->fin_qpi = fin->fin_qpi;
4122 old->fin_ifname[0] = '\0';
4125 old->fin_hbuf = fin->fin_hbuf;
4131 fr_info_current_to_4_1_11(current, old)
4133 fr_info_4_1_11_t *old;
4135 fr_info_t *fin = (fr_info_t *)current;
4137 old->fin_ifp = fin->fin_ifp;
4138 ipf_v5iptov4(&fin->fin_fi, &old->fin_fi);
4139 bcopy(&fin->fin_dat, &old->fin_dat, sizeof(fin->fin_dat));
4140 old->fin_out = fin->fin_out;
4141 old->fin_rev = fin->fin_rev;
4142 old->fin_hlen = fin->fin_hlen;
4143 old->ofin_tcpf = fin->fin_tcpf;
4144 old->fin_icode = fin->fin_icode;
4145 old->fin_rule = fin->fin_rule;
4146 bcopy(fin->fin_group, old->fin_group, sizeof(fin->fin_group));
4147 old->fin_fr = fin->fin_fr;
4148 old->fin_dp = fin->fin_dp;
4149 old->fin_dlen = fin->fin_dlen;
4150 old->fin_plen = fin->fin_plen;
4151 old->fin_ipoff = fin->fin_ipoff;
4152 old->fin_id = fin->fin_id;
4153 old->fin_off = fin->fin_off;
4154 old->fin_depth = fin->fin_depth;
4155 old->fin_error = fin->fin_error;
4156 old->fin_state = NULL;
4157 old->fin_nat = NULL;
4158 old->fin_nattag = fin->fin_nattag;
4159 old->ofin_ip = fin->fin_ip;
4160 old->fin_mp = fin->fin_mp;
4161 old->fin_m = fin->fin_m;
4163 old->fin_qfm = fin->fin_qfm;
4164 old->fin_qpi = fin->fin_qpi;
4165 old->fin_ifname[0] = '\0';
4168 old->fin_hbuf = fin->fin_hbuf;
4174 frauth_current_to_4_1_29(current, old)
4176 frauth_4_1_29_t *old;
4178 frauth_t *fra = (frauth_t *)current;
4180 old->fra_age = fra->fra_age;
4181 old->fra_len = fra->fra_len;
4182 old->fra_index = fra->fra_index;
4183 old->fra_pass = fra->fra_pass;
4184 fr_info_current_to_4_1_24(&fra->fra_info, &old->fra_info);
4185 old->fra_buf = fra->fra_buf;
4186 old->fra_flx = fra->fra_flx;
4188 old->fra_q = fra->fra_q;
4189 old->fra_m = fra->fra_m;
4195 frauth_current_to_4_1_24(current, old)
4197 frauth_4_1_24_t *old;
4199 frauth_t *fra = (frauth_t *)current;
4201 old->fra_age = fra->fra_age;
4202 old->fra_len = fra->fra_len;
4203 old->fra_index = fra->fra_index;
4204 old->fra_pass = fra->fra_pass;
4205 fr_info_current_to_4_1_24(&fra->fra_info, &old->fra_info);
4206 old->fra_buf = fra->fra_buf;
4208 old->fra_q = fra->fra_q;
4209 old->fra_m = fra->fra_m;
4215 frauth_current_to_4_1_23(current, old)
4217 frauth_4_1_23_t *old;
4219 frauth_t *fra = (frauth_t *)current;
4221 old->fra_age = fra->fra_age;
4222 old->fra_len = fra->fra_len;
4223 old->fra_index = fra->fra_index;
4224 old->fra_pass = fra->fra_pass;
4225 fr_info_current_to_4_1_23(&fra->fra_info, &old->fra_info);
4226 old->fra_buf = fra->fra_buf;
4228 old->fra_q = fra->fra_q;
4229 old->fra_m = fra->fra_m;
4235 frauth_current_to_4_1_11(current, old)
4237 frauth_4_1_11_t *old;
4239 frauth_t *fra = (frauth_t *)current;
4241 old->fra_age = fra->fra_age;
4242 old->fra_len = fra->fra_len;
4243 old->fra_index = fra->fra_index;
4244 old->fra_pass = fra->fra_pass;
4245 fr_info_current_to_4_1_11(&fra->fra_info, &old->fra_info);
4246 old->fra_buf = fra->fra_buf;
4248 old->fra_q = fra->fra_q;
4249 old->fra_m = fra->fra_m;
4255 ipnat_current_to_4_1_14(current, old)
4257 ipnat_4_1_14_t *old;
4259 ipnat_t *np = (ipnat_t *)current;
4261 old->in_next = np->in_next;
4262 old->in_rnext = np->in_rnext;
4263 old->in_prnext = np->in_prnext;
4264 old->in_mnext = np->in_mnext;
4265 old->in_pmnext = np->in_pmnext;
4266 old->in_tqehead[0] = np->in_tqehead[0];
4267 old->in_tqehead[1] = np->in_tqehead[1];
4268 old->in_ifps[0] = np->in_ifps[0];
4269 old->in_ifps[1] = np->in_ifps[1];
4270 old->in_apr = np->in_apr;
4271 old->in_comment = np->in_comment;
4272 old->in_space = np->in_space;
4273 old->in_hits = np->in_hits;
4274 old->in_use = np->in_use;
4275 old->in_hv = np->in_hv[0];
4276 old->in_flineno = np->in_flineno;
4277 if (old->in_redir == NAT_REDIRECT)
4278 old->in_pnext = np->in_dpnext;
4280 old->in_pnext = np->in_spnext;
4281 old->in_v = np->in_v[0];
4282 old->in_flags = np->in_flags;
4283 old->in_mssclamp = np->in_mssclamp;
4284 old->in_age[0] = np->in_age[0];
4285 old->in_age[1] = np->in_age[1];
4286 old->in_redir = np->in_redir;
4287 old->in_p = np->in_pr[0];
4288 if (np->in_redir == NAT_REDIRECT) {
4289 old->in_next6 = np->in_ndst.na_nextaddr;
4290 old->in_in[0] = np->in_ndst.na_addr[0];
4291 old->in_in[1] = np->in_ndst.na_addr[1];
4292 old->in_out[0] = np->in_odst.na_addr[0];
4293 old->in_out[1] = np->in_odst.na_addr[1];
4294 old->in_src[0] = np->in_osrc.na_addr[0];
4295 old->in_src[1] = np->in_osrc.na_addr[1];
4297 old->in_next6 = np->in_nsrc.na_nextaddr;
4298 old->in_out[0] = np->in_nsrc.na_addr[0];
4299 old->in_out[1] = np->in_nsrc.na_addr[1];
4300 old->in_in[0] = np->in_osrc.na_addr[0];
4301 old->in_in[1] = np->in_osrc.na_addr[1];
4302 old->in_src[0] = np->in_odst.na_addr[0];
4303 old->in_src[1] = np->in_odst.na_addr[1];
4305 ipfv5tuctov4(&np->in_tuc, &old->in_tuc);
4306 if (np->in_redir == NAT_REDIRECT) {
4307 old->in_port[0] = np->in_dpmin;
4308 old->in_port[1] = np->in_dpmax;
4310 old->in_port[0] = np->in_spmin;
4311 old->in_port[1] = np->in_spmax;
4313 old->in_ppip = np->in_ppip;
4314 old->in_ippip = np->in_ippip;
4315 bcopy(&np->in_tag, &old->in_tag, sizeof(np->in_tag));
4317 if (np->in_ifnames[0] >= 0) {
4318 strncpy(old->in_ifnames[0], np->in_names + np->in_ifnames[0],
4320 old->in_ifnames[0][LIFNAMSIZ - 1] = '\0';
4322 if (np->in_ifnames[1] >= 0) {
4323 strncpy(old->in_ifnames[1], np->in_names + np->in_ifnames[1],
4325 old->in_ifnames[1][LIFNAMSIZ - 1] = '\0';
4327 if (np->in_plabel >= 0) {
4328 strncpy(old->in_plabel, np->in_names + np->in_plabel,
4330 old->in_plabel[APR_LABELLEN - 1] = '\0';
4336 ipnat_current_to_4_1_0(current, old)
4340 ipnat_t *np = (ipnat_t *)current;
4342 old->in_next = np->in_next;
4343 old->in_rnext = np->in_rnext;
4344 old->in_prnext = np->in_prnext;
4345 old->in_mnext = np->in_mnext;
4346 old->in_pmnext = np->in_pmnext;
4347 old->in_tqehead[0] = np->in_tqehead[0];
4348 old->in_tqehead[1] = np->in_tqehead[1];
4349 old->in_ifps[0] = np->in_ifps[0];
4350 old->in_ifps[1] = np->in_ifps[1];
4351 old->in_apr = np->in_apr;
4352 old->in_comment = np->in_comment;
4353 old->in_space = np->in_space;
4354 old->in_hits = np->in_hits;
4355 old->in_use = np->in_use;
4356 old->in_hv = np->in_hv[0];
4357 old->in_flineno = np->in_flineno;
4358 if (old->in_redir == NAT_REDIRECT)
4359 old->in_pnext = np->in_dpnext;
4361 old->in_pnext = np->in_spnext;
4362 old->in_v = np->in_v[0];
4363 old->in_flags = np->in_flags;
4364 old->in_mssclamp = np->in_mssclamp;
4365 old->in_age[0] = np->in_age[0];
4366 old->in_age[1] = np->in_age[1];
4367 old->in_redir = np->in_redir;
4368 old->in_p = np->in_pr[0];
4369 if (np->in_redir == NAT_REDIRECT) {
4370 old->in_next6 = np->in_ndst.na_nextaddr;
4371 old->in_in[0] = np->in_ndst.na_addr[0];
4372 old->in_in[1] = np->in_ndst.na_addr[1];
4373 old->in_out[0] = np->in_odst.na_addr[0];
4374 old->in_out[1] = np->in_odst.na_addr[1];
4375 old->in_src[0] = np->in_osrc.na_addr[0];
4376 old->in_src[1] = np->in_osrc.na_addr[1];
4378 old->in_next6 = np->in_nsrc.na_nextaddr;
4379 old->in_out[0] = np->in_nsrc.na_addr[0];
4380 old->in_out[1] = np->in_nsrc.na_addr[1];
4381 old->in_in[0] = np->in_osrc.na_addr[0];
4382 old->in_in[1] = np->in_osrc.na_addr[1];
4383 old->in_src[0] = np->in_odst.na_addr[0];
4384 old->in_src[1] = np->in_odst.na_addr[1];
4386 ipfv5tuctov4(&np->in_tuc, &old->in_tuc);
4387 if (np->in_redir == NAT_REDIRECT) {
4388 old->in_port[0] = np->in_dpmin;
4389 old->in_port[1] = np->in_dpmax;
4391 old->in_port[0] = np->in_spmin;
4392 old->in_port[1] = np->in_spmax;
4394 old->in_ppip = np->in_ppip;
4395 old->in_ippip = np->in_ippip;
4396 bcopy(&np->in_tag, &old->in_tag, sizeof(np->in_tag));
4398 if (np->in_ifnames[0] >= 0) {
4399 strncpy(old->in_ifnames[0], np->in_names + np->in_ifnames[0],
4401 old->in_ifnames[0][LIFNAMSIZ - 1] = '\0';
4403 if (np->in_ifnames[1] >= 0) {
4404 strncpy(old->in_ifnames[1], np->in_names + np->in_ifnames[1],
4406 old->in_ifnames[1][LIFNAMSIZ - 1] = '\0';
4408 if (np->in_plabel >= 0) {
4409 strncpy(old->in_plabel, np->in_names + np->in_plabel,
4411 old->in_plabel[APR_LABELLEN - 1] = '\0';
4417 ipstate_current_to_4_1_16(current, old)
4419 ipstate_4_1_16_t *old;
4421 ipstate_t *is = (ipstate_t *)current;
4423 old->is_lock = is->is_lock;
4424 old->is_next = is->is_next;
4425 old->is_pnext = is->is_pnext;
4426 old->is_hnext = is->is_hnext;
4427 old->is_phnext = is->is_phnext;
4428 old->is_me = is->is_me;
4429 old->is_ifp[0] = is->is_ifp[0];
4430 old->is_ifp[1] = is->is_ifp[1];
4431 old->is_sync = is->is_sync;
4432 old->is_rule = is->is_rule;
4433 old->is_tqehead[0] = is->is_tqehead[0];
4434 old->is_tqehead[1] = is->is_tqehead[1];
4435 old->is_isc = is->is_isc;
4436 old->is_pkts[0] = is->is_pkts[0];
4437 old->is_pkts[1] = is->is_pkts[1];
4438 old->is_pkts[2] = is->is_pkts[2];
4439 old->is_pkts[3] = is->is_pkts[3];
4440 old->is_bytes[0] = is->is_bytes[0];
4441 old->is_bytes[1] = is->is_bytes[1];
4442 old->is_bytes[2] = is->is_bytes[2];
4443 old->is_bytes[3] = is->is_bytes[3];
4444 old->is_icmppkts[0] = is->is_icmppkts[0];
4445 old->is_icmppkts[1] = is->is_icmppkts[1];
4446 old->is_icmppkts[2] = is->is_icmppkts[2];
4447 old->is_icmppkts[3] = is->is_icmppkts[3];
4448 old->is_sti = is->is_sti;
4449 old->is_frage[0] = is->is_frage[0];
4450 old->is_frage[1] = is->is_frage[1];
4451 old->is_ref = is->is_ref;
4452 old->is_isninc[0] = is->is_isninc[0];
4453 old->is_isninc[1] = is->is_isninc[1];
4454 old->is_sumd[0] = is->is_sumd[0];
4455 old->is_sumd[1] = is->is_sumd[1];
4456 old->is_src = is->is_src;
4457 old->is_dst = is->is_dst;
4458 old->is_pass = is->is_pass;
4459 old->is_p = is->is_p;
4460 old->is_v = is->is_v;
4461 old->is_hv = is->is_hv;
4462 old->is_tag = is->is_tag;
4463 old->is_opt[0] = is->is_opt[0];
4464 old->is_opt[1] = is->is_opt[1];
4465 old->is_optmsk[0] = is->is_optmsk[0];
4466 old->is_optmsk[1] = is->is_optmsk[1];
4467 old->is_sec = is->is_sec;
4468 old->is_secmsk = is->is_secmsk;
4469 old->is_auth = is->is_auth;
4470 old->is_authmsk = is->is_authmsk;
4471 ipf_v5tcpinfoto4(&is->is_tcp, &old->is_tcp);
4472 old->is_flags = is->is_flags;
4473 old->is_flx[0][0] = is->is_flx[0][0];
4474 old->is_flx[0][1] = is->is_flx[0][1];
4475 old->is_flx[1][0] = is->is_flx[1][0];
4476 old->is_flx[1][1] = is->is_flx[1][1];
4477 old->is_rulen = is->is_rulen;
4478 old->is_s0[0] = is->is_s0[0];
4479 old->is_s0[1] = is->is_s0[1];
4480 old->is_smsk[0] = is->is_smsk[0];
4481 old->is_smsk[1] = is->is_smsk[1];
4482 bcopy(is->is_group, old->is_group, sizeof(is->is_group));
4483 bcopy(is->is_sbuf, old->is_sbuf, sizeof(is->is_sbuf));
4484 bcopy(is->is_ifname, old->is_ifname, sizeof(is->is_ifname));
4489 ipstate_current_to_4_1_0(current, old)
4491 ipstate_4_1_0_t *old;
4493 ipstate_t *is = (ipstate_t *)current;
4495 old->is_lock = is->is_lock;
4496 old->is_next = is->is_next;
4497 old->is_pnext = is->is_pnext;
4498 old->is_hnext = is->is_hnext;
4499 old->is_phnext = is->is_phnext;
4500 old->is_me = is->is_me;
4501 old->is_ifp[0] = is->is_ifp[0];
4502 old->is_ifp[1] = is->is_ifp[1];
4503 old->is_sync = is->is_sync;
4504 bzero(&old->is_nat, sizeof(old->is_nat));
4505 old->is_rule = is->is_rule;
4506 old->is_tqehead[0] = is->is_tqehead[0];
4507 old->is_tqehead[1] = is->is_tqehead[1];
4508 old->is_isc = is->is_isc;
4509 old->is_pkts[0] = is->is_pkts[0];
4510 old->is_pkts[1] = is->is_pkts[1];
4511 old->is_pkts[2] = is->is_pkts[2];
4512 old->is_pkts[3] = is->is_pkts[3];
4513 old->is_bytes[0] = is->is_bytes[0];
4514 old->is_bytes[1] = is->is_bytes[1];
4515 old->is_bytes[2] = is->is_bytes[2];
4516 old->is_bytes[3] = is->is_bytes[3];
4517 old->is_icmppkts[0] = is->is_icmppkts[0];
4518 old->is_icmppkts[1] = is->is_icmppkts[1];
4519 old->is_icmppkts[2] = is->is_icmppkts[2];
4520 old->is_icmppkts[3] = is->is_icmppkts[3];
4521 old->is_sti = is->is_sti;
4522 old->is_frage[0] = is->is_frage[0];
4523 old->is_frage[1] = is->is_frage[1];
4524 old->is_ref = is->is_ref;
4525 old->is_isninc[0] = is->is_isninc[0];
4526 old->is_isninc[1] = is->is_isninc[1];
4527 old->is_sumd[0] = is->is_sumd[0];
4528 old->is_sumd[1] = is->is_sumd[1];
4529 old->is_src = is->is_src;
4530 old->is_dst = is->is_dst;
4531 old->is_pass = is->is_pass;
4532 old->is_p = is->is_p;
4533 old->is_v = is->is_v;
4534 old->is_hv = is->is_hv;
4535 old->is_tag = is->is_tag;
4536 old->is_opt[0] = is->is_opt[0];
4537 old->is_opt[1] = is->is_opt[1];
4538 old->is_optmsk[0] = is->is_optmsk[0];
4539 old->is_optmsk[1] = is->is_optmsk[1];
4540 old->is_sec = is->is_sec;
4541 old->is_secmsk = is->is_secmsk;
4542 old->is_auth = is->is_auth;
4543 old->is_authmsk = is->is_authmsk;
4544 ipf_v5tcpinfoto4(&is->is_tcp, &old->is_tcp);
4545 old->is_flags = is->is_flags;
4546 old->is_flx[0][0] = is->is_flx[0][0];
4547 old->is_flx[0][1] = is->is_flx[0][1];
4548 old->is_flx[1][0] = is->is_flx[1][0];
4549 old->is_flx[1][1] = is->is_flx[1][1];
4550 old->is_rulen = is->is_rulen;
4551 old->is_s0[0] = is->is_s0[0];
4552 old->is_s0[1] = is->is_s0[1];
4553 old->is_smsk[0] = is->is_smsk[0];
4554 old->is_smsk[1] = is->is_smsk[1];
4555 bcopy(is->is_group, old->is_group, sizeof(is->is_group));
4556 bcopy(is->is_sbuf, old->is_sbuf, sizeof(is->is_sbuf));
4557 bcopy(is->is_ifname, old->is_ifname, sizeof(is->is_ifname));
4562 ips_stat_current_to_4_1_21(current, old)
4564 ips_stat_4_1_21_t *old;
4566 ips_stat_t *st = (ips_stat_t *)current;
4568 old->iss_hits = st->iss_hits;
4569 old->iss_miss = st->iss_check_miss;
4570 old->iss_max = st->iss_max;
4571 old->iss_maxref = st->iss_max_ref;
4572 old->iss_tcp = st->iss_proto[IPPROTO_TCP];
4573 old->iss_udp = st->iss_proto[IPPROTO_UDP];
4574 old->iss_icmp = st->iss_proto[IPPROTO_ICMP];
4575 old->iss_nomem = st->iss_nomem;
4576 old->iss_expire = st->iss_expire;
4577 old->iss_fin = st->iss_fin;
4578 old->iss_active = st->iss_active;
4579 old->iss_logged = st->iss_log_ok;
4580 old->iss_logfail = st->iss_log_fail;
4581 old->iss_inuse = st->iss_inuse;
4582 old->iss_wild = st->iss_wild;
4583 old->iss_ticks = st->iss_ticks;
4584 old->iss_bucketfull = st->iss_bucket_full;
4585 old->iss_statesize = st->iss_state_size;
4586 old->iss_statemax = st->iss_state_max;
4587 old->iss_table = st->iss_table;
4588 old->iss_list = st->iss_list;
4589 old->iss_bucketlen = (void *)st->iss_bucketlen;
4590 old->iss_tcptab = st->iss_tcptab;
4595 ips_stat_current_to_4_1_0(current, old)
4597 ips_stat_4_1_0_t *old;
4599 ips_stat_t *st = (ips_stat_t *)current;
4601 old->iss_hits = st->iss_hits;
4602 old->iss_miss = st->iss_check_miss;
4603 old->iss_max = st->iss_max;
4604 old->iss_maxref = st->iss_max_ref;
4605 old->iss_tcp = st->iss_proto[IPPROTO_TCP];
4606 old->iss_udp = st->iss_proto[IPPROTO_UDP];
4607 old->iss_icmp = st->iss_proto[IPPROTO_ICMP];
4608 old->iss_nomem = st->iss_nomem;
4609 old->iss_expire = st->iss_expire;
4610 old->iss_fin = st->iss_fin;
4611 old->iss_active = st->iss_active;
4612 old->iss_logged = st->iss_log_ok;
4613 old->iss_logfail = st->iss_log_fail;
4614 old->iss_inuse = st->iss_inuse;
4615 old->iss_wild = st->iss_wild;
4616 old->iss_ticks = st->iss_ticks;
4617 old->iss_bucketfull = st->iss_bucket_full;
4618 old->iss_statesize = st->iss_state_size;
4619 old->iss_statemax = st->iss_state_max;
4620 old->iss_table = st->iss_table;
4621 old->iss_list = st->iss_list;
4622 old->iss_bucketlen = (void *)st->iss_bucketlen;
4627 nat_save_current_to_4_1_16(current, old)
4629 nat_save_4_1_16_t *old;
4631 nat_save_t *nats = (nat_save_t *)current;
4633 old->ipn_next = nats->ipn_next;
4634 bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
4635 bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
4636 frentry_current_to_4_1_16(&nats->ipn_fr, &old->ipn_fr);
4637 old->ipn_dsize = nats->ipn_dsize;
4638 bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
4643 nat_save_current_to_4_1_14(current, old)
4645 nat_save_4_1_14_t *old;
4647 nat_save_t *nats = (nat_save_t *)current;
4649 old->ipn_next = nats->ipn_next;
4650 bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
4651 bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
4652 frentry_current_to_4_1_0(&nats->ipn_fr, &old->ipn_fr);
4653 old->ipn_dsize = nats->ipn_dsize;
4654 bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
4659 nat_save_current_to_4_1_3(current, old)
4661 nat_save_4_1_3_t *old;
4663 nat_save_t *nats = (nat_save_t *)current;
4665 old->ipn_next = nats->ipn_next;
4666 bcopy(&nats->ipn_nat, &old->ipn_nat, sizeof(old->ipn_nat));
4667 bcopy(&nats->ipn_ipnat, &old->ipn_ipnat, sizeof(old->ipn_ipnat));
4668 frentry_current_to_4_1_0(&nats->ipn_fr, &old->ipn_fr);
4669 old->ipn_dsize = nats->ipn_dsize;
4670 bcopy(nats->ipn_data, old->ipn_data, sizeof(nats->ipn_data));
4675 nat_current_to_4_1_25(current, old)
4679 nat_t *nat = (nat_t *)current;
4681 old->nat_lock = nat->nat_lock;
4682 old->nat_next = (void *)nat->nat_next;
4683 old->nat_pnext = (void *)nat->nat_pnext;
4684 old->nat_hnext[0] = (void *)nat->nat_hnext[0];
4685 old->nat_hnext[1] = (void *)nat->nat_hnext[1];
4686 old->nat_phnext[0] = (void *)nat->nat_phnext[0];
4687 old->nat_phnext[1] = (void *)nat->nat_phnext[1];
4688 old->nat_hm = nat->nat_hm;
4689 old->nat_data = nat->nat_data;
4690 old->nat_me = (void *)nat->nat_me;
4691 old->nat_state = nat->nat_state;
4692 old->nat_aps = nat->nat_aps;
4693 old->nat_fr = nat->nat_fr;
4694 old->nat_ptr = (void *)nat->nat_ptr;
4695 old->nat_ifps[0] = nat->nat_ifps[0];
4696 old->nat_ifps[1] = nat->nat_ifps[1];
4697 old->nat_sync = nat->nat_sync;
4698 old->nat_tqe = nat->nat_tqe;
4699 old->nat_flags = nat->nat_flags;
4700 old->nat_sumd[0] = nat->nat_sumd[0];
4701 old->nat_sumd[1] = nat->nat_sumd[1];
4702 old->nat_ipsumd = nat->nat_ipsumd;
4703 old->nat_mssclamp = nat->nat_mssclamp;
4704 old->nat_pkts[0] = nat->nat_pkts[0];
4705 old->nat_pkts[1] = nat->nat_pkts[1];
4706 old->nat_bytes[0] = nat->nat_bytes[0];
4707 old->nat_bytes[1] = nat->nat_bytes[1];
4708 old->nat_ref = nat->nat_ref;
4709 old->nat_dir = nat->nat_dir;
4710 old->nat_p = nat->nat_pr[0];
4711 old->nat_use = nat->nat_use;
4712 old->nat_hv[0] = nat->nat_hv[0];
4713 old->nat_hv[1] = nat->nat_hv[1];
4714 old->nat_rev = nat->nat_rev;
4715 old->nat_redir = nat->nat_redir;
4716 bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
4717 bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
4719 if (nat->nat_redir == NAT_REDIRECT) {
4720 old->nat_inip6 = nat->nat_ndst6;
4721 old->nat_outip6 = nat->nat_odst6;
4722 old->nat_oip6 = nat->nat_osrc6;
4723 old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
4724 old->nat_un.nat_unt.ts_dport = nat->nat_odport;
4726 old->nat_inip6 = nat->nat_osrc6;
4727 old->nat_outip6 = nat->nat_nsrc6;
4728 old->nat_oip6 = nat->nat_odst6;
4729 old->nat_un.nat_unt.ts_sport = nat->nat_osport;
4730 old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
4736 nat_current_to_4_1_14(current, old)
4740 nat_t *nat = (nat_t *)current;
4742 old->nat_lock = nat->nat_lock;
4743 old->nat_next = nat->nat_next;
4744 old->nat_pnext = NULL;
4745 old->nat_hnext[0] = NULL;
4746 old->nat_hnext[1] = NULL;
4747 old->nat_phnext[0] = NULL;
4748 old->nat_phnext[1] = NULL;
4749 old->nat_hm = nat->nat_hm;
4750 old->nat_data = nat->nat_data;
4751 old->nat_me = (void *)nat->nat_me;
4752 old->nat_state = nat->nat_state;
4753 old->nat_aps = nat->nat_aps;
4754 old->nat_fr = nat->nat_fr;
4755 old->nat_ptr = nat->nat_ptr;
4756 old->nat_ifps[0] = nat->nat_ifps[0];
4757 old->nat_ifps[1] = nat->nat_ifps[1];
4758 old->nat_sync = nat->nat_sync;
4759 old->nat_tqe = nat->nat_tqe;
4760 old->nat_flags = nat->nat_flags;
4761 old->nat_sumd[0] = nat->nat_sumd[0];
4762 old->nat_sumd[1] = nat->nat_sumd[1];
4763 old->nat_ipsumd = nat->nat_ipsumd;
4764 old->nat_mssclamp = nat->nat_mssclamp;
4765 old->nat_pkts[0] = nat->nat_pkts[0];
4766 old->nat_pkts[1] = nat->nat_pkts[1];
4767 old->nat_bytes[0] = nat->nat_bytes[0];
4768 old->nat_bytes[1] = nat->nat_bytes[1];
4769 old->nat_ref = nat->nat_ref;
4770 old->nat_dir = nat->nat_dir;
4771 old->nat_p = nat->nat_pr[0];
4772 old->nat_use = nat->nat_use;
4773 old->nat_hv[0] = nat->nat_hv[0];
4774 old->nat_hv[1] = nat->nat_hv[1];
4775 old->nat_rev = nat->nat_rev;
4776 bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
4777 bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
4779 if (nat->nat_redir == NAT_REDIRECT) {
4780 old->nat_inip6 = nat->nat_ndst6;
4781 old->nat_outip6 = nat->nat_odst6;
4782 old->nat_oip6 = nat->nat_osrc6;
4783 old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
4784 old->nat_un.nat_unt.ts_dport = nat->nat_odport;
4786 old->nat_inip6 = nat->nat_osrc6;
4787 old->nat_outip6 = nat->nat_nsrc6;
4788 old->nat_oip6 = nat->nat_odst6;
4789 old->nat_un.nat_unt.ts_sport = nat->nat_osport;
4790 old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
4796 nat_current_to_4_1_3(current, old)
4800 nat_t *nat = (nat_t *)current;
4802 old->nat_lock = nat->nat_lock;
4803 old->nat_next = nat->nat_next;
4804 old->nat_pnext = NULL;
4805 old->nat_hnext[0] = NULL;
4806 old->nat_hnext[1] = NULL;
4807 old->nat_phnext[0] = NULL;
4808 old->nat_phnext[1] = NULL;
4809 old->nat_hm = nat->nat_hm;
4810 old->nat_data = nat->nat_data;
4811 old->nat_me = (void *)nat->nat_me;
4812 old->nat_state = nat->nat_state;
4813 old->nat_aps = nat->nat_aps;
4814 old->nat_fr = nat->nat_fr;
4815 old->nat_ptr = nat->nat_ptr;
4816 old->nat_ifps[0] = nat->nat_ifps[0];
4817 old->nat_ifps[1] = nat->nat_ifps[1];
4818 old->nat_sync = nat->nat_sync;
4819 old->nat_tqe = nat->nat_tqe;
4820 old->nat_flags = nat->nat_flags;
4821 old->nat_sumd[0] = nat->nat_sumd[0];
4822 old->nat_sumd[1] = nat->nat_sumd[1];
4823 old->nat_ipsumd = nat->nat_ipsumd;
4824 old->nat_mssclamp = nat->nat_mssclamp;
4825 old->nat_pkts[0] = nat->nat_pkts[0];
4826 old->nat_pkts[1] = nat->nat_pkts[1];
4827 old->nat_bytes[0] = nat->nat_bytes[0];
4828 old->nat_bytes[1] = nat->nat_bytes[1];
4829 old->nat_ref = nat->nat_ref;
4830 old->nat_dir = nat->nat_dir;
4831 old->nat_p = nat->nat_pr[0];
4832 old->nat_use = nat->nat_use;
4833 old->nat_hv[0] = nat->nat_hv[0];
4834 old->nat_hv[1] = nat->nat_hv[1];
4835 old->nat_rev = nat->nat_rev;
4836 bcopy(nat->nat_ifnames[0], old->nat_ifnames[0], LIFNAMSIZ);
4837 bcopy(nat->nat_ifnames[1], old->nat_ifnames[1], LIFNAMSIZ);
4839 if (nat->nat_redir == NAT_REDIRECT) {
4840 old->nat_inip6 = nat->nat_ndst6;
4841 old->nat_outip6 = nat->nat_odst6;
4842 old->nat_oip6 = nat->nat_osrc6;
4843 old->nat_un.nat_unt.ts_sport = nat->nat_ndport;
4844 old->nat_un.nat_unt.ts_dport = nat->nat_odport;
4846 old->nat_inip6 = nat->nat_osrc6;
4847 old->nat_outip6 = nat->nat_nsrc6;
4848 old->nat_oip6 = nat->nat_odst6;
4849 old->nat_un.nat_unt.ts_sport = nat->nat_osport;
4850 old->nat_un.nat_unt.ts_dport = nat->nat_nsport;
4854 #endif /* IPFILTER_COMPAT */