summaryrefslogtreecommitdiffstats
path: root/sbin/ipfw/nat.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2015-02-06 18:13:29 +0000
committerjhb <jhb@FreeBSD.org>2015-02-06 18:13:29 +0000
commit1fa38dee26fb14059a2b4fa98625a6d7f8879924 (patch)
treebde19fa7638ac8cc1e716c20fd5dc2e63871fbd0 /sbin/ipfw/nat.c
parentb2ec5474301d37ac927f7ff78cd22f9e60fe0a86 (diff)
downloadFreeBSD-src-1fa38dee26fb14059a2b4fa98625a6d7f8879924.zip
FreeBSD-src-1fa38dee26fb14059a2b4fa98625a6d7f8879924.tar.gz
MFC 277714:
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.
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 bff28e1..de14921 100644
--- a/sbin/ipfw/nat.c
+++ b/sbin/ipfw/nat.c
@@ -156,9 +156,9 @@ set_addr_dynamic(const char *ifn, struct 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