summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw/nat.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2015-01-25 20:37:32 +0000
committerjhb <jhb@FreeBSD.org>2015-01-25 20:37:32 +0000
commit71eba92ca59be0af74c0d1ed3e68559add33521c (patch)
tree627fb7fe90fd88682099da55b9ec02802c8301b1 /sbin/ipfw/nat.c
parent03984c1e9c74ce91042ef333ec96564424269039 (diff)
downloadFreeBSD-src-71eba92ca59be0af74c0d1ed3e68559add33521c.zip
FreeBSD-src-71eba92ca59be0af74c0d1ed3e68559add33521c.tar.gz
natd(8) will work with an unconfigured interface and effectively not do
anything until the interface is assigned an address. This fixes ipfw_nat to do the same by using an IP of INADDR_ANY instead of aborting the nat setup if the requested interface is not yet configured. Differential Revision: https://reviews.freebsd.org/D1539 Reviewed by: melifaro, glebius, gnn MFC after: 1 week
Diffstat (limited to 'sbin/ipfw/nat.c')
-rw-r--r--sbin/ipfw/nat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c
index 3bd0259..4391778 100644
--- a/sbin/ipfw/nat.c
+++ b/sbin/ipfw/nat.c
@@ -163,9 +163,9 @@ set_addr_dynamic(const char *ifn, struct nat44_cfg_nat *n)
}
}
if (sin == NULL)
- errx(1, "%s: cannot get interface address", ifn);
-
- n->ip = sin->sin_addr;
+ n->ip.s_addr = htonl(INADDR_ANY);
+ else
+ n->ip = sin->sin_addr;
strncpy(n->if_name, ifn, IF_NAMESIZE);
free(buf);
OpenPOWER on IntegriCloud