aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/ip
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2009-09-13 17:48:44 -0400
committerRuss Cox <rsc@swtch.com>2009-09-13 17:48:44 -0400
commit417b681c0d94026da0ad0e79e8e50fe1613f9d65 (patch)
treefcb8fd9225b141e75961516242eaadef70d47c56 /src/cmd/ip
parent9eec023b8012162a4dfd78adcb94dea9d5439395 (diff)
downloadplan9port-417b681c0d94026da0ad0e79e8e50fe1613f9d65.tar.gz
plan9port-417b681c0d94026da0ad0e79e8e50fe1613f9d65.tar.bz2
plan9port-417b681c0d94026da0ad0e79e8e50fe1613f9d65.zip
dhcpd: fix build on OS X, silence non-log prints
http://codereview.appspot.com/117064
Diffstat (limited to 'src/cmd/ip')
-rwxr-xr-xsrc/cmd/ip/dhcpd/db.c8
-rwxr-xr-xsrc/cmd/ip/dhcpd/dhcpd.c3
2 files changed, 2 insertions, 9 deletions
diff --git a/src/cmd/ip/dhcpd/db.c b/src/cmd/ip/dhcpd/db.c
index 414d85b9..f4b48552 100755
--- a/src/cmd/ip/dhcpd/db.c
+++ b/src/cmd/ip/dhcpd/db.c
@@ -97,7 +97,6 @@ lockopen(char *file)
fd = open(file, OLOCK|ORDWR);
if(fd >= 0)
return fd;
-print("open %s: %r\n", file);
errstr(err, sizeof err);
if(strstr(err, "lock")){
/* wait for other process to let go of lock */
@@ -297,8 +296,6 @@ idtobinding(char *id, Info *iip, int ping)
}
}
-print("looking for old for %I\n", iip->ipnet);
-
/*
* look for oldest binding that we think is unused
*/
@@ -306,7 +303,6 @@ print("looking for old for %I\n", iip->ipnet);
oldest = nil;
oldesttime = 0;
for(b = bcache; b; b = b->next){
-print("tried %d now %d lease %d exp %d %I\n", b->tried, now, b->lease, b->expoffer, b->ip);
if(b->tried != now)
if(b->lease < now && b->expoffer < now && samenet(b->ip, iip))
if(oldest == nil || b->lasttouched < oldesttime){
@@ -315,7 +311,6 @@ print("tried %d now %d lease %d exp %d %I\n", b->tried, now, b->lease, b->expoff
if(b->lease < now && b->expoffer < now && samenet(b->ip, iip))
if(oldest == nil || b->lasttouched < oldesttime){
oldest = b;
-print("have oldest\n");
oldesttime = b->lasttouched;
}
}
@@ -325,7 +320,6 @@ print("have oldest\n");
/* make sure noone is still using it */
oldest->tried = now;
-print("return oldest\n");
if(ping == 0 || icmpecho(oldest->ip) == 0)
return oldest;
@@ -378,11 +372,9 @@ idtooffer(char *id, Info *iip)
/* look for an offer to this id */
for(b = bcache; b; b = b->next){
-print("%I %I ? offeredto %s id %s\n", b->ip, iip->ipnet, b->offeredto, id);
if(b->offeredto && strcmp(b->offeredto, id) == 0 && samenet(b->ip, iip)){
/* make sure some other system hasn't stolen it */
syncbinding(b, 0);
-print("b->lease %d now %d boundto %s offered %s\n", b->lease, now, b->boundto, b->offeredto);
if(b->lease < now
|| (b->boundto && strcmp(b->boundto, b->offeredto) == 0))
return b;
diff --git a/src/cmd/ip/dhcpd/dhcpd.c b/src/cmd/ip/dhcpd/dhcpd.c
index ae4bd223..e28bf3cb 100755
--- a/src/cmd/ip/dhcpd/dhcpd.c
+++ b/src/cmd/ip/dhcpd/dhcpd.c
@@ -294,8 +294,10 @@ main(int argc, char **argv)
fd = openlisten(net);
wfd = fd;
bwfd = fd;
+#ifdef SO_BINDTODEVICE
if(setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, "eth0", 5) < 0)
print("setsockopt: %r\n");
+#endif
for(;;){
memset(&r, 0, sizeof(r));
@@ -752,7 +754,6 @@ sendoffer(Req *rp, uchar *ip, int offer)
* send
*/
n = rp->p - rp->buf;
-print("OFFER: %I %I %d %d\n", rp->up->laddr, rp->up->raddr, nhgets(rp->up->lport), nhgets(rp->up->rport));
if(!mute && udpwrite(fd, rp->up, rp->buf, n) != n)
warning(0, "offer: write failed: %r");
}