svn commit: r220806 - head/sbin/natd
Maxim Sobolev
sobomax at FreeBSD.org
Mon Apr 18 23:15:30 UTC 2011
Author: sobomax
Date: Mon Apr 18 23:15:29 2011
New Revision: 220806
URL: http://svn.freebsd.org/changeset/base/220806
Log:
Only wait for the IP to appear on the interface if natd is running in the
background.
Suggested by: Garrett Cooper <yanegomi at gmail.com>
Use EAGAIN instead of magic value of -2 to report this condition from the
SetAliasAddressFromIfName routine.
MFC after: 2 weeks
Modified:
head/sbin/natd/natd.c
Modified: head/sbin/natd/natd.c
==============================================================================
--- head/sbin/natd/natd.c Mon Apr 18 23:12:41 2011 (r220805)
+++ head/sbin/natd/natd.c Mon Apr 18 23:15:29 2011 (r220806)
@@ -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 dire
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 *if
if (sin == NULL) {
warnx("%s: cannot get interface address", ifn);
free(buf);
- return -2;
+ return EAGAIN;
}
LibAliasSetAddress(mla, sin->sin_addr);
More information about the svn-src-head
mailing list