summaryrefslogtreecommitdiffstats
path: root/sbin/natd/natd.c
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2011-04-18 23:15:29 +0000
committersobomax <sobomax@FreeBSD.org>2011-04-18 23:15:29 +0000
commitb756d7087c8a42a80362b062911daa668f5f42fa (patch)
tree569432e89cf1e96802d7ae3989e02bbb042a59a9 /sbin/natd/natd.c
parentf5b28424de5145cf84073390684865dc604cef24 (diff)
downloadFreeBSD-src-b756d7087c8a42a80362b062911daa668f5f42fa.zip
FreeBSD-src-b756d7087c8a42a80362b062911daa668f5f42fa.tar.gz
Only wait for the IP to appear on the interface if natd is running in the
background. Suggested by: Garrett Cooper <yanegomi@gmail.com> Use EAGAIN instead of magic value of -2 to report this condition from the SetAliasAddressFromIfName routine. MFC after: 2 weeks
Diffstat (limited to 'sbin/natd/natd.c')
-rw-r--r--sbin/natd/natd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/natd/natd.c b/sbin/natd/natd.c
index ceb0226..58a5e99 100644
--- a/sbin/natd/natd.c
+++ b/sbin/natd/natd.c
@@ -305,9 +305,9 @@ int main (int argc, char** argv)
else {
do {
rval = SetAliasAddressFromIfName (mip->ifName);
- if (rval == -2)
+ if (background != 0 && rval == EAGAIN)
sleep(1);
- } while (rval == -2);
+ } while (background != 0 && rval == EAGAIN);
if (rval != 0)
exit(1);
}
@@ -648,9 +648,9 @@ static void DoAliasing (int fd, int direction)
if (mip->assignAliasAddr) {
do {
rval = SetAliasAddressFromIfName (mip->ifName);
- if (rval == -2)
+ if (background != 0 && rval == EAGAIN)
sleep(1);
- } while (rval == -2);
+ } while (background != 0 && rval == EAGAIN);
if (rval != 0)
exit(1);
mip->assignAliasAddr = 0;
@@ -969,7 +969,7 @@ SetAliasAddressFromIfName(const char *ifn)
if (sin == NULL) {
warnx("%s: cannot get interface address", ifn);
free(buf);
- return -2;
+ return EAGAIN;
}
LibAliasSetAddress(mla, sin->sin_addr);
OpenPOWER on IntegriCloud