Deleted Added
full compact
ip_fw_nat.c (201122) ip_fw_nat.c (201527)
1/*-
2 * Copyright (c) 2008 Paolo Pisati
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Paolo Pisati
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/netinet/ipfw/ip_fw_nat.c 201122 2009-12-28 10:47:04Z luigi $");
28__FBSDID("$FreeBSD: head/sys/netinet/ipfw/ip_fw_nat.c 201527 2010-01-04 19:01:22Z luigi $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/eventhandler.h>
33#include <sys/malloc.h>
34#include <sys/kernel.h>
35#include <sys/lock.h>
36#include <sys/module.h>

--- 177 unchanged lines hidden (view full) ---

214 ldt = 0;
215 retval = 0;
216 mcl = m_megapullup(m, m->m_pkthdr.len);
217 if (mcl == NULL) {
218 args->m = NULL;
219 return (IP_FW_DENY);
220 }
221 ip = mtod(mcl, struct ip *);
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/eventhandler.h>
33#include <sys/malloc.h>
34#include <sys/kernel.h>
35#include <sys/lock.h>
36#include <sys/module.h>

--- 177 unchanged lines hidden (view full) ---

214 ldt = 0;
215 retval = 0;
216 mcl = m_megapullup(m, m->m_pkthdr.len);
217 if (mcl == NULL) {
218 args->m = NULL;
219 return (IP_FW_DENY);
220 }
221 ip = mtod(mcl, struct ip *);
222 if (args->eh == NULL) {
223 SET_NET_IPLEN(ip);
224 }
225
226 /*
227 * XXX - Libalias checksum offload 'duct tape':
228 *
229 * locally generated packets have only pseudo-header checksum
230 * calculated and libalias will break it[1], so mark them for
231 * later fix. Moreover there are cases when libalias modifies
232 * tcp packet data[2], mark them for later fix too.

--- 92 unchanged lines hidden (view full) ---

325 break;
326 }
327 /* No hw checksum offloading: do it ourselves */
328 if ((mcl->m_pkthdr.csum_flags & CSUM_DELAY_DATA) == 0) {
329 in_delayed_cksum(mcl);
330 mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
331 }
332 }
222
223 /*
224 * XXX - Libalias checksum offload 'duct tape':
225 *
226 * locally generated packets have only pseudo-header checksum
227 * calculated and libalias will break it[1], so mark them for
228 * later fix. Moreover there are cases when libalias modifies
229 * tcp packet data[2], mark them for later fix too.

--- 92 unchanged lines hidden (view full) ---

322 break;
323 }
324 /* No hw checksum offloading: do it ourselves */
325 if ((mcl->m_pkthdr.csum_flags & CSUM_DELAY_DATA) == 0) {
326 in_delayed_cksum(mcl);
327 mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA;
328 }
329 }
333 if (args->eh == NULL) {
334 SET_HOST_IPLEN(ip);
335 }
336 args->m = mcl;
337 return (IP_FW_NAT);
338}
339
340static struct cfg_nat *
341lookup_nat(struct nat_list *l, int nat_id)
342{
343 struct cfg_nat *res;

--- 269 unchanged lines hidden ---
330 args->m = mcl;
331 return (IP_FW_NAT);
332}
333
334static struct cfg_nat *
335lookup_nat(struct nat_list *l, int nat_id)
336{
337 struct cfg_nat *res;

--- 269 unchanged lines hidden ---