summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_nat.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1999-08-08 00:43:01 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1999-08-08 00:43:01 +0000
commite09cf6c78cf6abfe9238df036609a770d07895c7 (patch)
tree0372b157616721e3317d539fd56a6afe5e270c6a /sys/netinet/ip_nat.c
parent8caf3f08d55dcea309e251d36eca66a7159efe22 (diff)
Support detaching of network interfaces. Still work to do in ipf, and
other families than inet.
Diffstat (limited to 'sys/netinet/ip_nat.c')
-rw-r--r--sys/netinet/ip_nat.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/netinet/ip_nat.c b/sys/netinet/ip_nat.c
index 219d56b6bec..b6eaf071b04 100644
--- a/sys/netinet/ip_nat.c
+++ b/sys/netinet/ip_nat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_nat.c,v 1.21 1999/06/07 22:00:34 deraadt Exp $ */
+/* $OpenBSD: ip_nat.c,v 1.22 1999/08/08 00:43:00 niklas Exp $ */
/*
* Copyright (C) 1995-1998 by Darren Reed.
*
@@ -10,7 +10,7 @@
*/
#if !defined(lint)
static const char sccsid[] = "@(#)ip_nat.c 1.11 6/5/96 (C) 1995 Darren Reed";
-static const char rcsid[] = "@(#)$Id: ip_nat.c,v 1.21 1999/06/07 22:00:34 deraadt Exp $";
+static const char rcsid[] = "@(#)$Id: ip_nat.c,v 1.22 1999/08/08 00:43:00 niklas Exp $";
#endif
#if defined(__FreeBSD__) && defined(KERNEL) && !defined(_KERNEL)
@@ -413,6 +413,26 @@ struct nat *natd;
KFREE(natd);
}
+void
+nat_ifdetach(ifp)
+ struct ifnet *ifp;
+{
+ ipnat_t *n, **np;
+
+ for (np = &nat_list; (n = *np) != NULL; np = &n->in_next) {
+ *np = n->in_next;
+ if (!n->in_use) {
+ if (n->in_apr)
+ ap_free(n->in_apr);
+ KFREE(n);
+ nat_stats.ns_rules--;
+ } else {
+ n->in_flags |= IPN_DELETE;
+ n->in_next = NULL;
+ }
+ n = NULL;
+ }
+}
/*
* nat_flushtable - clear the NAT table of all mapping entries.