summaryrefslogtreecommitdiff
path: root/sbin
AgeCommit message (Collapse)Author
2017-07-14Replace remaining "!var" expressions withKenneth R Westerback
"<var> == 0", "!(<var> & FLAG)" with "(<var> & FLAG) == 0", "!<func()>" with "<func()> == 0" and "!<define>" with "<define> == 0". And the positive cases as well. A few stray == NULL and != NULL as well.
2017-07-14Replace remaining "!<pointer>" expressions withKenneth R Westerback
"<pointer> == NULL". And of course "<pointer>" expressions with "<pointer> != NULL".
2017-07-14Pour the few relevant bits of the current lease and the offeredKenneth R Westerback
renewal lease into canonical forms and compare those rather than the leases themselves. Eliminates spurious interface and route manipulation when irrelevant aspects of the leases are changed by the DHCP server. Problem found by Paul de Weerd when his DHCP server returned renewed leases differing only by a decremented dhcp-lease-time option. ok mpi@
2017-07-14bpf(4) *may* deliver more than one captured packet at a time. So whenKenneth R Westerback
the bpf socket signals that it has data, call packethandler() in a loop until no more bpf packets are available.
2017-07-14run IMSG_UPDATE_IF through the main process, reduces upcomming diffFlorian Obser
for RFC 7217 support
2017-07-10remove misc. depend and yacc nits that no longer matter.Marc Espie
okay millert@
2017-07-10zap depend ghost.Marc Espie
add a comment explaining why keywords.h is in the source tree even though it's exactly what keywords.sh generates, so that people don't try adding the generating rule again. okay millert@
2017-07-10Take some of the mystery out of who does what byKenneth R Westerback
renaming "if_register_bpf()" to "get_bpf_sock()", "if_register_send()" to "get_udp_sock()" and "if_register_receive()" to "configure_bpf_sock()". Pull back interface_info knowledge and just pass the interface name, rdomain and bpf socket fd as required.
2017-07-10Use ioctlfd/routefd sockets rather than rolling one's ownKenneth R Westerback
for resolving 'egress' and adding a route. Move creation of main()'s ioctlfd up so it can be used for the 'egress' resolution.
2017-07-10Use a modern spacious idiom on all function local variableKenneth R Westerback
declarations.
2017-07-09Be consistent. "return (e);" -> "return e;"Kenneth R Westerback
2017-07-09remove redundant variable declarations in Makefiles, since those areMarc Espie
the default. okay millert@
2017-07-09Be consistent. "return (e);" -> "return e;"Kenneth R Westerback
2017-07-09Some parsing code cleanup: add parse_boolean(); pass literal formatKenneth R Westerback
chars to parse_decimal() instead of less obvious *fmt; refactor to eliminate need for the 'alloc:' and 'bad_flag:' labels and the invidious backwards goto's to them.
2017-07-09have bsd.prog.mk/bsd.lib.mk generate .y -> .c/.h rules without intermediateMarc Espie
files. This fixes up parallel builds in the default case. FreeBSD does something similar. okay millert@
2017-07-09Whitespace tweaks to assuage auto-indent.Kenneth R Westerback
2017-07-09Ignore prefixes with a pltime < ND6_PRIV_MAX_DESYNC_FACTOR secondsFlorian Obser
(512 in our case) for privacy addresses as per RFC 4941.
2017-07-09If we lower the pltime for privacy addresses skew it byFlorian Obser
ND6_PRIV_MAX_DESYNC_FACTOR like RFC 4941 tells us to. Toss in a arc4random_uniform for good measure like the kernel always did.
2017-07-08Fold tables.c into options.c and stop exporting the oneKenneth R Westerback
table (dhcp_options) involved. Provide functions code_to_name(), name_to_code(), code_to_format() and replace direct access to dhcp_options with them. Eliminate unneeded 'struct option'. Unhook tables.c from Makefile.
2017-07-08Consistently use if ((option & F_FOO) && (option & F_BAR)) instead ofFlorian Obser
if (option & F_FOO && option & F_BAR). Prompted by a reverse diff from Klemens Nanni. Both forms are equivalent due to operator precedence, I consider the later to be easier on the eyes.
2017-07-08Consistently use if (option & F_FOO); from Klemens Nanni, thanks!Florian Obser
2017-07-08Always use strcasecmp() when comparing user input to optionKenneth R Westerback
names, not just 2 out of 3.
2017-07-08Always use uintNN_t instead of sometimes u_intNN_tKenneth R Westerback
and sometimes uintNN_t.
2017-07-07Replace the many occurances of '256' with a new #defineKenneth R Westerback
DHO_COUNT.
2017-07-07dispatch_imsg() only needs to know name and rdomain.Kenneth R Westerback
No more struct interface_info knowledge in privsep.[ch]
2017-07-07assemble_eh_header() needs only to know about hw_addr.Kenneth R Westerback
No more struct interface_info knowledge in packet.c
2017-07-07Rename cons_options() to pack_options(), and do_packet() toKenneth R Westerback
unpack_options(). Store the unpacked options in a static variable. Move remaining raw packet processing from unpack_options() to packethandler(). No more struct interface_info knowledge in options.c
2017-07-06cons_options() only needs to know a buffer and a length toKenneth R Westerback
pack options into. Not all the gory details of interface_info. Move some of the raw packet processing out of options.c's do_packet() and into the more obvious dispatch.c's packethandler(). Mention that RFC791 is why we use 576-byte UDP packets.
2017-07-06Sprinkel in some #ifndef SMALL to make slaacd smaller for theFlorian Obser
installer. This removes the control socket handling which is useless because we won't have slaacctl in the installer. Also deraadt@ pointed out that this would be the first use of log.c in the installer where we don't have syslogd running so it's rather pointless. So this completely neuters logging. The log.h change doesn't interfere with benno@'s efforts of unifying log.c The installer version of slaacd won't even compile control.c and log.c
2017-07-06reorder imsg_type enum so that we can #ifndef SMALL all the controlFlorian Obser
related imsg types
2017-07-06move rpref enum definition up so that we can #ifndef SMALL a big blockFlorian Obser
2017-07-05Validate prefix information in router advertisements according to RFCFlorian Obser
4862 Section 5.5.3. This very likely solves the problem of slaacd generating privacy addresses at a very high rate as reported by Matthias Schmidt on bugs@; thanks! The problem is that we constantly generate new privacy addresses if we receive a router advertisement with a pltime of 0 since that address will immediately be deprecated. This needs revisiting since we will run into the same problem with other low pltimes.
2017-07-05Remove knowledge of struct interface_info from clparse.c. JustKenneth R Westerback
pass the interface name and the TAILQ to put static leases into. Add a TAILQ for static leases to struct client_config to hold the static leases until it's time to add them to ifi. Add add_lease() to add leases to a TAILQ while checking for leases that are superseded by the new lease.
2017-07-05remove useless (void)printf casts, diff from Klemens Nanni, massagedFlorian Obser
by me.
2017-07-04Revert back previous, pledge cannot be enabled on the privsep'd proc yet, atRicardo Mestre
least not as is Reported by tim@, OK deraadt@ to backout the pledge for now
2017-07-04calculate multiples of 4 smarter; from Klemens NanniFlorian Obser
2017-07-04replace perror(3) with err(3); from Klemens NanniFlorian Obser
2017-07-03no need to generate y.tab.h if nothing uses it, set YFLAGS to nothingMarc Espie
instead of CLEANFILES += y.tab.h okay millert@
2017-07-03sizeof(struct sockaddr_in) != sizeof(struct in_addr).Kenneth R Westerback
Fix construction of the unicast UDP packets being sent out via sendmsg(). Accidentally broken in r1.32 (5.6) when types were juggled. ok bluhm@
2017-07-03s/log_warn/log_warnx/ where errno is not setFlorian Obser
2017-07-03Generate source and header files for regress on demand.Alexander Bluhm
OK espie@
2017-07-02Unbreak tree by putting revised resolv_conf_priority() declaration inKenneth R Westerback
correct place and passing the invocation the correct parameters. Noticed by & initial diff from matthieu@
2017-07-01Eliminate multiple socket openings/closings and passKenneth R Westerback
fd'd from main loops as required. One socket to do ioctl's per process (called ioctlfd) and one socket to do route messages per socket (called routefd). Clean up local variable declaration lists in passing.
2017-06-29Nuke undocumented long-deprecated and/or unsupported leaseKenneth R Westerback
fields 'hardware', 'alias', 'media', 'medium', 'ethernet'. Also remove now-unused parse_ethernet(). Making these parsing failures will smoke out anybody with leases or conf files from the last century.
2017-06-29delete_addresses(), interface_status(), addressinuse(),Kenneth R Westerback
lease_as_string() and rewrite_option_db() only use the interface name, so supply just the name. Tweak interface_link_forceup() to use the same param name as other functions taking the interface name.
2017-06-28reinstate .El removed in previous;Jason McIntyre
2017-06-28Only pass required fields of interface_info to priv_* functionsKenneth R Westerback
and friends. i.e. ifi->name, ifi->rdomain, or both.
2017-06-28delete_route() doesn't need any info from its struct interface_infoKenneth R Westerback
parameter as the route message already has the correct tableid. So eliminate the useless parameter.
2017-06-28resolv_conf_priority() is a function local to kroute.c, noKenneth R Westerback
need to expose its definition in dhcpd.h. While here change the parameter from struct interface_info to int and just pass the only field used (rdomain).
2017-06-28Stop trying to clean up addresses, routes and "-L" fileKenneth R Westerback
whenever dhclient dies. Eliminates differences in handling and thus need to intercept signals INT, TERM, USR1, USR2. Eliminates need for 'zapzombies' field and thus entire struct imsg_flushroutes. Eliminates need for 'imsg' parameter to and associated logic in priv_flush_routes(). Address, routes and '-L' file are still cleaned out when binding a lease.