ip_nat.h revision 1.6 1 1.6 christos /* $NetBSD: ip_nat.h,v 1.6 2013/01/09 13:23:20 christos Exp $ */
2 1.1 christos
3 1.1 christos /*
4 1.3 darrenr * Copyright (C) 2012 by Darren Reed.
5 1.1 christos *
6 1.1 christos * See the IPFILTER.LICENCE file for details on licencing.
7 1.1 christos *
8 1.1 christos * @(#)ip_nat.h 1.5 2/4/96
9 1.3 darrenr * Id: ip_nat.h,v 1.1.1.2 2012/07/22 13:45:29 darrenr Exp
10 1.1 christos */
11 1.1 christos
12 1.1 christos #ifndef __IP_NAT_H__
13 1.1 christos #define __IP_NAT_H__
14 1.1 christos
15 1.4 plunky #ifndef SOLARIS
16 1.4 plunky # if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
17 1.4 plunky # define SOLARIS 1
18 1.4 plunky # else
19 1.4 plunky # define SOLARIS 0
20 1.4 plunky # endif
21 1.1 christos #endif
22 1.1 christos
23 1.1 christos #if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)
24 1.1 christos #define SIOCADNAT _IOW('r', 60, struct ipfobj)
25 1.1 christos #define SIOCRMNAT _IOW('r', 61, struct ipfobj)
26 1.1 christos #define SIOCGNATS _IOWR('r', 62, struct ipfobj)
27 1.1 christos #define SIOCGNATL _IOWR('r', 63, struct ipfobj)
28 1.3 darrenr #define SIOCPURGENAT _IOWR('r', 100, struct ipfobj)
29 1.1 christos #else
30 1.1 christos #define SIOCADNAT _IOW(r, 60, struct ipfobj)
31 1.1 christos #define SIOCRMNAT _IOW(r, 61, struct ipfobj)
32 1.1 christos #define SIOCGNATS _IOWR(r, 62, struct ipfobj)
33 1.1 christos #define SIOCGNATL _IOWR(r, 63, struct ipfobj)
34 1.3 darrenr #define SIOCPURGENAT _IOWR(r, 100, struct ipfobj)
35 1.1 christos #endif
36 1.1 christos
37 1.1 christos #undef LARGE_NAT /* define this if you're setting up a system to NAT
38 1.1 christos * LARGE numbers of networks/hosts - i.e. in the
39 1.1 christos * hundreds or thousands. In such a case, you should
40 1.1 christos * also change the RDR_SIZE and NAT_SIZE below to more
41 1.1 christos * appropriate sizes. The figures below were used for
42 1.1 christos * a setup with 1000-2000 networks to NAT.
43 1.1 christos */
44 1.1 christos #ifndef NAT_SIZE
45 1.1 christos # ifdef LARGE_NAT
46 1.1 christos # define NAT_SIZE 2047
47 1.1 christos # else
48 1.1 christos # define NAT_SIZE 127
49 1.1 christos # endif
50 1.1 christos #endif
51 1.1 christos #ifndef RDR_SIZE
52 1.1 christos # ifdef LARGE_NAT
53 1.1 christos # define RDR_SIZE 2047
54 1.1 christos # else
55 1.1 christos # define RDR_SIZE 127
56 1.1 christos # endif
57 1.1 christos #endif
58 1.1 christos #ifndef HOSTMAP_SIZE
59 1.1 christos # ifdef LARGE_NAT
60 1.1 christos # define HOSTMAP_SIZE 8191
61 1.1 christos # else
62 1.1 christos # define HOSTMAP_SIZE 2047
63 1.1 christos # endif
64 1.1 christos #endif
65 1.1 christos #ifndef NAT_TABLE_MAX
66 1.1 christos /*
67 1.1 christos * This is newly introduced and for the sake of "least surprise", the numbers
68 1.1 christos * present aren't what we'd normally use for creating a proper hash table.
69 1.1 christos */
70 1.1 christos # ifdef LARGE_NAT
71 1.1 christos # define NAT_TABLE_MAX 180000
72 1.1 christos # else
73 1.1 christos # define NAT_TABLE_MAX 30000
74 1.1 christos # endif
75 1.1 christos #endif
76 1.1 christos #ifndef NAT_TABLE_SZ
77 1.1 christos # ifdef LARGE_NAT
78 1.1 christos # define NAT_TABLE_SZ 16383
79 1.1 christos # else
80 1.1 christos # define NAT_TABLE_SZ 2047
81 1.1 christos # endif
82 1.1 christos #endif
83 1.1 christos #ifndef APR_LABELLEN
84 1.1 christos #define APR_LABELLEN 16
85 1.1 christos #endif
86 1.3 darrenr #define NAT_HW_CKSUM 0x80000000
87 1.3 darrenr #define NAT_HW_CKSUM_PART 0x40000000
88 1.1 christos
89 1.1 christos #define DEF_NAT_AGE 1200 /* 10 minutes (600 seconds) */
90 1.1 christos
91 1.1 christos struct ipstate;
92 1.1 christos struct ap_session;
93 1.1 christos
94 1.1 christos /*
95 1.1 christos * This structure is used in the active NAT table and represents an
96 1.1 christos * active NAT session.
97 1.6 christos *
98 1.6 christos * Generally nat_t structures have references from at least two places.
99 1.6 christos * The first place gives them a position in a linked list of NAT sessions
100 1.6 christos * per instace of IPFilter. In this linked list, nat_next always points to
101 1.6 christos * the next entry in the list and nat_pnext points to the pointer that
102 1.6 christos * introduces the structure. That may be either the top of the list pointer
103 1.6 christos * or simply the nat_next of the previous link in the list. The second place
104 1.6 christos * that a nat_t structure is generally referenced from is the NAT hash table.
105 1.6 christos * Two references from this table are required, one for supporting the of
106 1.6 christos * matching packets being transmitted and one for supporting the matching of
107 1.6 christos * packets being received. The hash table is comprised of buckets, each one
108 1.6 christos * having its own chain of nat_t structures. To support these chains,
109 1.6 christos * nat_hnext is used to point to the next member of the chain and nat_phnext
110 1.6 christos * points back to the pointer that is pointing to the nat_t in the chain,
111 1.6 christos * be it the bucket at the top or simply the previous nat_t chain entry.
112 1.1 christos */
113 1.1 christos typedef struct nat {
114 1.1 christos ipfmutex_t nat_lock;
115 1.6 christos struct nat *nat_next;
116 1.6 christos struct nat **nat_pnext;
117 1.6 christos struct nat *nat_hnext[2];
118 1.6 christos struct nat **nat_phnext[2];
119 1.1 christos struct hostmap *nat_hm;
120 1.1 christos void *nat_data;
121 1.1 christos struct nat **nat_me;
122 1.1 christos struct ipstate *nat_state;
123 1.1 christos struct ap_session *nat_aps; /* proxy session */
124 1.1 christos frentry_t *nat_fr; /* filter rule ptr if appropriate */
125 1.1 christos struct ipnat *nat_ptr; /* pointer back to the rule */
126 1.1 christos void *nat_ifps[2];
127 1.1 christos void *nat_sync;
128 1.1 christos ipftqent_t nat_tqe;
129 1.1 christos int nat_mtu[2];
130 1.1 christos u_32_t nat_flags;
131 1.1 christos u_32_t nat_sumd[2]; /* ip checksum delta for data segment*/
132 1.1 christos u_32_t nat_ipsumd; /* ip checksum delta for ip header */
133 1.1 christos u_32_t nat_mssclamp; /* if != zero clamp MSS to this */
134 1.1 christos i6addr_t nat_odst6;
135 1.1 christos i6addr_t nat_osrc6;
136 1.1 christos i6addr_t nat_ndst6;
137 1.1 christos i6addr_t nat_nsrc6;
138 1.1 christos U_QUAD_T nat_pkts[2];
139 1.1 christos U_QUAD_T nat_bytes[2];
140 1.1 christos union {
141 1.1 christos udpinfo_t nat_unu;
142 1.1 christos tcpinfo_t nat_unt;
143 1.1 christos icmpinfo_t nat_uni;
144 1.1 christos greinfo_t nat_ugre;
145 1.1 christos } nat_unold, nat_unnew;
146 1.1 christos int nat_use;
147 1.1 christos int nat_pr[2]; /* protocol for NAT */
148 1.1 christos int nat_dir;
149 1.1 christos int nat_ref; /* reference count */
150 1.1 christos u_int nat_hv[2];
151 1.1 christos char nat_ifnames[2][LIFNAMSIZ];
152 1.1 christos int nat_rev; /* 0 = forward, 1 = reverse */
153 1.1 christos int nat_dlocal;
154 1.1 christos int nat_v[2]; /* 0 = old, 1 = new */
155 1.1 christos u_int nat_redir; /* copy of in_redir */
156 1.1 christos } nat_t;
157 1.1 christos
158 1.1 christos #define nat_osrcip nat_osrc6.in4
159 1.1 christos #define nat_odstip nat_odst6.in4
160 1.1 christos #define nat_nsrcip nat_nsrc6.in4
161 1.1 christos #define nat_ndstip nat_ndst6.in4
162 1.1 christos #define nat_osrcaddr nat_osrc6.in4.s_addr
163 1.1 christos #define nat_odstaddr nat_odst6.in4.s_addr
164 1.1 christos #define nat_nsrcaddr nat_nsrc6.in4.s_addr
165 1.1 christos #define nat_ndstaddr nat_ndst6.in4.s_addr
166 1.1 christos #define nat_age nat_tqe.tqe_die
167 1.1 christos #define nat_osport nat_unold.nat_unt.ts_sport
168 1.1 christos #define nat_odport nat_unold.nat_unt.ts_dport
169 1.1 christos #define nat_nsport nat_unnew.nat_unt.ts_sport
170 1.1 christos #define nat_ndport nat_unnew.nat_unt.ts_dport
171 1.1 christos #define nat_oicmpid nat_unold.nat_uni.ici_id
172 1.1 christos #define nat_nicmpid nat_unnew.nat_uni.ici_id
173 1.1 christos #define nat_type nat_unold.nat_uni.ici_type
174 1.1 christos #define nat_oseq nat_unold.nat_uni.ici_seq
175 1.1 christos #define nat_nseq nat_unnew.nat_uni.ici_seq
176 1.1 christos #define nat_tcpstate nat_tqe.tqe_state
177 1.1 christos #define nat_die nat_tqe.tqe_die
178 1.1 christos #define nat_touched nat_tqe.tqe_touched
179 1.1 christos
180 1.1 christos /*
181 1.1 christos * Values for nat_dir
182 1.1 christos */
183 1.1 christos #define NAT_INBOUND 0
184 1.1 christos #define NAT_OUTBOUND 1
185 1.1 christos #define NAT_ENCAPIN 2
186 1.1 christos #define NAT_ENCAPOUT 3
187 1.1 christos #define NAT_DIVERTIN 4
188 1.1 christos #define NAT_DIVERTOUT 5
189 1.1 christos
190 1.1 christos /*
191 1.1 christos * Definitions for nat_flags
192 1.1 christos */
193 1.1 christos #define NAT_TCP 0x0001 /* IPN_TCP */
194 1.1 christos #define NAT_UDP 0x0002 /* IPN_UDP */
195 1.1 christos #define NAT_ICMPERR 0x0004 /* IPN_ICMPERR */
196 1.1 christos #define NAT_ICMPQUERY 0x0008 /* IPN_ICMPQUERY */
197 1.1 christos #define NAT_SEARCH 0x0010
198 1.1 christos #define NAT_SLAVE 0x0020 /* Slave connection for a proxy */
199 1.1 christos #define NAT_NOTRULEPORT 0x0040 /* Don't use the port # in the NAT rule */
200 1.1 christos
201 1.1 christos #define NAT_TCPUDP (NAT_TCP|NAT_UDP)
202 1.1 christos #define NAT_TCPUDPICMP (NAT_TCP|NAT_UDP|NAT_ICMPERR)
203 1.1 christos #define NAT_TCPUDPICMPQ (NAT_TCP|NAT_UDP|NAT_ICMPQUERY)
204 1.1 christos #define NAT_FROMRULE (NAT_TCP|NAT_UDP)
205 1.1 christos
206 1.1 christos /* 0x0100 reserved for FI_W_SPORT */
207 1.1 christos /* 0x0200 reserved for FI_W_DPORT */
208 1.1 christos /* 0x0400 reserved for FI_W_SADDR */
209 1.1 christos /* 0x0800 reserved for FI_W_DADDR */
210 1.1 christos /* 0x1000 reserved for FI_W_NEWFR */
211 1.1 christos /* 0x2000 reserved for SI_CLONE */
212 1.1 christos /* 0x4000 reserved for SI_CLONED */
213 1.1 christos /* 0x8000 reserved for SI_IGNOREPKT */
214 1.1 christos
215 1.1 christos #define NAT_DEBUG 0x800000
216 1.1 christos
217 1.1 christos typedef struct nat_addr_s {
218 1.1 christos i6addr_t na_addr[2];
219 1.1 christos i6addr_t na_nextaddr;
220 1.1 christos int na_atype;
221 1.1 christos int na_function;
222 1.1 christos } nat_addr_t;
223 1.1 christos
224 1.1 christos #define na_nextip na_nextaddr.in4.s_addr
225 1.1 christos #define na_nextip6 na_nextaddr.in6
226 1.1 christos #define na_num na_addr[0].iplookupnum
227 1.1 christos #define na_type na_addr[0].iplookuptype
228 1.1 christos #define na_subtype na_addr[0].iplookupsubtype
229 1.1 christos #define na_ptr na_addr[1].iplookupptr
230 1.1 christos #define na_func na_addr[1].iplookupfunc
231 1.1 christos
232 1.1 christos
233 1.1 christos /*
234 1.1 christos * This structure represents an actual NAT rule, loaded by ipnat.
235 1.1 christos */
236 1.1 christos typedef struct ipnat {
237 1.1 christos ipfmutex_t in_lock;
238 1.1 christos struct ipnat *in_next; /* NAT rule list next */
239 1.1 christos struct ipnat **in_pnext; /* prior rdr next ptr */
240 1.1 christos struct ipnat *in_rnext; /* rdr rule hash next */
241 1.1 christos struct ipnat **in_prnext; /* prior rdr next ptr */
242 1.1 christos struct ipnat *in_mnext; /* map rule hash next */
243 1.1 christos struct ipnat **in_pmnext; /* prior map next ptr */
244 1.1 christos struct ipftq *in_tqehead[2];
245 1.1 christos void *in_ifps[2];
246 1.1 christos void *in_apr;
247 1.1 christos char *in_comment;
248 1.1 christos mb_t *in_divmp;
249 1.1 christos void *in_pconf;
250 1.3 darrenr U_QUAD_T in_pkts[2];
251 1.3 darrenr U_QUAD_T in_bytes[2];
252 1.1 christos u_long in_space;
253 1.1 christos u_long in_hits;
254 1.1 christos int in_size;
255 1.3 darrenr int in_use;
256 1.1 christos u_int in_hv[2];
257 1.1 christos int in_flineno; /* conf. file line number */
258 1.1 christos int in_stepnext;
259 1.1 christos int in_dlocal;
260 1.1 christos u_short in_dpnext;
261 1.1 christos u_short in_spnext;
262 1.1 christos /* From here to the end is covered by IPN_CMPSIZ */
263 1.1 christos u_char in_v[2]; /* 0 = old, 1 = new */
264 1.1 christos u_32_t in_flags;
265 1.1 christos u_32_t in_mssclamp; /* if != 0 clamp MSS to this */
266 1.1 christos u_int in_age[2];
267 1.1 christos int in_redir; /* see below for values */
268 1.1 christos int in_pr[2]; /* protocol. */
269 1.1 christos nat_addr_t in_ndst;
270 1.1 christos nat_addr_t in_nsrc;
271 1.1 christos nat_addr_t in_osrc;
272 1.1 christos nat_addr_t in_odst;
273 1.1 christos frtuc_t in_tuc;
274 1.1 christos u_short in_ppip; /* ports per IP. */
275 1.1 christos u_short in_ippip; /* IP #'s per IP# */
276 1.1 christos u_short in_ndports[2];
277 1.1 christos u_short in_nsports[2];
278 1.1 christos int in_ifnames[2];
279 1.1 christos int in_plabel; /* proxy label. */
280 1.1 christos int in_pconfig; /* proxy label. */
281 1.1 christos ipftag_t in_tag;
282 1.1 christos int in_namelen;
283 1.1 christos char in_names[1];
284 1.1 christos } ipnat_t;
285 1.1 christos
286 1.1 christos /*
287 1.1 christos * MAP-IN MAP-OUT RDR-IN RDR-OUT
288 1.1 christos * osrc X == src == src X
289 1.1 christos * odst X == dst == dst X
290 1.1 christos * nsrc == dst X X == dst
291 1.1 christos * ndst == src X X == src
292 1.1 christos */
293 1.1 christos #define in_dpmin in_ndports[0] /* Also holds static redir port */
294 1.1 christos #define in_dpmax in_ndports[1]
295 1.1 christos #define in_spmin in_nsports[0] /* Also holds static redir port */
296 1.1 christos #define in_spmax in_nsports[1]
297 1.1 christos #define in_ndport in_ndports[0]
298 1.1 christos #define in_nsport in_nsports[0]
299 1.1 christos #define in_dipnext in_ndst.na_nextaddr.in4
300 1.1 christos #define in_dipnext6 in_ndst.na_nextaddr
301 1.1 christos #define in_dnip in_ndst.na_nextaddr.in4.s_addr
302 1.1 christos #define in_dnip6 in_ndst.na_nextaddr
303 1.1 christos #define in_sipnext in_nsrc.na_nextaddr.in4
304 1.1 christos #define in_snip in_nsrc.na_nextaddr.in4.s_addr
305 1.1 christos #define in_snip6 in_nsrc.na_nextaddr
306 1.1 christos #define in_odstip in_odst.na_addr[0].in4
307 1.1 christos #define in_odstip6 in_odst.na_addr[0]
308 1.1 christos #define in_odstaddr in_odst.na_addr[0].in4.s_addr
309 1.1 christos #define in_odstmsk in_odst.na_addr[1].in4.s_addr
310 1.1 christos #define in_odstmsk6 in_odst.na_addr[1]
311 1.1 christos #define in_odstatype in_odst.na_atype
312 1.1 christos #define in_osrcip in_osrc.na_addr[0].in4
313 1.1 christos #define in_osrcip6 in_osrc.na_addr[0]
314 1.1 christos #define in_osrcaddr in_osrc.na_addr[0].in4.s_addr
315 1.1 christos #define in_osrcmsk in_osrc.na_addr[1].in4.s_addr
316 1.1 christos #define in_osrcmsk6 in_osrc.na_addr[1]
317 1.1 christos #define in_osrcatype in_osrc.na_atype
318 1.1 christos #define in_ndstip in_ndst.na_addr[0].in4
319 1.1 christos #define in_ndstip6 in_ndst.na_addr[0]
320 1.1 christos #define in_ndstaddr in_ndst.na_addr[0].in4.s_addr
321 1.1 christos #define in_ndstmsk in_ndst.na_addr[1].in4.s_addr
322 1.1 christos #define in_ndstmsk6 in_ndst.na_addr[1]
323 1.1 christos #define in_ndstatype in_ndst.na_atype
324 1.1 christos #define in_ndstafunc in_ndst.na_function
325 1.1 christos #define in_nsrcip in_nsrc.na_addr[0].in4
326 1.1 christos #define in_nsrcip6 in_nsrc.na_addr[0]
327 1.1 christos #define in_nsrcaddr in_nsrc.na_addr[0].in4.s_addr
328 1.1 christos #define in_nsrcmsk in_nsrc.na_addr[1].in4.s_addr
329 1.1 christos #define in_nsrcmsk6 in_nsrc.na_addr[1]
330 1.1 christos #define in_nsrcatype in_nsrc.na_atype
331 1.1 christos #define in_nsrcafunc in_nsrc.na_function
332 1.1 christos #define in_scmp in_tuc.ftu_scmp
333 1.1 christos #define in_dcmp in_tuc.ftu_dcmp
334 1.1 christos #define in_stop in_tuc.ftu_stop
335 1.1 christos #define in_dtop in_tuc.ftu_dtop
336 1.1 christos #define in_osport in_tuc.ftu_sport
337 1.1 christos #define in_odport in_tuc.ftu_dport
338 1.1 christos #define in_ndstnum in_ndst.na_addr[0].iplookupnum
339 1.1 christos #define in_ndsttype in_ndst.na_addr[0].iplookuptype
340 1.1 christos #define in_ndstptr in_ndst.na_addr[1].iplookupptr
341 1.1 christos #define in_ndstfunc in_ndst.na_addr[1].iplookupfunc
342 1.1 christos #define in_nsrcnum in_nsrc.na_addr[0].iplookupnum
343 1.1 christos #define in_nsrctype in_nsrc.na_addr[0].iplookuptype
344 1.1 christos #define in_nsrcptr in_nsrc.na_addr[1].iplookupptr
345 1.1 christos #define in_nsrcfunc in_nsrc.na_addr[1].iplookupfunc
346 1.1 christos #define in_odstnum in_odst.na_addr[0].iplookupnum
347 1.1 christos #define in_odsttype in_odst.na_addr[0].iplookuptype
348 1.1 christos #define in_odstptr in_odst.na_addr[1].iplookupptr
349 1.1 christos #define in_odstfunc in_odst.na_addr[1].iplookupfunc
350 1.1 christos #define in_osrcnum in_osrc.na_addr[0].iplookupnum
351 1.1 christos #define in_osrctype in_osrc.na_addr[0].iplookuptype
352 1.1 christos #define in_osrcptr in_osrc.na_addr[1].iplookupptr
353 1.1 christos #define in_osrcfunc in_osrc.na_addr[1].iplookupfunc
354 1.1 christos #define in_icmpidmin in_nsports[0]
355 1.1 christos #define in_icmpidmax in_nsports[1]
356 1.1 christos
357 1.1 christos /*
358 1.1 christos * Bit definitions for in_flags
359 1.1 christos */
360 1.1 christos #define IPN_ANY 0x00000
361 1.1 christos #define IPN_TCP 0x00001
362 1.1 christos #define IPN_UDP 0x00002
363 1.1 christos #define IPN_TCPUDP (IPN_TCP|IPN_UDP)
364 1.1 christos #define IPN_ICMPERR 0x00004
365 1.1 christos #define IPN_TCPUDPICMP (IPN_TCP|IPN_UDP|IPN_ICMPERR)
366 1.1 christos #define IPN_ICMPQUERY 0x00008
367 1.1 christos #define IPN_TCPUDPICMPQ (IPN_TCP|IPN_UDP|IPN_ICMPQUERY)
368 1.1 christos #define IPN_RF (IPN_TCPUDP|IPN_DELETE|IPN_ICMPERR)
369 1.1 christos #define IPN_AUTOPORTMAP 0x00010
370 1.1 christos #define IPN_FILTER 0x00020
371 1.1 christos #define IPN_SPLIT 0x00040
372 1.1 christos #define IPN_ROUNDR 0x00080
373 1.1 christos #define IPN_SIPRANGE 0x00100
374 1.1 christos #define IPN_DIPRANGE 0x00200
375 1.1 christos #define IPN_NOTSRC 0x00400
376 1.1 christos #define IPN_NOTDST 0x00800
377 1.1 christos #define IPN_NO 0x01000
378 1.1 christos #define IPN_DYNSRCIP 0x02000 /* dynamic src IP# */
379 1.1 christos #define IPN_DYNDSTIP 0x04000 /* dynamic dst IP# */
380 1.1 christos #define IPN_DELETE 0x08000
381 1.1 christos #define IPN_STICKY 0x10000
382 1.1 christos #define IPN_FRAG 0x20000
383 1.1 christos #define IPN_FIXEDSPORT 0x40000
384 1.1 christos #define IPN_FIXEDDPORT 0x80000
385 1.1 christos #define IPN_FINDFORWARD 0x100000
386 1.1 christos #define IPN_IN 0x200000
387 1.1 christos #define IPN_SEQUENTIAL 0x400000
388 1.3 darrenr #define IPN_PURGE 0x800000
389 1.3 darrenr #define IPN_PROXYRULE 0x1000000
390 1.1 christos #define IPN_USERFLAGS (IPN_TCPUDP|IPN_AUTOPORTMAP|IPN_SIPRANGE|IPN_SPLIT|\
391 1.1 christos IPN_ROUNDR|IPN_FILTER|IPN_NOTSRC|IPN_NOTDST|IPN_NO|\
392 1.1 christos IPN_FRAG|IPN_STICKY|IPN_FIXEDDPORT|IPN_ICMPQUERY|\
393 1.3 darrenr IPN_DIPRANGE|IPN_SEQUENTIAL|IPN_PURGE)
394 1.1 christos
395 1.1 christos /*
396 1.1 christos * Values for in_redir
397 1.1 christos */
398 1.1 christos #define NAT_MAP 0x01
399 1.1 christos #define NAT_REDIRECT 0x02
400 1.1 christos #define NAT_BIMAP (NAT_MAP|NAT_REDIRECT)
401 1.1 christos #define NAT_MAPBLK 0x04
402 1.1 christos #define NAT_REWRITE 0x08
403 1.1 christos #define NAT_ENCAP 0x10
404 1.1 christos #define NAT_DIVERTUDP 0x20
405 1.1 christos
406 1.1 christos #define MAPBLK_MINPORT 1024 /* don't use reserved ports for src port */
407 1.1 christos #define USABLE_PORTS (65536 - MAPBLK_MINPORT)
408 1.1 christos
409 1.1 christos #define IPN_CMPSIZ (sizeof(ipnat_t) - offsetof(ipnat_t, in_v))
410 1.1 christos
411 1.1 christos typedef struct natlookup {
412 1.1 christos i6addr_t nl_inipaddr;
413 1.1 christos i6addr_t nl_outipaddr;
414 1.1 christos i6addr_t nl_realipaddr;
415 1.1 christos int nl_v;
416 1.1 christos int nl_flags;
417 1.1 christos u_short nl_inport;
418 1.1 christos u_short nl_outport;
419 1.1 christos u_short nl_realport;
420 1.1 christos } natlookup_t;
421 1.1 christos
422 1.1 christos #define nl_inip nl_inipaddr.in4
423 1.1 christos #define nl_outip nl_outipaddr.in4
424 1.1 christos #define nl_realip nl_realipaddr.in4
425 1.1 christos #define nl_inip6 nl_inipaddr.in6
426 1.1 christos #define nl_outip6 nl_outipaddr.in6
427 1.1 christos #define nl_realip6 nl_realipaddr.in6
428 1.1 christos
429 1.1 christos
430 1.1 christos typedef struct nat_save {
431 1.1 christos void *ipn_next;
432 1.1 christos struct nat ipn_nat;
433 1.1 christos struct ipnat ipn_ipnat;
434 1.1 christos struct frentry ipn_fr;
435 1.1 christos int ipn_dsize;
436 1.1 christos char ipn_data[4];
437 1.1 christos } nat_save_t;
438 1.1 christos
439 1.1 christos #define ipn_rule ipn_nat.nat_fr
440 1.1 christos
441 1.1 christos typedef struct natget {
442 1.1 christos void *ng_ptr;
443 1.1 christos int ng_sz;
444 1.1 christos } natget_t;
445 1.1 christos
446 1.1 christos
447 1.1 christos /*
448 1.1 christos * This structure gets used to help NAT sessions keep the same NAT rule (and
449 1.1 christos * thus translation for IP address) when:
450 1.1 christos * (a) round-robin redirects are in use
451 1.1 christos * (b) different IP add
452 1.1 christos */
453 1.1 christos typedef struct hostmap {
454 1.1 christos struct hostmap *hm_hnext;
455 1.1 christos struct hostmap **hm_phnext;
456 1.1 christos struct hostmap *hm_next;
457 1.1 christos struct hostmap **hm_pnext;
458 1.1 christos struct ipnat *hm_ipnat;
459 1.1 christos i6addr_t hm_osrcip6;
460 1.1 christos i6addr_t hm_odstip6;
461 1.1 christos i6addr_t hm_nsrcip6;
462 1.1 christos i6addr_t hm_ndstip6;
463 1.1 christos u_32_t hm_port;
464 1.1 christos int hm_ref;
465 1.1 christos int hm_hv;
466 1.1 christos int hm_v;
467 1.1 christos } hostmap_t;
468 1.1 christos
469 1.1 christos #define hm_osrcip hm_osrcip6.in4
470 1.1 christos #define hm_odstip hm_odstip6.in4
471 1.1 christos #define hm_nsrcip hm_nsrcip6.in4
472 1.1 christos #define hm_ndstip hm_ndstip6.in4
473 1.1 christos #define hm_osrc6 hm_osrcip6.in6
474 1.1 christos #define hm_odst6 hm_odstip6.in6
475 1.1 christos #define hm_nsrc6 hm_nsrcip6.in6
476 1.1 christos #define hm_ndst6 hm_ndstip6.in6
477 1.1 christos
478 1.1 christos
479 1.1 christos /*
480 1.1 christos * Structure used to pass information in to nat_newmap and nat_newrdr.
481 1.1 christos */
482 1.1 christos typedef struct natinfo {
483 1.1 christos ipnat_t *nai_np;
484 1.1 christos u_32_t nai_sum1;
485 1.1 christos u_32_t nai_sum2;
486 1.1 christos struct in_addr nai_ip; /* In host byte order */
487 1.1 christos u_short nai_port;
488 1.1 christos u_short nai_nport;
489 1.1 christos u_short nai_sport;
490 1.1 christos u_short nai_dport;
491 1.1 christos } natinfo_t;
492 1.1 christos
493 1.1 christos
494 1.1 christos typedef struct nat_stat_side {
495 1.1 christos u_int *ns_bucketlen;
496 1.1 christos nat_t **ns_table;
497 1.1 christos u_long ns_added;
498 1.1 christos u_long ns_appr_fail;
499 1.1 christos u_long ns_badnat;
500 1.1 christos u_long ns_badnatnew;
501 1.1 christos u_long ns_badnextaddr;
502 1.1 christos u_long ns_bucket_max;
503 1.1 christos u_long ns_clone_nomem;
504 1.1 christos u_long ns_decap_bad;
505 1.1 christos u_long ns_decap_fail;
506 1.1 christos u_long ns_decap_pullup;
507 1.1 christos u_long ns_divert_dup;
508 1.1 christos u_long ns_divert_exist;
509 1.1 christos u_long ns_drop;
510 1.1 christos u_long ns_encap_dup;
511 1.1 christos u_long ns_encap_pullup;
512 1.1 christos u_long ns_exhausted;
513 1.1 christos u_long ns_icmp_address;
514 1.1 christos u_long ns_icmp_basic;
515 1.1 christos u_long ns_icmp_mbuf;
516 1.1 christos u_long ns_icmp_notfound;
517 1.1 christos u_long ns_icmp_rebuild;
518 1.1 christos u_long ns_icmp_short;
519 1.1 christos u_long ns_icmp_size;
520 1.1 christos u_long ns_ifpaddrfail;
521 1.1 christos u_long ns_ignored;
522 1.1 christos u_long ns_insert_fail;
523 1.1 christos u_long ns_inuse;
524 1.1 christos u_long ns_log;
525 1.1 christos u_long ns_lookup_miss;
526 1.1 christos u_long ns_lookup_nowild;
527 1.1 christos u_long ns_new_ifpaddr;
528 1.1 christos u_long ns_memfail;
529 1.1 christos u_long ns_table_max;
530 1.1 christos u_long ns_translated;
531 1.1 christos u_long ns_unfinalised;
532 1.1 christos u_long ns_wrap;
533 1.1 christos u_long ns_xlate_null;
534 1.1 christos u_long ns_xlate_exists;
535 1.1 christos u_long ns_ipf_proxy_fail;
536 1.1 christos u_long ns_uncreate[2];
537 1.1 christos } nat_stat_side_t;
538 1.1 christos
539 1.1 christos
540 1.1 christos typedef struct natstat {
541 1.1 christos nat_t *ns_instances;
542 1.1 christos ipnat_t *ns_list;
543 1.1 christos hostmap_t *ns_maplist;
544 1.1 christos hostmap_t **ns_maptable;
545 1.1 christos u_int ns_active;
546 1.1 christos u_long ns_addtrpnt;
547 1.1 christos u_long ns_divert_build;
548 1.1 christos u_long ns_expire;
549 1.1 christos u_long ns_flush_all;
550 1.1 christos u_long ns_flush_closing;
551 1.1 christos u_long ns_flush_queue;
552 1.1 christos u_long ns_flush_state;
553 1.1 christos u_long ns_flush_timeout;
554 1.1 christos u_long ns_hm_new;
555 1.1 christos u_long ns_hm_newfail;
556 1.1 christos u_long ns_hm_addref;
557 1.1 christos u_long ns_hm_nullnp;
558 1.1 christos u_long ns_log_ok;
559 1.1 christos u_long ns_log_fail;
560 1.1 christos u_int ns_hostmap_sz;
561 1.1 christos u_int ns_nattab_sz;
562 1.1 christos u_int ns_nattab_max;
563 1.1 christos u_int ns_orphans;
564 1.1 christos u_int ns_rules;
565 1.1 christos u_int ns_rules_map;
566 1.1 christos u_int ns_rules_rdr;
567 1.1 christos u_int ns_rultab_sz;
568 1.1 christos u_int ns_rdrtab_sz;
569 1.1 christos u_32_t ns_ticks;
570 1.1 christos u_int ns_trpntab_sz;
571 1.1 christos u_int ns_wilds;
572 1.1 christos u_long ns_proto[256];
573 1.1 christos nat_stat_side_t ns_side[2];
574 1.1 christos #ifdef USE_INET6
575 1.1 christos nat_stat_side_t ns_side6[2];
576 1.1 christos #endif
577 1.1 christos } natstat_t;
578 1.1 christos
579 1.1 christos typedef struct natlog {
580 1.1 christos i6addr_t nl_osrcip;
581 1.1 christos i6addr_t nl_odstip;
582 1.1 christos i6addr_t nl_nsrcip;
583 1.1 christos i6addr_t nl_ndstip;
584 1.1 christos u_short nl_osrcport;
585 1.1 christos u_short nl_odstport;
586 1.1 christos u_short nl_nsrcport;
587 1.1 christos u_short nl_ndstport;
588 1.1 christos int nl_action;
589 1.1 christos int nl_type;
590 1.1 christos int nl_rule;
591 1.1 christos U_QUAD_T nl_pkts[2];
592 1.1 christos U_QUAD_T nl_bytes[2];
593 1.1 christos u_char nl_p[2];
594 1.1 christos u_char nl_v[2];
595 1.1 christos u_char nl_ifnames[2][LIFNAMSIZ];
596 1.1 christos } natlog_t;
597 1.1 christos
598 1.1 christos
599 1.1 christos #define NL_NEW 0
600 1.1 christos #define NL_CLONE 1
601 1.3 darrenr #define NL_PURGE 0xfffc
602 1.1 christos #define NL_DESTROY 0xfffd
603 1.1 christos #define NL_FLUSH 0xfffe
604 1.1 christos #define NL_EXPIRE 0xffff
605 1.1 christos
606 1.1 christos #define NAT_HASH_FN(_k,_l,_m) (((_k) + ((_k) >> 12) + _l) % (_m))
607 1.1 christos #define NAT_HASH_FN6(_k,_l,_m) ((((u_32_t *)(_k))[3] \
608 1.1 christos + (((u_32_t *)(_k))[3] >> 12) \
609 1.1 christos + (((u_32_t *)(_k))[2]) \
610 1.1 christos + (((u_32_t *)(_k))[2] >> 12) \
611 1.1 christos + (((u_32_t *)(_k))[1]) \
612 1.1 christos + (((u_32_t *)(_k))[1] >> 12) \
613 1.1 christos + (((u_32_t *)(_k))[0]) \
614 1.1 christos + (((u_32_t *)(_k))[0] >> 12) \
615 1.1 christos + _l) % (_m))
616 1.1 christos
617 1.1 christos #define LONG_SUM(_i) (((_i) & 0xffff) + ((_i) >> 16))
618 1.1 christos #define LONG_SUM6(_i) (LONG_SUM(ntohl(((u_32_t *)(_i))[0])) + \
619 1.1 christos LONG_SUM(ntohl(((u_32_t *)(_i))[1])) + \
620 1.1 christos LONG_SUM(ntohl(((u_32_t *)(_i))[2])) + \
621 1.1 christos LONG_SUM(ntohl(((u_32_t *)(_i))[3])))
622 1.1 christos
623 1.1 christos #define CALC_SUMD(s1, s2, sd) { \
624 1.1 christos (s1) = ((s1) & 0xffff) + ((s1) >> 16); \
625 1.1 christos (s2) = ((s2) & 0xffff) + ((s2) >> 16); \
626 1.1 christos /* Do it twice */ \
627 1.1 christos (s1) = ((s1) & 0xffff) + ((s1) >> 16); \
628 1.1 christos (s2) = ((s2) & 0xffff) + ((s2) >> 16); \
629 1.1 christos /* Because ~1 == -2, We really need ~1 == -1 */ \
630 1.1 christos if ((s1) > (s2)) (s2)--; \
631 1.1 christos (sd) = (s2) - (s1); \
632 1.1 christos (sd) = ((sd) & 0xffff) + ((sd) >> 16); }
633 1.1 christos
634 1.1 christos #define NAT_SYSSPACE 0x80000000
635 1.1 christos #define NAT_LOCKHELD 0x40000000
636 1.1 christos
637 1.1 christos /*
638 1.1 christos * This is present in ip_nat.h because it needs to be shared between
639 1.1 christos * ip_nat.c and ip_nat6.c
640 1.1 christos */
641 1.1 christos typedef struct ipf_nat_softc_s {
642 1.1 christos ipfmutex_t ipf_nat_new;
643 1.1 christos ipfmutex_t ipf_nat_io;
644 1.1 christos int ipf_nat_doflush;
645 1.1 christos int ipf_nat_logging;
646 1.1 christos int ipf_nat_lock;
647 1.1 christos int ipf_nat_inited;
648 1.1 christos int ipf_nat_table_wm_high;
649 1.1 christos int ipf_nat_table_wm_low;
650 1.1 christos u_int ipf_nat_table_max;
651 1.1 christos u_int ipf_nat_table_sz;
652 1.1 christos u_int ipf_nat_maprules_sz;
653 1.1 christos u_int ipf_nat_rdrrules_sz;
654 1.1 christos u_int ipf_nat_hostmap_sz;
655 1.1 christos u_int ipf_nat_maxbucket;
656 1.1 christos u_int ipf_nat_last_force_flush;
657 1.1 christos u_int ipf_nat_defage;
658 1.1 christos u_int ipf_nat_defipage;
659 1.1 christos u_int ipf_nat_deficmpage;
660 1.3 darrenr ipf_v4_masktab_t ipf_nat_map_mask;
661 1.3 darrenr ipf_v6_masktab_t ipf_nat6_map_mask;
662 1.3 darrenr ipf_v4_masktab_t ipf_nat_rdr_mask;
663 1.3 darrenr ipf_v6_masktab_t ipf_nat6_rdr_mask;
664 1.1 christos nat_t **ipf_nat_table[2];
665 1.1 christos nat_t *ipf_nat_instances;
666 1.1 christos ipnat_t *ipf_nat_list;
667 1.3 darrenr ipnat_t **ipf_nat_list_tail;
668 1.1 christos ipnat_t **ipf_nat_map_rules;
669 1.1 christos ipnat_t **ipf_nat_rdr_rules;
670 1.1 christos ipftq_t *ipf_nat_utqe;
671 1.1 christos hostmap_t **ipf_hm_maptable ;
672 1.1 christos hostmap_t *ipf_hm_maplist ;
673 1.1 christos ipftuneable_t *ipf_nat_tune;
674 1.1 christos ipftq_t ipf_nat_udptq;
675 1.1 christos ipftq_t ipf_nat_udpacktq;
676 1.1 christos ipftq_t ipf_nat_icmptq;
677 1.1 christos ipftq_t ipf_nat_icmpacktq;
678 1.1 christos ipftq_t ipf_nat_iptq;
679 1.1 christos ipftq_t ipf_nat_pending;
680 1.1 christos ipftq_t ipf_nat_tcptq[IPF_TCP_NSTATES];
681 1.1 christos natstat_t ipf_nat_stats;
682 1.1 christos } ipf_nat_softc_t ;
683 1.1 christos
684 1.3 darrenr #define ipf_nat_map_max ipf_nat_map_mask.imt4_max
685 1.3 darrenr #define ipf_nat_rdr_max ipf_nat_rdr_mask.imt4_max
686 1.3 darrenr #define ipf_nat6_map_max ipf_nat6_map_mask.imt6_max
687 1.3 darrenr #define ipf_nat6_rdr_max ipf_nat6_rdr_mask.imt6_max
688 1.3 darrenr #define ipf_nat_map_active_masks ipf_nat_map_mask.imt4_active
689 1.3 darrenr #define ipf_nat_rdr_active_masks ipf_nat_rdr_mask.imt4_active
690 1.3 darrenr #define ipf_nat6_map_active_masks ipf_nat6_map_mask.imt6_active
691 1.3 darrenr #define ipf_nat6_rdr_active_masks ipf_nat6_rdr_mask.imt6_active
692 1.3 darrenr
693 1.1 christos extern frentry_t ipfnatblock;
694 1.1 christos
695 1.2 christos extern void ipf_fix_datacksum(u_short *, u_32_t);
696 1.3 darrenr extern void ipf_fix_incksum(int, u_short *, u_32_t, u_32_t);
697 1.3 darrenr extern void ipf_fix_outcksum(int, u_short *, u_32_t, u_32_t);
698 1.2 christos
699 1.2 christos extern int ipf_nat_checkin(fr_info_t *, u_32_t *);
700 1.2 christos extern int ipf_nat_checkout(fr_info_t *, u_32_t *);
701 1.2 christos extern void ipf_nat_delete(ipf_main_softc_t *, struct nat *, int);
702 1.2 christos extern void ipf_nat_deref(ipf_main_softc_t *, nat_t **);
703 1.2 christos extern void ipf_nat_expire(ipf_main_softc_t *);
704 1.3 darrenr extern int ipf_nat_hashtab_add(ipf_main_softc_t *,
705 1.3 darrenr ipf_nat_softc_t *, nat_t *);
706 1.3 darrenr extern void ipf_nat_hostmapdel(ipf_main_softc_t *, hostmap_t **);
707 1.2 christos extern int ipf_nat_hostmap_rehash(ipf_main_softc_t *,
708 1.2 christos ipftuneable_t *, ipftuneval_t *);
709 1.2 christos extern nat_t *ipf_nat_icmperrorlookup(fr_info_t *, int);
710 1.2 christos extern nat_t *ipf_nat_icmperror(fr_info_t *, u_int *, int);
711 1.1 christos #if defined(__OpenBSD__)
712 1.2 christos extern void ipf_nat_ifdetach(void *);
713 1.1 christos #endif
714 1.2 christos extern int ipf_nat_init(void);
715 1.2 christos extern nat_t *ipf_nat_inlookup(fr_info_t *, u_int, u_int,
716 1.2 christos struct in_addr, struct in_addr);
717 1.2 christos extern int ipf_nat_in(fr_info_t *, nat_t *, int, u_32_t);
718 1.2 christos extern int ipf_nat_insert(ipf_main_softc_t *, ipf_nat_softc_t *,
719 1.2 christos nat_t *);
720 1.2 christos extern int ipf_nat_ioctl(ipf_main_softc_t *, void *, ioctlcmd_t,
721 1.2 christos int, int, void *);
722 1.2 christos extern void ipf_nat_log(ipf_main_softc_t *, ipf_nat_softc_t *,
723 1.2 christos struct nat *, u_int);
724 1.2 christos extern nat_t *ipf_nat_lookupredir(natlookup_t *);
725 1.2 christos extern nat_t *ipf_nat_maplookup(void *, u_int, struct in_addr,
726 1.2 christos struct in_addr);
727 1.2 christos extern nat_t *ipf_nat_add(fr_info_t *, ipnat_t *, nat_t **,
728 1.2 christos u_int, int);
729 1.2 christos extern int ipf_nat_out(fr_info_t *, nat_t *, int, u_32_t);
730 1.2 christos extern nat_t *ipf_nat_outlookup(fr_info_t *, u_int, u_int,
731 1.2 christos struct in_addr, struct in_addr);
732 1.2 christos extern u_short *ipf_nat_proto(fr_info_t *, nat_t *, u_int);
733 1.3 darrenr extern void ipf_nat_rule_deref(ipf_main_softc_t *, ipnat_t **);
734 1.2 christos extern void ipf_nat_setqueue(ipf_main_softc_t *, ipf_nat_softc_t *,
735 1.2 christos nat_t *);
736 1.2 christos extern void ipf_nat_setpending(ipf_main_softc_t *, nat_t *);
737 1.2 christos extern nat_t *ipf_nat_tnlookup(fr_info_t *, int);
738 1.2 christos extern void ipf_nat_update(fr_info_t *, nat_t *);
739 1.2 christos extern frentry_t *ipf_nat_ipfin(fr_info_t *, u_32_t *);
740 1.2 christos extern frentry_t *ipf_nat_ipfout(fr_info_t *, u_32_t *);
741 1.2 christos extern int ipf_nat_in(fr_info_t *, nat_t *, int, u_32_t);
742 1.2 christos extern int ipf_nat_out(fr_info_t *, nat_t *, int, u_32_t);
743 1.2 christos extern int ipf_nat_rehash(ipf_main_softc_t *, ipftuneable_t *,
744 1.2 christos ipftuneval_t *);
745 1.2 christos extern int ipf_nat_rehash_rules(ipf_main_softc_t *, ipftuneable_t *,
746 1.2 christos ipftuneval_t *);
747 1.2 christos extern int ipf_nat_settimeout(struct ipf_main_softc_s *,
748 1.2 christos ipftuneable_t *, ipftuneval_t *);
749 1.2 christos extern void ipf_nat_sync(ipf_main_softc_t *, void *);
750 1.2 christos
751 1.2 christos extern nat_t *ipf_nat_clone(fr_info_t *, nat_t *);
752 1.2 christos extern void ipf_nat_delmap(ipf_nat_softc_t *, ipnat_t *);
753 1.2 christos extern void ipf_nat_delrdr(ipf_nat_softc_t *, ipnat_t *);
754 1.2 christos extern int ipf_nat_wildok(nat_t *, int, int, int, int);
755 1.2 christos extern void ipf_nat_setlock(void *, int);
756 1.2 christos extern void ipf_nat_load(void);
757 1.2 christos extern void *ipf_nat_soft_create(ipf_main_softc_t *);
758 1.2 christos extern int ipf_nat_soft_init(ipf_main_softc_t *, void *);
759 1.2 christos extern void ipf_nat_soft_destroy(ipf_main_softc_t *, void *);
760 1.2 christos extern int ipf_nat_soft_fini(ipf_main_softc_t *, void *);
761 1.2 christos extern int ipf_nat_main_load(void);
762 1.2 christos extern int ipf_nat_main_unload(void);
763 1.2 christos extern ipftq_t *ipf_nat_add_tq(ipf_main_softc_t *, int);
764 1.2 christos extern void ipf_nat_uncreate(fr_info_t *);
765 1.1 christos
766 1.1 christos #ifdef USE_INET6
767 1.2 christos extern nat_t *ipf_nat6_add(fr_info_t *, ipnat_t *, nat_t **,
768 1.2 christos u_int, int);
769 1.2 christos extern void ipf_nat6_addrdr(ipf_nat_softc_t *, ipnat_t *);
770 1.2 christos extern void ipf_nat6_addmap(ipf_nat_softc_t *, ipnat_t *);
771 1.2 christos extern int ipf_nat6_checkout(fr_info_t *, u_32_t *);
772 1.2 christos extern int ipf_nat6_checkin(fr_info_t *, u_32_t *);
773 1.3 darrenr extern void ipf_nat6_delmap(ipf_nat_softc_t *, ipnat_t *);
774 1.3 darrenr extern void ipf_nat6_delrdr(ipf_nat_softc_t *, ipnat_t *);
775 1.2 christos extern int ipf_nat6_finalise(fr_info_t *, nat_t *);
776 1.2 christos extern nat_t *ipf_nat6_icmperror(fr_info_t *, u_int *, int);
777 1.2 christos extern nat_t *ipf_nat6_icmperrorlookup(fr_info_t *, int);
778 1.2 christos extern nat_t *ipf_nat6_inlookup(fr_info_t *, u_int, u_int,
779 1.2 christos struct in6_addr *, struct in6_addr *);
780 1.2 christos extern u_32_t ipf_nat6_ip6subtract(i6addr_t *, i6addr_t *);
781 1.2 christos extern frentry_t *ipf_nat6_ipfin(fr_info_t *, u_32_t *);
782 1.2 christos extern frentry_t *ipf_nat6_ipfout(fr_info_t *, u_32_t *);
783 1.2 christos extern nat_t *ipf_nat6_lookupredir(natlookup_t *);
784 1.2 christos extern int ipf_nat6_newmap(fr_info_t *, nat_t *, natinfo_t *);
785 1.2 christos extern int ipf_nat6_newrdr(fr_info_t *, nat_t *, natinfo_t *);
786 1.2 christos extern nat_t *ipf_nat6_outlookup(fr_info_t *, u_int, u_int,
787 1.2 christos struct in6_addr *, struct in6_addr *);
788 1.2 christos extern int ipf_nat6_newrewrite(fr_info_t *, nat_t *, natinfo_t *);
789 1.2 christos extern int ipf_nat6_newdivert(fr_info_t *, nat_t *, natinfo_t *);
790 1.2 christos extern int ipf_nat6_ruleaddrinit(ipf_main_softc_t *, ipf_nat_softc_t *, ipnat_t *);
791 1.1 christos
792 1.1 christos #endif
793 1.1 christos
794 1.1 christos
795 1.1 christos #endif /* __IP_NAT_H__ */
796