summaryrefslogtreecommitdiff
path: root/sbin/dhclient
AgeCommit message (Collapse)Author
2007-01-27We only poll on the bpf fd and the routing socket fd. No need forKenneth R Westerback
complex list code to keep track. So nuke it. Also eliminate unnecessary variable ('dead') that means 'rfdesc is closed'. Just set rfdesc to -1 when it is closed and use that. As suggested by millert@ and claudio@, don't bother setting revents members to zero since poll() does that. Np functional change, just less code. 'looks good' claudio@ 'I like where this is going' henning@
2007-01-25Cleanup some more code. Eliminate dhcp(), bootp(), parse_options() byKenneth R Westerback
moving the minimal code into do_packet(). Eliminate repeated code for checking the client hardware address and the reject list by putting those checks into do_packet as well. No functional change, just much easier to read. ok stevesk@
2007-01-16More cleanup. Eliminate 'struct packet' by cleverly passing asKenneth R Westerback
parameters just those things actually needed and using existing structs and information. No functional change. ok stevesk@
2007-01-14Don't treat any packet with an invalid option buffer or an invalidKenneth R Westerback
message type option of 0 as a BOOTP offer. Don't process any option buffer after one is found to be corrupt. Don't process overflow buffers in a BOOTP packet. At least try to accept DHCP offers even if a bad options buffer is encountered. Brings code more into line with current ISC dhclient. ok stevesk@
2007-01-11Since bootp_packet_handler is always set to do_packet before weKenneth R Westerback
process any packets, eliminate that abstraction and just call do_packet directly. No functional change. ok stevesk
2007-01-11remove unused #define DHCP_MIN_LENKevin Steves
2007-01-11Reject all packets with an option claiming to extend past the end ofKenneth R Westerback
an option buffer. No longer accept the 6th such packet. From ISC. ok ckuethe@ stevesk@
2007-01-08Don't leak strings.Kenneth R Westerback
ok miod@
2007-01-08Initialize incoming packet buffer with DHO_END (0xff) rather thanKenneth R Westerback
DHO_PAD (0x00) so that option scanning will terminate on hitting initialized data rather than scanning and ignoring trailing DHO_PAD characters. Suggested by & ok stevesk
2007-01-06Fix options parsing. Last commit lost the proper length of theKenneth R Westerback
incoming packet. But since we bzero() the packet buffer before copying the incoming data into it, and the options are at the end, and we use a fixed sized buffer, and 0's are ignored as pad options, and proper option lists end with 0xff, it's simplier to always try to scan the whole buffer. Problem found by, and patch tested by kettenis@.
2007-01-04Eliminate the 'len' parameter from send_packet() since it alwaysKenneth R Westerback
contains the global value client->packet_length. Use client->packet_length. No functional change. Suggested by stevesk@.
2007-01-04Another round of cleanup. There is only one instance of structKenneth R Westerback
dhcp_packet and it is contained in the global *client. So don't pass around pointers to a struct that contains a pointer to the dhcp_packet instance. Just use the global client->packet. Eliminate unused struct packet members and parameter lists accordingly. No functional change. Suggestions by stevesk@. ok stevesk@
2007-01-04<sys/un.h> not neededKevin Steves
2006-12-28please lintTheo de Raadt
2006-12-28parenthesis not needed here; consistent with usage in other areas.Kevin Steves
no binary change.
2006-12-28small knf (extra space, newline)Kevin Steves
2006-12-28no extra "\n" in note(); ok krw@ henning@Kevin Steves
2006-12-27Since we only have the single global struct interface_info, weKenneth R Westerback
obviously have single global struct client_state and struct client_config nested inside interface_info and client_state respectively. Pull them out to their own global variables and eliminate a bunch (i.e. hundreds) of multi-level dereferences. Make it much nicer to read. No functional change. "makes sense" henning@ Testing stevesk@, ok stevesk@
2006-12-26Our dhclient only handles one interface. Simplify code by using theKenneth R Westerback
single, global, instance of 'struct interface_info' (ifi) rather than passing around pointers to it. "I agree" henning@ Testing moritz@ stevesk@, ok stevesk@
2006-12-26There must be no alias address set, so check ifi->client->aliasMoritz Jodeit
for NULL before dereferencing it. OK henning@ krw@ deraadt@
2006-12-22delete prototypes for functions that don't existKevin Steves
2006-12-18remove statement for send parameter: "except that the client canKevin Steves
specify a dhcp-lease-time option other than the default requested lease time, which is two hours". we don't by default send a dhcp-lease-time option in request/discover. ok jmc@, henning@ 'if you are sure'
2006-12-18this is clearer and consistent with other areas; ok henning@Kevin Steves
2006-12-17remove ASSERT_STATE() macro which is a NOOP, no binary change; ok henning@Kevin Steves
2006-12-17fix commentKevin Steves
2006-12-16make /sbin/dhclient-script consistent with other paths; ok henning@Kevin Steves
2006-12-15KNFKevin Steves
2006-12-15typo in commentKevin Steves
2006-11-27correct commentKevin Steves
2006-11-27Recognize when we are sending to a unicast destination IP address andKevin Steves
instead of using BPF, which currently will always set the destination MAC to broadcast, send using a SOCK_RAW socket and sendmsg() so the frame has a unicast destination MAC. Fixes an issue when using a bootp forwarder where unicast DHCPREQUESTs are dropped at the router/gateway until we reach T2/REBINDING and change the destination IP to broadcast. ok henning@ (but doesn't like using a raw socket for this)
2006-11-27remove invalid commentKevin Steves
2006-11-22sync dhclient and dhcpd parse.c areas where we can.Kevin Steves
mainly formatting, whitespace; ok henning@
2006-11-22fix some warning messages and comments in parse_date(); ok henning@Kevin Steves
2006-11-21remove spurious ; after bracket, no binary changeKevin Steves
2006-11-21remove unused #defines, no binary change; ok henning@Kevin Steves
2006-11-21re-order includes and eliminate duplicates, no binary change; ok henning@Kevin Steves
2006-09-24No point in checking for a NULL ifi after we've used it. Plus ifi isKenneth R Westerback
set once in main() and used everywhere without further checks. From Matthew R. Dempsky via tech@
2006-08-31adjust link detection further: if no link, bring interface up and checkTheo de Raadt
for link for 10 seconds. otherwise, if there was link, no problem! ok henning, claudio, tested by others
2006-08-29snuck in a typo, damnitTheo de Raadt
2006-08-29some net if devices do not media negotiate (for link) until brought up.Theo de Raadt
(for some drivers, this is a bug. for others, it is part of how they work) therefore before doing the 10-second link test, we must bring the if up. ok krw, tested marco ckuethe
2006-06-16always change the working directory of the priv child to the rootReyk Floeter
directory ("/"). this fixes a problem when dhclient was called in a working directory like "/mnt" and the user tried to unmount this directory while dhclient was still running. umount failed because the device for "/mnt" was still busy and blocked by the running priv child of dhclient. ok henning@
2006-06-03Use ifconfig delete/alias conforming with the man page.Marco Pfatschbacher
OK krw@
2006-06-02backoff-cutoff defaults to 15 seconds; ok henning@Kevin Steves
2006-06-01'-alias' is deprecated. Use 'delete' in ifconfig statements.Kenneth R Westerback
ok beck@
2006-06-01Don't treat the addition of a dhclient.conf 'alias{}' address as anKenneth R Westerback
external modification when the RTM_NEWADDR message arrives from the routing socket. Now dhclient will not exit if 'alias{}' is specified in dhclient.conf. Mentioned many times, most recently by Matthias Bertschy on misc@. ok henning@ beck@
2006-05-31clarify link-timeout default as seconds; ok jmc@Kevin Steves
2006-05-31Fix 'special value 0 requests that dhclient not wait for a link stateKevin Steves
change before timing out' behaviour of the man page for link-timeout; ok deraadt@ henning@
2006-05-15whitespace cleanupFelix Kronlage
ok claudio@, mbalmer@
2006-05-09new sentence, new line;Jason McIntyre
2006-05-09spellingTheo de Raadt