Deleted Added
full compact
ip_frag.c (63523) ip_frag.c (67614)
1/*
2 * Copyright (C) 1993-2000 by Darren Reed.
3 *
4 * Redistribution and use in source and binary forms are permitted
5 * provided that this notice is preserved and due credit is given
6 * to the original author and the contributors.
7 */
8#if !defined(lint)
9static const char sccsid[] = "@(#)ip_frag.c 1.11 3/24/96 (C) 1993-1995 Darren Reed";
10/*static const char rcsid[] = "@(#)$Id: ip_frag.c,v 2.10.2.4 2000/06/06 15:49:15 darrenr Exp $";*/
1/*
2 * Copyright (C) 1993-2000 by Darren Reed.
3 *
4 * Redistribution and use in source and binary forms are permitted
5 * provided that this notice is preserved and due credit is given
6 * to the original author and the contributors.
7 */
8#if !defined(lint)
9static const char sccsid[] = "@(#)ip_frag.c 1.11 3/24/96 (C) 1993-1995 Darren Reed";
10/*static const char rcsid[] = "@(#)$Id: ip_frag.c,v 2.10.2.4 2000/06/06 15:49:15 darrenr Exp $";*/
11static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_frag.c 63523 2000-07-19 14:02:09Z darrenr $";
11static const char rcsid[] = "@(#)$FreeBSD: head/sys/contrib/ipfilter/netinet/ip_frag.c 67614 2000-10-26 12:33:42Z darrenr $";
12#endif
13
14#if defined(KERNEL) && !defined(_KERNEL)
15# define _KERNEL
16#endif
17
18#include <sys/errno.h>
19#include <sys/types.h>

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

210int ipfr_newfrag(ip, fin, pass)
211ip_t *ip;
212fr_info_t *fin;
213u_int pass;
214{
215 ipfr_t *ipf;
216
217 if ((ip->ip_v != 4) || (fr_frag_lock))
12#endif
13
14#if defined(KERNEL) && !defined(_KERNEL)
15# define _KERNEL
16#endif
17
18#include <sys/errno.h>
19#include <sys/types.h>

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

210int ipfr_newfrag(ip, fin, pass)
211ip_t *ip;
212fr_info_t *fin;
213u_int pass;
214{
215 ipfr_t *ipf;
216
217 if ((ip->ip_v != 4) || (fr_frag_lock))
218 return NULL;
218 return -1;
219 WRITE_ENTER(&ipf_frag);
220 ipf = ipfr_new(ip, fin, pass, ipfr_heads);
221 RWLOCK_EXIT(&ipf_frag);
222 return ipf ? 0 : -1;
223}
224
225
226int ipfr_nat_newfrag(ip, fin, pass, nat)
227ip_t *ip;
228fr_info_t *fin;
229u_int pass;
230nat_t *nat;
231{
232 ipfr_t *ipf;
233
234 if ((ip->ip_v != 4) || (fr_frag_lock))
219 WRITE_ENTER(&ipf_frag);
220 ipf = ipfr_new(ip, fin, pass, ipfr_heads);
221 RWLOCK_EXIT(&ipf_frag);
222 return ipf ? 0 : -1;
223}
224
225
226int ipfr_nat_newfrag(ip, fin, pass, nat)
227ip_t *ip;
228fr_info_t *fin;
229u_int pass;
230nat_t *nat;
231{
232 ipfr_t *ipf;
233
234 if ((ip->ip_v != 4) || (fr_frag_lock))
235 return NULL;
235 return -1;
236 WRITE_ENTER(&ipf_natfrag);
237 ipf = ipfr_new(ip, fin, pass, ipfr_nattab);
238 if (ipf != NULL) {
239 ipf->ipfr_data = nat;
240 nat->nat_data = ipf;
241 }
242 RWLOCK_EXIT(&ipf_natfrag);
243 return ipf ? 0 : -1;

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

324 ipfr_t *ipf;
325
326 if ((ip->ip_v != 4) || (fr_frag_lock))
327 return NULL;
328 READ_ENTER(&ipf_natfrag);
329 ipf = ipfr_lookup(ip, fin, ipfr_nattab);
330 if (ipf != NULL) {
331 nat = ipf->ipfr_data;
236 WRITE_ENTER(&ipf_natfrag);
237 ipf = ipfr_new(ip, fin, pass, ipfr_nattab);
238 if (ipf != NULL) {
239 ipf->ipfr_data = nat;
240 nat->nat_data = ipf;
241 }
242 RWLOCK_EXIT(&ipf_natfrag);
243 return ipf ? 0 : -1;

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

324 ipfr_t *ipf;
325
326 if ((ip->ip_v != 4) || (fr_frag_lock))
327 return NULL;
328 READ_ENTER(&ipf_natfrag);
329 ipf = ipfr_lookup(ip, fin, ipfr_nattab);
330 if (ipf != NULL) {
331 nat = ipf->ipfr_data;
332 /*
333 * This is the last fragment for this packet.
334 */
335 if ((ipf->ipfr_ttl == 1) && (nat != NULL)) {
336 nat->nat_data = NULL;
337 ipf->ipfr_data = NULL;
338 }
332 if (nat->nat_ifp == fin->fin_ifp) {
333 /*
334 * This is the last fragment for this packet.
335 */
336 if ((ipf->ipfr_ttl == 1) && (nat != NULL)) {
337 nat->nat_data = NULL;
338 ipf->ipfr_data = NULL;
339 }
340 } else
341 nat = NULL;
339 } else
340 nat = NULL;
341 RWLOCK_EXIT(&ipf_natfrag);
342 return nat;
343}
344
345
346/*

--- 208 unchanged lines hidden ---
342 } else
343 nat = NULL;
344 RWLOCK_EXIT(&ipf_natfrag);
345 return nat;
346}
347
348
349/*

--- 208 unchanged lines hidden ---