-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathip_fil_compat.c
4854 lines (4499 loc) · 123 KB
/
ip_fil_compat.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2002-2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#if defined(KERNEL) || defined(_KERNEL)
# undef KERNEL
# undef _KERNEL
# define KERNEL 1
# define _KERNEL 1
#endif
#if defined(__osf__)
# define _PROTO_NET_H_
#endif
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/file.h>
#if __FreeBSD_version >= 220000 && defined(_KERNEL)
# include <sys/fcntl.h>
# include <sys/filio.h>
#else
# include <sys/ioctl.h>
#endif
#if !defined(_KERNEL)
# include <string.h>
# define _KERNEL
# ifdef __OpenBSD__
struct file;
# endif
# include <sys/uio.h>
# undef _KERNEL
#endif
#include <sys/socket.h>
#if (defined(__osf__) || defined(AIX) || defined(__hpux) || defined(__sgi)) && defined(_KERNEL)
# include "radix_ipf_local.h"
# define _RADIX_H_
#endif
#include <net/if.h>
#if defined(__FreeBSD__)
# include <sys/cdefs.h>
# include <sys/proc.h>
#endif
#if defined(_KERNEL)
# include <sys/systm.h>
# if !defined(__SVR4) && !defined(__svr4__)
# include <sys/mbuf.h>
# endif
#endif
#include <netinet/in.h>
#include "netinet/ip_compat.h"
#include "netinet/ip_fil.h"
#include "netinet/ip_pool.h"
#include "netinet/ip_htable.h"
#include "netinet/ip_lookup.h"
#include "netinet/ip_nat.h"
#include "netinet/ip_state.h"
#include "netinet/ip_proxy.h"
#include "netinet/ip_auth.h"
/* END OF INCLUDES */
/*
* NetBSD has moved to 64bit time_t for all architectures.
* For some, such as sparc64, there is no change because long is already
* 64bit, but for others (i386), there is...
*/
#ifdef IPFILTER_COMPAT
# ifdef __NetBSD__
typedef struct timeval_l {
long tv_sec;
long tv_usec;
} timeval_l_t;
# endif
/* ------------------------------------------------------------------------ */
typedef struct tcpinfo4 {
u_short ts_sport;
u_short ts_dport;
tcpdata_t ts_data[2];
} tcpinfo4_t;
static void ipf_v5tcpinfoto4(tcpinfo_t *, tcpinfo4_t *);
static void
ipf_v5tcpinfoto4(v5, v4)
tcpinfo_t *v5;
tcpinfo4_t *v4;
{
v4->ts_sport = v5->ts_sport;
v4->ts_dport = v5->ts_dport;
v4->ts_data[0] = v5->ts_data[0];
v4->ts_data[1] = v5->ts_data[1];
}
typedef struct fr_ip4 {
u_32_t fi_v:4;
u_32_t fi_xx:4;
u_32_t fi_tos:8;
u_32_t fi_ttl:8;
u_32_t fi_p:8;
u_32_t fi_optmsk;
i6addr_t fi_src;
i6addr_t fi_dst;
u_short ofi_secmsk;
u_short ofi_auth;
u_32_t fi_flx;
u_32_t fi_tcpmsk;
u_32_t fi_res1;
} frip4_t;
typedef struct frpcmp4 {
int frp_cmp;
u_short frp_port;
u_short frp_top;
} frpcmp4_t;
typedef struct frtuc4 {
u_char ftu_tcpfm;
u_char ftu_tcpf;
frpcmp4_t ftu_src;
frpcmp4_t ftu_dst;
} frtuc4_t;
typedef struct fripf4 {
frip4_t fri_ip;
frip4_t fri_mip;
u_short fri_icmpm;
u_short fri_icmp;
frtuc4_t fri_tuc;
int fri_satype;
int fri_datype;
int fri_sifpidx;
int fri_difpidx;
} fripf4_t;
typedef struct frdest_4 {
void *fd_ifp;
i6addr_t ofd_ip6;
char fd_ifname[LIFNAMSIZ];
} frdest_4_t;
/* ------------------------------------------------------------------------ */
/* 5.1.0 new release (current)
* 4.1.34 changed the size of the time structure used for pps
* 4.1.16 moved the location of fr_flineno
* 4.1.0 base version
*/
typedef struct frentry_4_1_34 {
ipfmutex_t fr_lock;
struct frentry *fr_next;
struct frentry **fr_grp;
struct ipscan *fr_isc;
void *fr_ifas[4];
void *fr_ptr; /* for use with fr_arg */
char *fr_comment; /* text comment for rule */
int fr_ref; /* reference count - for grouping */
int fr_statecnt; /* state count - for limit rules */
int fr_flineno; /* line number from conf file */
U_QUAD_T fr_hits;
U_QUAD_T fr_bytes;
union {
struct timeval frp_lastpkt;
char frp_bytes[12];
} fr_lpu;
int fr_curpps;
union {
void *fru_data;
char *fru_caddr;
fripf4_t *fru_ipf;
frentfunc_t fru_func;
} fr_dun;
ipfunc_t fr_func; /* call this function */
int fr_dsize;
int fr_pps;
int fr_statemax; /* max reference count */
u_32_t fr_type;
u_32_t fr_flags; /* per-rule flags && options (see below) */
u_32_t fr_logtag; /* user defined log tag # */
u_32_t fr_collect; /* collection number */
u_int fr_arg; /* misc. numeric arg for rule */
u_int fr_loglevel; /* syslog log facility + priority */
u_int fr_age[2]; /* non-TCP timeouts */
u_char fr_v;
u_char fr_icode; /* return ICMP code */
char fr_group[FR_GROUPLEN]; /* group to which this rule belongs */
char fr_grhead[FR_GROUPLEN]; /* group # which this rule starts */
ipftag_t fr_nattag;
char fr_ifnames[4][LIFNAMSIZ];
char fr_isctag[16];
frdest_4_t fr_tifs[2]; /* "to"/"reply-to" interface */
frdest_4_t fr_dif; /* duplicate packet interface */
u_int fr_cksum; /* checksum on filter rules for performance */
} frentry_4_1_34_t;
typedef struct frentry_4_1_16 {
ipfmutex_t fr_lock;
struct frentry *fr_next;
struct frentry **fr_grp;
struct ipscan *fr_isc;
void *fr_ifas[4];
void *fr_ptr;
char *fr_comment;
int fr_ref;
int fr_statecnt;
int fr_flineno;
U_QUAD_T fr_hits;
U_QUAD_T fr_bytes;
union {
#ifdef __NetBSD__
timeval_l_t frp_lastpkt;
#else
struct timeval frp_lastpkt;
#endif
} fr_lpu;
int fr_curpps;
union {
void *fru_data;
caddr_t fru_caddr;
fripf4_t *fru_ipf;
frentfunc_t fru_func;
} fr_dun;
ipfunc_t fr_func;
int fr_dsize;
int fr_pps;
int fr_statemax;
u_32_t fr_type;
u_32_t fr_flags;
u_32_t fr_logtag;
u_32_t fr_collect;
u_int fr_arg;
u_int fr_loglevel;
u_int fr_age[2];
u_char fr_v;
u_char fr_icode;
char fr_group[FR_GROUPLEN];
char fr_grhead[FR_GROUPLEN];
ipftag_t fr_nattag;
char fr_ifnames[4][LIFNAMSIZ];
char fr_isctag[16];
frdest_4_t fr_tifs[2];
frdest_4_t fr_dif;
u_int fr_cksum;
} frentry_4_1_16_t;
typedef struct frentry_4_1_0 {
ipfmutex_t fr_lock;
struct frentry *fr_next;
struct frentry **fr_grp;
struct ipscan *fr_isc;
void *fr_ifas[4];
void *fr_ptr;
char *fr_comment;
int fr_ref;
int fr_statecnt;
U_QUAD_T fr_hits;
U_QUAD_T fr_bytes;
union {
#ifdef __NetBSD__
timeval_l_t frp_lastpkt;
#else
struct timeval frp_lastpkt;
#endif
} fr_lpu;
int fr_curpps;
union {
void *fru_data;
caddr_t fru_caddr;
fripf4_t *fru_ipf;
frentfunc_t fru_func;
} fr_dun;
/*
* Fields after this may not change whilst in the kernel.
*/
ipfunc_t fr_func;
int fr_dsize;
int fr_pps;
int fr_statemax;
int fr_flineno;
u_32_t fr_type;
u_32_t fr_flags;
u_32_t fr_logtag;
u_32_t fr_collect;
u_int fr_arg;
u_int fr_loglevel;
u_int fr_age[2];
u_char fr_v;
u_char fr_icode;
char fr_group[FR_GROUPLEN];
char fr_grhead[FR_GROUPLEN];
ipftag_t fr_nattag;
char fr_ifnames[4][LIFNAMSIZ];
char fr_isctag[16];
frdest_4_t fr_tifs[2];
frdest_4_t fr_dif;
u_int fr_cksum;
} frentry_4_1_0_t;
/* ------------------------------------------------------------------------ */
/*
* 5.1.0 new release (current)
* 4.1.32 removed both fin_state and fin_nat, added fin_pktnum
* 4.1.24 added fin_cksum
* 4.1.23 added fin_exthdr
* 4.1.11 added fin_ifname
* 4.1.4 added fin_hbuf
*/
typedef struct fr_info_4_1_32 {
void *fin_ifp; /* interface packet is `on' */
frip4_t fin_fi; /* IP Packet summary */
union {
u_short fid_16[2]; /* TCP/UDP ports, ICMP code/type */
u_32_t fid_32;
} fin_dat;
int fin_out; /* in or out ? 1 == out, 0 == in */
int fin_rev; /* state only: 1 = reverse */
u_short fin_hlen; /* length of IP header in bytes */
u_char ofin_tcpf; /* TCP header flags (SYN, ACK, etc) */
u_char fin_icode; /* ICMP error to return */
u_32_t fin_rule; /* rule # last matched */
char fin_group[FR_GROUPLEN]; /* group number, -1 for none */
struct frentry *fin_fr; /* last matching rule */
void *fin_dp; /* start of data past IP header */
int fin_dlen; /* length of data portion of packet */
int fin_plen;
int fin_ipoff; /* # bytes from buffer start to hdr */
u_short fin_id; /* IP packet id field */
u_short fin_off;
int fin_depth; /* Group nesting depth */
int fin_error; /* Error code to return */
int fin_cksum; /* -1 bad, 1 good, 0 not done */
u_int fin_pktnum;
void *fin_nattag;
void *fin_exthdr;
ip_t *ofin_ip;
mb_t **fin_mp; /* pointer to pointer to mbuf */
mb_t *fin_m; /* pointer to mbuf */
#ifdef MENTAT
mb_t *fin_qfm; /* pointer to mblk where pkt starts */
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_32_t;
typedef struct fr_info_4_1_24 {
void *fin_ifp;
frip4_t fin_fi;
union {
u_short fid_16[2];
u_32_t fid_32;
} fin_dat;
int fin_out;
int fin_rev;
u_short fin_hlen;
u_char ofin_tcpf;
u_char fin_icode;
u_32_t fin_rule;
char fin_group[FR_GROUPLEN];
struct frentry *fin_fr;
void *fin_dp;
int fin_dlen;
int fin_plen;
int fin_ipoff;
u_short fin_id;
u_short fin_off;
int fin_depth;
int fin_error;
int fin_cksum;
void *fin_state;
void *fin_nat;
void *fin_nattag;
void *fin_exthdr;
ip_t *ofin_ip;
mb_t **fin_mp;
mb_t *fin_m;
#ifdef MENTAT
mb_t *fin_qfm;
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_24_t;
typedef struct fr_info_4_1_23 {
void *fin_ifp;
frip4_t fin_fi;
union {
u_short fid_16[2];
u_32_t fid_32;
} fin_dat;
int fin_out;
int fin_rev;
u_short fin_hlen;
u_char ofin_tcpf;
u_char fin_icode;
u_32_t fin_rule;
char fin_group[FR_GROUPLEN];
struct frentry *fin_fr;
void *fin_dp;
int fin_dlen;
int fin_plen;
int fin_ipoff;
u_short fin_id;
u_short fin_off;
int fin_depth;
int fin_error;
void *fin_state;
void *fin_nat;
void *fin_nattag;
void *fin_exthdr;
ip_t *ofin_ip;
mb_t **fin_mp;
mb_t *fin_m;
#ifdef MENTAT
mb_t *fin_qfm;
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_23_t;
typedef struct fr_info_4_1_11 {
void *fin_ifp;
frip4_t fin_fi;
union {
u_short fid_16[2];
u_32_t fid_32;
} fin_dat;
int fin_out;
int fin_rev;
u_short fin_hlen;
u_char ofin_tcpf;
u_char fin_icode;
u_32_t fin_rule;
char fin_group[FR_GROUPLEN];
struct frentry *fin_fr;
void *fin_dp;
int fin_dlen;
int fin_plen;
int fin_ipoff;
u_short fin_id;
u_short fin_off;
int fin_depth;
int fin_error;
void *fin_state;
void *fin_nat;
void *fin_nattag;
ip_t *ofin_ip;
mb_t **fin_mp;
mb_t *fin_m;
#ifdef MENTAT
mb_t *fin_qfm;
void *fin_qpi;
char fin_ifname[LIFNAMSIZ];
#endif
#ifdef __sgi
void *fin_hbuf;
#endif
} fr_info_4_1_11_t;
/* ------------------------------------------------------------------------ */
typedef struct filterstats_4_1 {
u_long fr_pass; /* packets allowed */
u_long fr_block; /* packets denied */
u_long fr_nom; /* packets which don't match any rule */
u_long fr_short; /* packets which are short */
u_long fr_ppkl; /* packets allowed and logged */
u_long fr_bpkl; /* packets denied and logged */
u_long fr_npkl; /* packets unmatched and logged */
u_long fr_pkl; /* packets logged */
u_long fr_skip; /* packets to be logged but buffer full */
u_long fr_ret; /* packets for which a return is sent */
u_long fr_acct; /* packets for which counting was performed */
u_long fr_bnfr; /* bad attempts to allocate fragment state */
u_long fr_nfr; /* new fragment state kept */
u_long fr_cfr; /* add new fragment state but complete pkt */
u_long fr_bads; /* bad attempts to allocate packet state */
u_long fr_ads; /* new packet state kept */
u_long fr_chit; /* cached hit */
u_long fr_tcpbad; /* TCP checksum check failures */
u_long fr_pull[2]; /* good and bad pullup attempts */
u_long fr_badsrc; /* source received doesn't match route */
u_long fr_badttl; /* TTL in packet doesn't reach minimum */
u_long fr_bad; /* bad IP packets to the filter */
u_long fr_ipv6; /* IPv6 packets in/out */
u_long fr_ppshit; /* dropped because of pps ceiling */
u_long fr_ipud; /* IP id update failures */
} filterstats_4_1_t;
/*
* 5.1.0 new release (current)
* 4.1.33 changed the size of f_locks from IPL_LOGMAX to IPL_LOGSIZE
*/
typedef struct friostat_4_1_33 {
struct filterstats_4_1 of_st[2];
struct frentry *f_ipf[2][2];
struct frentry *f_acct[2][2];
struct frentry *f_ipf6[2][2];
struct frentry *f_acct6[2][2];
struct frentry *f_auth;
struct frgroup *f_groups[IPL_LOGSIZE][2];
u_long f_froute[2];
u_long f_ticks;
int f_locks[IPL_LOGSIZE];
size_t f_kmutex_sz;
size_t f_krwlock_sz;
int f_defpass; /* default pass - from fr_pass */
int f_active; /* 1 or 0 - active rule set */
int f_running; /* 1 if running, else 0 */
int f_logging; /* 1 if enabled, else 0 */
int f_features;
char f_version[32]; /* version string */
} friostat_4_1_33_t;
typedef struct friostat_4_1_0 {
struct filterstats_4_1 of_st[2];
struct frentry *f_ipf[2][2];
struct frentry *f_acct[2][2];
struct frentry *f_ipf6[2][2];
struct frentry *f_acct6[2][2];
struct frentry *f_auth;
struct frgroup *f_groups[IPL_LOGSIZE][2];
u_long f_froute[2];
u_long f_ticks;
int f_locks[IPL_LOGMAX];
size_t f_kmutex_sz;
size_t f_krwlock_sz;
int f_defpass;
int f_active;
int f_running;
int f_logging;
int f_features;
char f_version[32];
} friostat_4_1_0_t;
/* ------------------------------------------------------------------------ */
/*
* 5.1.0 new release (current)
* 4.1.14 added in_lock
*/
typedef struct ipnat_4_1_14 {
ipfmutex_t in_lock;
struct ipnat *in_next; /* NAT rule list next */
struct ipnat *in_rnext; /* rdr rule hash next */
struct ipnat **in_prnext; /* prior rdr next ptr */
struct ipnat *in_mnext; /* map rule hash next */
struct ipnat **in_pmnext; /* prior map next ptr */
struct ipftq *in_tqehead[2];
void *in_ifps[2];
void *in_apr;
char *in_comment;
i6addr_t in_next6;
u_long in_space;
u_long in_hits;
u_int in_use;
u_int in_hv;
int in_flineno; /* conf. file line number */
u_short in_pnext;
u_char in_v;
u_char in_xxx;
/* From here to the end is covered by IPN_CMPSIZ */
u_32_t in_flags;
u_32_t in_mssclamp; /* if != 0 clamp MSS to this */
u_int in_age[2];
int in_redir; /* see below for values */
int in_p; /* protocol. */
i6addr_t in_in[2];
i6addr_t in_out[2];
i6addr_t in_src[2];
frtuc4_t in_tuc;
u_short in_port[2];
u_short in_ppip; /* ports per IP. */
u_short in_ippip; /* IP #'s per IP# */
char in_ifnames[2][LIFNAMSIZ];
char in_plabel[APR_LABELLEN]; /* proxy label. */
ipftag_t in_tag;
} ipnat_4_1_14_t;
typedef struct ipnat_4_1_0 {
struct ipnat *in_next;
struct ipnat *in_rnext;
struct ipnat **in_prnext;
struct ipnat *in_mnext;
struct ipnat **in_pmnext;
struct ipftq *in_tqehead[2];
void *in_ifps[2];
void *in_apr;
char *in_comment;
i6addr_t in_next6;
u_long in_space;
u_long in_hits;
u_int in_use;
u_int in_hv;
int in_flineno;
u_short in_pnext;
u_char in_v;
u_char in_xxx;
u_32_t in_flags;
u_32_t in_mssclamp;
u_int in_age[2];
int in_redir;
int in_p;
i6addr_t in_in[2];
i6addr_t in_out[2];
i6addr_t in_src[2];
frtuc4_t in_tuc;
u_short in_port[2];
u_short in_ppip;
u_short in_ippip;
char in_ifnames[2][LIFNAMSIZ];
char in_plabel[APR_LABELLEN];
ipftag_t in_tag;
} ipnat_4_1_0_t;
/* ------------------------------------------------------------------------ */
typedef struct natlookup_4_1_1 {
struct in_addr onl_inip;
struct in_addr onl_outip;
struct in_addr onl_realip;
int nl_flags;
u_short nl_inport;
u_short nl_outport;
u_short nl_realport;
} natlookup_4_1_1_t;
/* ------------------------------------------------------------------------ */
/*
* 4.1.25 added nat_seqnext (current)
* 4.1.14 added nat_redir
* 4.1.3 moved nat_rev
* 4.1.2 added nat_rev
*/
typedef struct nat_4_1_25 {
ipfmutex_t nat_lock;
struct nat_4_1_25 *nat_next;
struct nat_4_1_25 **nat_pnext;
struct nat_4_1_25 *nat_hnext[2];
struct nat_4_1_25 **nat_phnext[2];
struct hostmap *nat_hm;
void *nat_data;
struct nat_4_1_25 **nat_me;
struct ipstate *nat_state;
struct ap_session *nat_aps;
frentry_t *nat_fr;
struct ipnat_4_1_14 *nat_ptr;
void *nat_ifps[2];
void *nat_sync;
ipftqent_t nat_tqe;
u_32_t nat_flags;
u_32_t nat_sumd[2];
u_32_t nat_ipsumd;
u_32_t nat_mssclamp;
i6addr_t nat_inip6;
i6addr_t nat_outip6;
i6addr_t nat_oip6;
U_QUAD_T nat_pkts[2];
U_QUAD_T nat_bytes[2];
union {
udpinfo_t nat_unu;
tcpinfo4_t nat_unt;
icmpinfo_t nat_uni;
greinfo_t nat_ugre;
} nat_un;
u_short nat_oport;
u_short nat_use;
u_char nat_p;
int nat_dir;
int nat_ref;
int nat_hv[2];
char nat_ifnames[2][LIFNAMSIZ];
int nat_rev;
int nat_redir;
u_32_t nat_seqnext[2];
} nat_4_1_25_t;
typedef struct nat_4_1_14 {
ipfmutex_t nat_lock;
struct nat *nat_next;
struct nat **nat_pnext;
struct nat *nat_hnext[2];
struct nat **nat_phnext[2];
struct hostmap *nat_hm;
void *nat_data;
struct nat **nat_me;
struct ipstate *nat_state;
struct ap_session *nat_aps;
frentry_t *nat_fr;
struct ipnat *nat_ptr;
void *nat_ifps[2];
void *nat_sync;
ipftqent_t nat_tqe;
u_32_t nat_flags;
u_32_t nat_sumd[2];
u_32_t nat_ipsumd;
u_32_t nat_mssclamp;
i6addr_t nat_inip6;
i6addr_t nat_outip6;
i6addr_t nat_oip6;
U_QUAD_T nat_pkts[2];
U_QUAD_T nat_bytes[2];
union {
udpinfo_t nat_unu;
tcpinfo4_t nat_unt;
icmpinfo_t nat_uni;
greinfo_t nat_ugre;
} nat_un;
u_short nat_oport;
u_short nat_use;
u_char nat_p;
int nat_dir;
int nat_ref;
int nat_hv[2];
char nat_ifnames[2][LIFNAMSIZ];
int nat_rev;
int nat_redir;
} nat_4_1_14_t;
typedef struct nat_4_1_3 {
ipfmutex_t nat_lock;
struct nat *nat_next;
struct nat **nat_pnext;
struct nat *nat_hnext[2];
struct nat **nat_phnext[2];
struct hostmap *nat_hm;
void *nat_data;
struct nat **nat_me;
struct ipstate *nat_state;
struct ap_session *nat_aps;
frentry_t *nat_fr;
struct ipnat *nat_ptr;
void *nat_ifps[2];
void *nat_sync;
ipftqent_t nat_tqe;
u_32_t nat_flags;
u_32_t nat_sumd[2];
u_32_t nat_ipsumd;
u_32_t nat_mssclamp;
i6addr_t nat_inip6;
i6addr_t nat_outip6;
i6addr_t nat_oip6;
U_QUAD_T nat_pkts[2];
U_QUAD_T nat_bytes[2];
union {
udpinfo_t nat_unu;
tcpinfo4_t nat_unt;
icmpinfo_t nat_uni;
greinfo_t nat_ugre;
} nat_un;
u_short nat_oport;
u_short nat_use;
u_char nat_p;
int nat_dir;
int nat_ref;
int nat_hv[2];
char nat_ifnames[2][LIFNAMSIZ];
int nat_rev;
} nat_4_1_3_t;
typedef struct nat_save_4_1_34 {
void *ipn_next;
struct nat_4_1_25 ipn_nat;
struct ipnat_4_1_14 ipn_ipnat;
struct frentry_4_1_34 ipn_fr;
int ipn_dsize;
char ipn_data[4];
} nat_save_4_1_34_t;
typedef struct nat_save_4_1_16 {
void *ipn_next;
nat_4_1_14_t ipn_nat;
ipnat_t ipn_ipnat;
frentry_4_1_16_t ipn_fr;
int ipn_dsize;
char ipn_data[4];
} nat_save_4_1_16_t;
typedef struct nat_save_4_1_14 {
void *ipn_next;
nat_4_1_14_t ipn_nat;
ipnat_t ipn_ipnat;
frentry_4_1_0_t ipn_fr;
int ipn_dsize;
char ipn_data[4];
} nat_save_4_1_14_t;
typedef struct nat_save_4_1_3 {
void *ipn_next;
nat_4_1_3_t ipn_nat;
ipnat_4_1_0_t ipn_ipnat;
frentry_4_1_0_t ipn_fr;
int ipn_dsize;
char ipn_data[4];
} nat_save_4_1_3_t;
/* ------------------------------------------------------------------------ */
/*
* 5.1.0 new release (current)
* 4.1.32 added ns_uncreate
* 4.1.27 added ns_orphans
* 4.1.16 added ns_ticks
*/
typedef struct natstat_4_1_32 {
u_long ns_mapped[2];
u_long ns_rules;
u_long ns_added;
u_long ns_expire;
u_long ns_inuse;
u_long ns_logged;
u_long ns_logfail;
u_long ns_memfail;
u_long ns_badnat;
u_long ns_addtrpnt;
nat_t **ns_table[2];
hostmap_t **ns_maptable;
ipnat_t *ns_list;
void *ns_apslist;
u_int ns_wilds;
u_int ns_nattab_sz;
u_int ns_nattab_max;
u_int ns_rultab_sz;
u_int ns_rdrtab_sz;
u_int ns_trpntab_sz;
u_int ns_hostmap_sz;
nat_t *ns_instances;
hostmap_t *ns_maplist;
u_long *ns_bucketlen[2];
u_long ns_ticks;
u_int ns_orphans;
u_long ns_uncreate[2][2];
} natstat_4_1_32_t;
typedef struct natstat_4_1_27 {
u_long ns_mapped[2];
u_long ns_rules;
u_long ns_added;
u_long ns_expire;
u_long ns_inuse;
u_long ns_logged;
u_long ns_logfail;
u_long ns_memfail;
u_long ns_badnat;
u_long ns_addtrpnt;
nat_t **ns_table[2];
hostmap_t **ns_maptable;
ipnat_t *ns_list;
void *ns_apslist;
u_int ns_wilds;
u_int ns_nattab_sz;
u_int ns_nattab_max;
u_int ns_rultab_sz;
u_int ns_rdrtab_sz;
u_int ns_trpntab_sz;
u_int ns_hostmap_sz;
nat_t *ns_instances;
hostmap_t *ns_maplist;
u_long *ns_bucketlen[2];
u_long ns_ticks;
u_int ns_orphans;
} natstat_4_1_27_t;
typedef struct natstat_4_1_16 {
u_long ns_mapped[2];
u_long ns_rules;
u_long ns_added;
u_long ns_expire;
u_long ns_inuse;
u_long ns_logged;
u_long ns_logfail;
u_long ns_memfail;
u_long ns_badnat;
u_long ns_addtrpnt;
nat_t **ns_table[2];
hostmap_t **ns_maptable;
ipnat_t *ns_list;
void *ns_apslist;
u_int ns_wilds;
u_int ns_nattab_sz;
u_int ns_nattab_max;
u_int ns_rultab_sz;
u_int ns_rdrtab_sz;
u_int ns_trpntab_sz;
u_int ns_hostmap_sz;
nat_t *ns_instances;
hostmap_t *ns_maplist;
u_long *ns_bucketlen[2];
u_long ns_ticks;
} natstat_4_1_16_t;
typedef struct natstat_4_1_0 {
u_long ns_mapped[2];
u_long ns_rules;
u_long ns_added;
u_long ns_expire;
u_long ns_inuse;
u_long ns_logged;
u_long ns_logfail;
u_long ns_memfail;
u_long ns_badnat;
u_long ns_addtrpnt;
nat_t **ns_table[2];
hostmap_t **ns_maptable;
ipnat_t *ns_list;
void *ns_apslist;
u_int ns_wilds;
u_int ns_nattab_sz;
u_int ns_nattab_max;
u_int ns_rultab_sz;
u_int ns_rdrtab_sz;
u_int ns_trpntab_sz;
u_int ns_hostmap_sz;
nat_t *ns_instances;
hostmap_t *ns_maplist;
u_long *ns_bucketlen[2];
} natstat_4_1_0_t;
/* ------------------------------------------------------------------------ */
/*
* 5.1.0 new release (current)
* 4.1.32 fra_info:removed both fin_state & fin_nat, added fin_pktnum
* 4.1.29 added fra_flx
* 4.1.24 fra_info:added fin_cksum
* 4.1.23 fra_info:added fin_exthdr
* 4.1.11 fra_info:added fin_ifname
* 4.1.4 fra_info:added fin_hbuf
*/
typedef struct frauth_4_1_32 {
int fra_age;
int fra_len;
int fra_index;
u_32_t fra_pass;
fr_info_4_1_32_t fra_info;
char *fra_buf;
u_32_t fra_flx;
#ifdef MENTAT
queue_t *fra_q;
mb_t *fra_m;
#endif
} frauth_4_1_32_t;
typedef struct frauth_4_1_29 {
int fra_age;
int fra_len;
int fra_index;
u_32_t fra_pass;
fr_info_4_1_24_t fra_info;
char *fra_buf;
u_32_t fra_flx;
#ifdef MENTAT
queue_t *fra_q;
mb_t *fra_m;
#endif
} frauth_4_1_29_t;
typedef struct frauth_4_1_24 {
int fra_age;
int fra_len;
int fra_index;
u_32_t fra_pass;
fr_info_4_1_24_t fra_info;
char *fra_buf;
#ifdef MENTAT
queue_t *fra_q;
mb_t *fra_m;
#endif
} frauth_4_1_24_t;
typedef struct frauth_4_1_23 {
int fra_age;
int fra_len;
int fra_index;
u_32_t fra_pass;
fr_info_4_1_23_t fra_info;
char *fra_buf;
#ifdef MENTAT
queue_t *fra_q;
mb_t *fra_m;