Matched the usage() flags to the man page. Added the missing 'Z' option to them. Updated the man page to include the new option and the source of the dhcpd programs. Reference: /n/sources/patch/applied/dhcpd_take_2 Date: Sat Mar 3 07:25:40 CET 2007 Signed-off-by: lucio@proxima.alt.za --- /sys/src/cmd/ip/dhcpd/dhcpd.c Sat Mar 3 07:22:24 2007 +++ /sys/src/cmd/ip/dhcpd/dhcpd.c Sat Mar 3 07:21:54 2007 @@ -57,6 +57,7 @@ int pptponly; // only answer request that came from the pptp server int mute, mutestat; int minlease = MinLease; +int staticlease = StaticLease; ulong start; @@ -199,7 +200,7 @@ void usage(void) { - fprint(2, "usage: dhcp [-dmsnp] [-f directory] [-x netmtpt] [-M minlease] addr n [addr n ...]\n"); + fprint(2, "usage: dhcp [-mdsSnprZ] [-f directory] [-x netmtpt] [-M minlease] [-Z staticlease] addr n [addr n ...]\n"); exits("usage"); } @@ -259,6 +260,17 @@ if(minlease <= 0) minlease = MinLease; break; + case 'Z': + p = ARGF(); + if(p == nil) + usage(); + staticlease = atoi(p); + if(staticlease <= 0) + staticlease = StaticLease; + break; + default: + usage(); + break; } ARGEND; while(argc > 1){ @@ -428,7 +440,7 @@ Binding *b, *nb; if(rp->staticbinding){ - sendoffer(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease)); + sendoffer(rp, rp->ii.ipaddr, (staticlease > minlease ? staticlease : minlease)); return; } @@ -486,7 +498,7 @@ /* check for hard assignment */ if(rp->staticbinding){ if(forme(rp->server)) - sendack(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease), 1); + sendack(rp, rp->ii.ipaddr, (staticlease > minlease ? staticlease : minlease), 1); else warning(0, "!Request(%s via %I): for server %I not me", rp->id, rp->gii.ipaddr, rp->server); @@ -543,7 +555,7 @@ rp->id, rp->gii.ipaddr, rp->ip, rp->bp->chaddr); sendnak(rp, "not valid"); } - sendack(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease), 1); + sendack(rp, rp->ii.ipaddr, (staticlease > minlease ? staticlease : minlease), 1); return; } @@ -585,7 +597,7 @@ rp->id, rp->gii.ipaddr, rp->ciaddr); sendnak(rp, "not valid"); } - sendack(rp, rp->ii.ipaddr, (StaticLease > minlease ? StaticLease : minlease), 1); + sendack(rp, rp->ii.ipaddr, (staticlease > minlease ? staticlease : minlease), 1); return; } --- /sys/man/8/dhcpd Sat Mar 3 07:23:14 2007 +++ /sys/man/8/dhcpd Sat Mar 3 07:23:03 2007 @@ -4,13 +4,15 @@ .SH SYNOPSIS .PP .B ip/dhcpd -.RB [ -mdsSnpr ] +.RB [ -mdsSnprZ ] .RB [ -f .IR ndb-file ] .RB [ -x .IR netmtpt ] .RB [ -M .IR secs ] +.RB [ -Z +.IR secs ] [ .I address .I n @@ -210,7 +212,12 @@ .B M Use .I secs -as the minimum lease time. +as the minimum lease time for dynamic addresses. +.TP +.B Z +Use +.I secs +as the minimum lease time for static addresses. .PD .PP .I Dhcpleases @@ -285,5 +292,7 @@ .BR /lib/ndb/dhcp " directory of dynamic address files .SH SOURCE .B /sys/src/cmd/ip +.br +.B /sys/src/cmd/ip/dhcpd .SH "SEE ALSO" .IR ndb (6)