Commit Graph

110 Commits

Author SHA1 Message Date
mellon 3265aaf1d6 Get rid of a spurious dereference in DHCPRELEASE. 2008-02-26 05:03:29 +00:00
gdt e6599a52d6 Change buffer for SIOCGIFCONF usage from 2048 to 32768. Because the
code to retry on SIOCGIFCONF not returning all interfaces is broken,
this unreasonably large buffer should handle the case of a machine
with lots of (usually virtual) interfaces.  dhcpd 4 uses a different
method to get interface configuration, so this kludge should go away
on upgrade.

Fix based on understanding of the code, but has been compile-tested
only, to address failure report received from Michael Graff.
2007-10-31 15:26:51 +00:00
gdt f77e123027 Follow NetBSD's interpretation of the interface to SIOCGIFCONF: the
next ifreq is sizeof(struct ifreq) after the current one unless the
sockaddr is bigger than the union in ifreq that holds it.

In the original 4.4BSD code, this interpretation results in the same
behavior as the "is the sockaddr bigger than struct sockaddr", because
sizeof(struct sockaddr) and sizeof(ifc->ifr_ifru) are the same.

Add comments pointing out problems in the 'need bigger buffer' code,
and copying excessive amounts of data.
2007-09-13 11:56:41 +00:00
christos f84135414c don't make bogus assumptions about struct alignment. 2007-05-31 02:58:10 +00:00
tls ac016a7fc2 Changes required for FORTIFY_SOURCE: don't rely on #define read (etc.)
before system header file inclusion magically causing what "read" is
#defined to to pick up a read-like prototype.  For sanity's sake, put
prototypes for revolting trace_mr stuff in their own header file (instead
of nowhere at all and using the trick referenced above).
2007-05-27 16:27:57 +00:00
dogcow 53d226486b An incredibly grody hack to save a few more precious bytes: in dhclient,
don't include the unknown-{nn,mm} strings ifdef SMALL.
2007-03-01 01:02:33 +00:00
alc b68a85a32f CID-4282: dies if we can't allocate memory for `peer->hba'
CID-2488: `t' is uninitialized
2006-12-26 00:08:44 +00:00
martin be008341cd Hopping through a void* is not enough to get rid of alignment requirements.
Do a memcpy to a properly aligned local variable instead.
2006-11-23 13:07:17 +00:00
tron 66ac2330dc Teach dhclient(8) to exit gracefully if another instance is already
running instead of overwriten the PID file, removing IPv4 address
from the network interface(s) and leaving the system in a broken state.

This fixes PR bin/26504 by Jun-ichiro itojun Hagino. Patch supplied
by Rivo Nurges during NetBSD's second Bugathon.
2006-10-07 14:14:06 +00:00
christos 40a354528b Coverity CID 3692: Prevent use after free (from Arnaud Lacombe) 2006-10-03 19:06:05 +00:00
seb 4a00cfc811 Typo. 2006-08-28 21:21:52 +00:00
christos a6fd778155 don't zerodivide when "backoff-cutoff 0;" tested by zafer 2006-08-03 20:17:43 +00:00
chap baa41845e1 Remove statement (incorrect as of ISC release 3.0.3) that the next-server
value defaults to the server address. (This statement has been removed in
ISC release 3.0.4.)

Closes PR bin/33565.
2006-05-26 19:22:03 +00:00
mrg d1e102b605 match u_char * with u_char[]. 2006-05-11 09:29:39 +00:00
mrg 0eaf0f8b7c #include <sys/param.h> since we want to check __NetBSD_Version__. 2006-05-11 00:08:44 +00:00
christos 8de5cf0e33 Coverity CID 2639: Fix obvious bug in loop handling. Using and freeing the
wrong pointer.
2006-04-02 01:10:39 +00:00
christos 995a3df3f0 PR/33174: Wolfgang Stukenbrock: dhcpd fails to deliver hostnames for dynamic
ranges because it is using the wrong universe in the host lookup.
2006-03-31 17:28:50 +00:00
drochner 9fbefaf7c9 merge dhcp-3.0.3 2005-08-11 17:13:21 +00:00
drochner 1b6f9e91ef import ISC dhcp-3.0.3 onto the vendor branch 2005-08-11 16:54:17 +00:00
mellon 3323a8aa52 Add a -o flag that causes the client to exit once it's bound a lease. 2005-07-01 01:19:02 +00:00
jmc 7a0ba84f10 gcc 2.96 requires all declarations before variable usage so the last set of
changes to fix -Wunitialized broke on vax. Moved definitions of
option and op before the initializations.
2005-06-16 22:04:24 +00:00
he ab70040846 Add initialization of local variable to appease -Wuninitialized.
Marked with XXXGCC for arm and sparc64 compilers (found while
building for those).

Reviewed by lukem.
2005-06-10 23:48:24 +00:00
chs 7bbdd188e1 appease gcc -Wuninitialized on hp700. 2005-06-05 19:08:28 +00:00
lukem 7f4d732106 appease gcc -Wuninitialized 2005-06-02 11:10:00 +00:00
lukem 51d9d5224b omapi_io_destroy(): ensure last is initialized before use, similar to the
method used in omapi_unregister_io_object().
Detected with gcc -Wuninitialized
2005-06-02 11:09:02 +00:00
lukem f1ce52a40f Don't attempt to close a random file descriptor.
Detected with gcc -Wuninitialized.
2005-06-02 05:45:59 +00:00
lukem 8fe660271c Ensure name_str is initialized because we try to free it later.
Detected with gcc -Wuninitialized.
2005-06-02 05:33:01 +00:00
lukem edd6967461 Sanity checking. Detected with gcc -Wuninitialized 2005-06-02 05:30:12 +00:00
christos 9ab78e153b use /dev/bpf 2004-12-01 23:45:12 +00:00
christos aad48c44a7 One bpf is enough. 2004-12-01 23:23:39 +00:00
christos be07a6cfdb One bpf is enough 2004-12-01 23:22:42 +00:00
dsl cfe7f80ff0 Add (unsigned char) cast to ctype functions 2004-10-29 20:51:11 +00:00
perry 808ab1197e Use packet length from IP header instead of packet length from BPF
header.
Patches given to me by Ted Lemon.
This avoids using potentially garbage data returned if the ethernet
driver returns a packet that's too long.
2004-10-22 05:22:39 +00:00
mellon ed5b9801d3 Don't log overly-long (>32 byte) client hostnames. 2004-06-11 19:54:02 +00:00
itojun 937e8b0fbe add O_TRUNC to open(2). revision 1.11 used fopen(foo, "w") which implies
truncation of opened file.  it should suppress bogus "corrupted lease file"
warning and broken dhclient.leases staying around.
2004-05-06 09:07:54 +00:00
darrenr 221fa57241 With recent changes to BPF, pushing the default buffer size to 1MB, running
a bunch of small daemons that seem small packet flows can easily chew up
significant kernel memory (each BPF device opened takes 2*buffersize of
wired memory.)  In each of these applications, add code to set the buffer
size to 32k before setting the interface.
2004-04-10 17:53:05 +00:00
nakayama 083eb7818c Use _LP64 to indicate 64-bit platform, per suggestion on source-changes@. 2004-04-05 13:06:23 +00:00
nakayama cf7c3ba713 s/__sparc_v9__/__sparc64__/
"gcc -m32 -mcpu=ultrasparc" defines __sparc_v9__, so __sparc64__ is
more appropriate to indicate a 64-bit environment.
2004-04-04 11:59:51 +00:00
mrg 8808c7e901 create the dhclient.leases file mode 600 for now as it may contain
"media" lines that contain wireless network keys, that eg, ifconfig(8)
carefully hides.

this is not a complete solution, but it's OK until one arrives.

approved by mellon@.  fixes the problem described in PR#22271.
2004-04-04 02:35:21 +00:00
mellon 47427353e5 Cut out some stuff that can't or shouldn't be defined in SMALL builds. 2004-04-02 22:53:15 +00:00
mellon 5bbdf02211 - If we find a lease in the lease file that matches a predefined lease,
and it's expiry time is earlier than the expiry on the predefined lease,
  don't nuke the predefined lease.
2004-03-31 19:05:18 +00:00
mellon 53b16d12a9 Document omapi port and omapi key 2004-03-30 20:05:01 +00:00
mellon 65489ae9e4 Add omapi key. 2004-03-30 19:41:35 +00:00
mellon 15943a0402 If an omapi key is configured, use it. 2004-03-30 19:40:58 +00:00
mellon 40a59b47b4 Add support for OMAPI KEY configuration. 2004-03-30 19:39:39 +00:00
mellon de4e43d0c5 - Add declarations for lhs_context and rhs_context. For some reason these
were missing from the diff between 3.0.1rc11 and 3.0.1rc12, so the previous
  commit didn't compile.   :'(
2003-10-27 21:08:25 +00:00
mellon 0f26f5c9ea - Apply patches from ISC DHCP 3.0.1rc12 to correct a parser bug that causes
the ISC DHCP server to fail to start when it is configured to use the
  ad-hoc DNS update mechanism.   This fixes PR#20460 and PR#23284 (once
  this is pulled up to the 1.6 branch).
2003-10-27 20:16:09 +00:00
mellon 5ec655da0e increase ttl - internet is getting big. 2003-10-24 05:30:33 +00:00
mellon dddda170ba Write the pid file twice, so scripts can kill client before it daemonizes. 2003-10-24 05:27:55 +00:00
mellon bc6c928df7 Attempt to fix a bug which throws away valid static leases
when parsing dhclient.leases. PR bin/9405.
2003-10-24 05:19:31 +00:00