#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.44.2.7 1998/12/23 14:18:49 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.44.2.8 1999/01/29 18:33:34 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
ip -> client -> packet.hops = 0;
ip -> client -> packet.xid = ip -> client -> xid;
ip -> client -> packet.secs = 0; /* Filled in by send_request. */
- ip -> client -> packet.flags = htons (BOOTP_BROADCAST);
/* If we own the address we're requesting, put it in ciaddr;
otherwise set ciaddr to zero. */
if (ip -> client -> state == S_BOUND ||
ip -> client -> state == S_RENEWING ||
- ip -> client -> state == S_REBINDING)
+ ip -> client -> state == S_REBINDING) {
memcpy (&ip -> client -> packet.ciaddr,
lease -> address.iabuf, lease -> address.len);
- else
+ } else {
memset (&ip -> client -> packet.ciaddr, 0,
sizeof ip -> client -> packet.ciaddr);
+ ip -> client -> packet.flags = htons (BOOTP_BROADCAST);
+ }
memset (&ip -> client -> packet.yiaddr, 0,
sizeof ip -> client -> packet.yiaddr);
fclose (leaseFile);
leaseFile = fopen (path_dhclient_db, "w");
if (!leaseFile)
- error ("can't create /var/db/dhclient.leases: %m");
+ error ("can't create %s: %m", path_dhclient_db);
/* Write out all the leases attached to configured interfaces that
we know about. */
if (!leaseFile) { /* XXX */
leaseFile = fopen (path_dhclient_db, "w");
if (!leaseFile)
- error ("can't create /var/db/dhclient.leases: %m");
+ error ("can't create %s: %m", path_dhclient_db);
}
fprintf (leaseFile, "lease {\n");