aboutsummaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_nat.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1997-03-02 15:50:35 +0000
committerPeter Wemm <peter@FreeBSD.org>1997-03-02 15:50:35 +0000
commit413e00145c3f486f87ed078f02b03545cc6aec9c (patch)
treeca11d3e65b58ac6ba4fc4209514e540b4acad5f0 /sys/netinet/ip_nat.c
parent3589f3628a5b767f1bfec12dfd5e1cdf1eaee79e (diff)
downloadsrc-413e00145c3f486f87ed078f02b03545cc6aec9c.tar.gz
src-413e00145c3f486f87ed078f02b03545cc6aec9c.zip
Import ipfilter 3.1.8 kernel componentsvendor/ipfilter-sys/ipfilter3_1_8
Notes
Notes: svn path=/vendor-sys/ipfilter/dist-old/; revision=23285 svn path=/vendor-sys/ipfilter/ipfilter3_1_8/; revision=23287; tag=vendor/ipfilter-sys/ipfilter3_1_8
Diffstat (limited to 'sys/netinet/ip_nat.c')
-rw-r--r--sys/netinet/ip_nat.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/sys/netinet/ip_nat.c b/sys/netinet/ip_nat.c
index afe9761bc093..ee59a6cda1dd 100644
--- a/sys/netinet/ip_nat.c
+++ b/sys/netinet/ip_nat.c
@@ -9,7 +9,7 @@
*/
#if !defined(lint) && defined(LIBC_SCCS)
static char sccsid[] = "@(#)ip_nat.c 1.11 6/5/96 (C) 1995 Darren Reed";
-static char rcsid[] = "$Id: ip_nat.c,v 2.0.1.10 1997/02/08 06:38:49 darrenr Exp $";
+static char rcsid[] = "$Id: ip_nat.c,v 2.0.1.11 1997/02/16 06:26:47 darrenr Exp $";
#endif
#if !defined(_KERNEL) && !defined(KERNEL)
@@ -155,12 +155,13 @@ int cmd, mode;
{
register ipnat_t *nat, *n = NULL, **np = NULL;
ipnat_t natd;
- int error = 0, ret;
+ int error = 0, ret, s;
/*
* For add/delete, look to see if the NAT entry is already present
*/
MUTEX_ENTER(&ipf_nat);
+ SPLNET(s);
if ((cmd == SIOCADNAT) || (cmd == SIOCRMNAT)) {
IRCOPY(data, (char *)&natd, sizeof(natd));
nat = &natd;
@@ -260,6 +261,7 @@ int cmd, mode;
IWCOPY((caddr_t)&ret, data, sizeof(ret));
break;
}
+ SPLX(s);
MUTEX_EXIT(&ipf_nat);
return error;
}
@@ -857,11 +859,13 @@ fr_info_t *fin;
*/
void ip_natunload()
{
- MUTEX_ENTER(&ipf_nat);
+ int s;
+ MUTEX_ENTER(&ipf_nat);
+ SPLNET(s);
(void) clear_natlist();
(void) flush_nattable();
-
+ SPLX(s)
MUTEX_EXIT(&ipf_nat);
}
@@ -873,14 +877,19 @@ void ip_natunload()
void ip_natexpire()
{
register struct nat *nat, **natp;
+ int s;
MUTEX_ENTER(&ipf_nat);
- for (natp = &nat_instances; (nat = *natp); natp = &nat->nat_next) {
- if (--nat->nat_age)
+ SPLNET(s);
+ for (natp = &nat_instances; (nat = *natp); ) {
+ if (--nat->nat_age) {
+ natp = &nat->nat_next;
continue;
+ }
*natp = nat->nat_next;
nat_delete(nat);
nat_stats.ns_expire++;
}
+ SPLX(s);
MUTEX_EXIT(&ipf_nat);
}