summaryrefslogtreecommitdiff
path: root/sbin/dhclient
AgeCommit message (Collapse)Author
2014-04-17Oops. INADDR_ANY != INADDR_BROADCAST. Fixes DHCPDISCOVERY andKenneth R Westerback
DHCPDECLINE. noted by sthen@
2014-04-17Eliminate a couple of always-NULL parameters. Eliminate someKenneth R Westerback
pointless repetition of well-known info in log messages. Pass around smaller bits of info. Make 'inaddr_any' a const struct initialized with { INADDR_ANY }. Tweaks and ok guenther@
2014-04-16Make dhclient -q even quieter. Make it immediately effective ratherKenneth R Westerback
than possibly emitting a couple of random memory allocation error messages first. ok guenther@
2014-04-16OpenSSL is not the only place with bloated code! Remove unusedKenneth R Westerback
function 'option_as_string()'.
2014-02-18Do not create the default dhcp-client-identifier if an empty stringKenneth R Westerback
has been configured as the value. i.e. 'send dhcp-client-identifier "";' in dhclient.conf will result in no dhcp-client-identifier (option 61) being sent. Useful for testing dhcp server behaviour.
2014-02-13Hard looping on EAGAIN is bad. Just fall out to outer event loopKenneth R Westerback
when EAGAIN is encountered while trying to flush messages.
2014-02-09Don't use imsg_flush(), roll a local flush_unpriv_ibuf() that loopsKenneth R Westerback
on EAGAIN, sets quit to INTERNALSIG on errors (unless quit is already set to something else), and prints a consistant error message when errors other than EPIPE and end of file are encountered. Fixes failure to write resolv.conf when -L is used, and makes add_address() and add_route() also wait until imsg is in pipe.
2014-02-09Nuke a couple of extraneous blank lines.Kenneth R Westerback
2014-02-09Use correct function name in error message. 'cleanup' was renamedKenneth R Westerback
'sendhup' a while ago.
2014-02-09Missing {} around multi-statement else. Malformed IMSG_HUP messages shouldKenneth R Westerback
not cause privileged process to exit.
2014-02-08Create dhclient lease files and dhcpd lease files with permissions 0640,Kenneth R Westerback
rather than 0000 and 0664 respectively. ok kettenis@ tedu@
2014-02-07Create -L leases files with the same 0000 permissions as regularKenneth R Westerback
leases.IF files. Inconsistency pointed out by Jiri B.
2014-02-07Log failures to fchmod() or fchown() the file written inKenneth R Westerback
priv_write_file().
2014-02-07Nuke unused #define CLIENT_PATH. A remnant of dhclient-script.Kenneth R Westerback
2014-01-25Correct parsing of dhclient.conf statements 'fixed-address' andKenneth R Westerback
'next-server'. Modify new lease being cloned with their values rather than overwriting original lease being cloned.
2014-01-21Allow dhclient.conf to specify 'fixed-address', 'next-server',Kenneth R Westerback
'filename' and 'server-name'. dhclient.conf can now override anything in an offer or saved lease when creating the effective lease.
2014-01-21Add parsing for options 121 (classless-static-routes) and 249Kenneth R Westerback
(classless-ms-static-routes). dhcpd can now specify and serve these options and dhclient can recognize and use supersede, etc. statements on them. Based on a diff from Stefan Rinke. Thanks!
2014-01-20Preserve tabs when constructing the "^" line in parse_warn(). NowKenneth R Westerback
error messages line up the "^" correctly even when tabs are present.
2014-01-20more %d type correctness; ok krwTheo de Raadt
2014-01-20%d cleanups, to other formats; ok krwTheo de Raadt
2014-01-20Don't silently skip the next statement when encountering anKenneth R Westerback
invalid IP in a reject statement.
2014-01-20Cast pointer to (u_int8_t *) when assigning it to a u_int8_t *Kenneth R Westerback
variable.
2014-01-19We don't have any (and I can't find elsewhere) signed 16 bit orKenneth R Westerback
signed 8 bit dhcp option types. So nuke getShort() and all 's' and 'b' format support. While here use '%u'/'%lu' and not '%d'/'%ld' to snprintf() unsigned values.
2014-01-19Nuke unused functions putLong(), putUShort(), putShort().Kenneth R Westerback
2014-01-19Redo the parsing of numbers to improve the error messages andKenneth R Westerback
make the code more readable. And prepare for some new things that will need to be parsed. ok dlg@
2014-01-19Rename parse_hardware_param() to parse_ethernet() to reflect whatKenneth R Westerback
it actually does.
2014-01-19Adjust lexchar position by ugflag once only.Kenneth R Westerback
2014-01-18If ugflag (indicating a character from the file being parsed has beenKenneth R Westerback
unget()'ed) is set, then properly set the lexchar position back one in get_token() so more error messages put the '^' in the proper spot.
2014-01-18Remove superfluous assignment to local variable 'val' just beforeKenneth R Westerback
exiting.
2014-01-18Make parse_warn() messages consistantly use 'expecting' ratherKenneth R Westerback
than occasionally 'expected'. End all with a '.'.
2014-01-18Never silently consume the following statement when unexpectedlyKenneth R Westerback
encountering a ';'. I.e. when checking the token type, 'skip_to_semi()' after 'parse_warn()' only when the parsed token wasn't a ';'.
2014-01-17Do not follow symlinks for -l and -L arguments.Tobias Stoeckmann
ok krw@
2014-01-17Make parse_X return -1 when it encounters a parsing error. EnablesKenneth R Westerback
recognition of zero length value vs parsing error. This lets us avoid the erroneous consumption of the semicolon ending the 'X' value, and the resulting accidental consumption of the following line in the file being parsed.
2014-01-16Avoid size_t overflow while reading /etc/resolv.conf.tail.Tobias Stoeckmann
ok krw
2014-01-13peek_token() a bit more to replace a bunch of manual checks withKenneth R Westerback
the perfectly adequate parse_semi(). And some blocks didn't even need to peek.
2014-01-13Don't eat another token looking for a ';' after skip_to_semi() hasKenneth R Westerback
been invoked. Fixes silent loss of the statement following a broken or inapplicable 'interface' declaration in a lease, or an unrecognized lease attribute.
2014-01-13No need to 'clear the peek buffer' when closing a file. The nextKenneth R Westerback
file opener will call new_parse() to initialize that amoung other things. Nuke extraneous blank line in passing.
2014-01-13Don't eat two tokens when encountering a non-terminal '}'. AvoidsKenneth R Westerback
possibly ignoring entire rest of dhclient.conf or dhclient.leases.if looking for a mistakenly consumed '}'.
2014-01-13warning(), note(), debug(), parse_warn() always return 0, which noKenneth R Westerback
caller checks or saves. So just void them all.
2014-01-12Since the return value of read_client_conf() is not checked, don'tKenneth R Westerback
bother returning one.
2014-01-10Yet another annoyingly long line.Kenneth R Westerback
2014-01-10skip_to_semi() is gilding the lily when the next statement breaks outKenneth R Westerback
of the loop and closes the file being parsed. And the previous statement warns the user the leases file being parsed has been determined to be corrupt. Eliminate further gilding in the form of an 'else' after the same 'if' clause includes the 'break'.
2014-01-10KNF (UNF?). Split annoying long line.Kenneth R Westerback
2013-12-30Replace yet another hand-rolled list with a TAILQ. reject_list thisKenneth R Westerback
time.
2013-12-28Remove unused variable 'token'. Spotted by deraadt@Kenneth R Westerback
2013-12-22Setting format id to 't' when it's already 't' is a waste ofKenneth R Westerback
time.
2013-12-22No need to change format id 'X' (ascii or hex) to 'x' (hex) whileKenneth R Westerback
pretty printing, when 'X' is not used in the next switch statement. Just keep 'X'. Makes the code a touch less mysterious.
2013-12-22Don't look for two semi-colons when encountering an unrecognizedKenneth R Westerback
statement in dhclient.conf.
2013-12-21Introduce pretty_print_string() and use for printing both textKenneth R Westerback
valued options and previously snprintf()'d filename and servername lease attributes. Should fix "string constant too long" errors when reading back a lease with filename or servername attributes with escaped characters. Reported by Rivo Nurges.
2013-12-18Code existed to print non-printable characters in strings writtenKenneth R Westerback
to the leases file. No code existed to correctly read back the strings so written. Redo both sides and use vis()/strnunvis() instead of handrolling more parsing. As a side-effect allow embedded NUL characters rather than skipping them.