OpenBSD CVS

CVS log for src/sbin/dhclient/kroute.c


[BACK] Up to [local] / src / sbin / dhclient

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.197 / (download) - annotate - [select for diffs], Sun Mar 28 17:25:21 2021 UTC (3 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, HEAD
Changes since 1.196: +3 -3 lines
Diff to previous 1.196 (colored)

Now that the real time and monotonic time streams don't
cross flip CLOCK_REALTIME to CLOCK_MONOTONIC.

Suggested by cheloha@, millert@, otto@ at various
stages in the time_t -> timespec conversion.

Revision 1.196 / (download) - annotate - [select for diffs], Thu Mar 4 10:56:47 2021 UTC (3 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.195: +2 -1 lines
Diff to previous 1.195 (colored)

Add sys/queue.h to the include list since imsg.h needs it. Currently
net/route.h pulls this is as a side-effect.
OK krw@

Revision 1.195 / (download) - annotate - [select for diffs], Wed Feb 24 16:18:59 2021 UTC (3 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.194: +2 -11 lines
Diff to previous 1.194 (colored)

Remove incomplete/incorrect connection with autoconf, clearing ground
for future attempts at making it more IPv6-like.

ok florian@

Revision 1.194 / (download) - annotate - [select for diffs], Mon Feb 1 16:29:22 2021 UTC (3 years, 4 months ago) by cheloha
Branch: MAIN
Changes since 1.193: +15 -10 lines
Diff to previous 1.193 (colored)

dhclient(8): default_route_index(): poll(2) -> ppoll(2)

Use ppoll(2) instead of poll(2) in default_route_index().  Using
ppoll(2) here forces us to use clock_gettime(2) to measure the
timeout, which is less error-prone than using time(3).

Part of a larger campaign in dhclient(8) to make "time stuff" more
accurate and robust.

Prompted by krw@.  Based on a diff from krw@.

ok krw@

Revision 1.193 / (download) - annotate - [select for diffs], Wed Nov 25 00:05:48 2020 UTC (3 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.192: +19 -11 lines
Diff to previous 1.192 (colored)

When processing proposed static routes (inc. default route) ignore
routes that are already present, neither deleting nor re-adding them.

Revision 1.192 / (download) - annotate - [select for diffs], Sat Nov 21 18:34:25 2020 UTC (3 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.191: +6 -2 lines
Diff to previous 1.191 (colored)

No need to update resolv.conf when renewing a lease does not result in any
configuration changges.

Revision 1.191 / (download) - annotate - [select for diffs], Thu Nov 19 22:30:19 2020 UTC (3 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.190: +4 -3 lines
Diff to previous 1.190 (colored)

Avoid spurious resolv.conf updates when

1) The RTM_PROPOSAL telling unwind(8) about DNS servers is seen.

2) The interface is in the process of getting a new or renewed lease.

3) The default route is not UP.

Edge cases discovered while debugging urtwn(4) link bouncing.

Revision 1.190 / (download) - annotate - [select for diffs], Wed Nov 18 16:31:47 2020 UTC (3 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.189: +18 -9 lines
Diff to previous 1.189 (colored)

Tweak debug messages around resolv.conf updating.

Take more care to only update resolv.conf when a default route
can be found with which to determine the responsible interface.

Revision 1.189 / (download) - annotate - [select for diffs], Fri Nov 6 21:15:41 2020 UTC (3 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.188: +26 -1 lines
Diff to previous 1.188 (colored)

Add some debug output showing the exact network configuration
changes that will be attempted after accepting a lease.

Verbiage enhancement suggested by jmc@.

Revision 1.188 / (download) - annotate - [select for diffs], Wed Jun 3 18:15:57 2020 UTC (4 years ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.187: +33 -60 lines
Diff to previous 1.187 (colored)

Simplify logic in add_route(), eliminating pointless code duplication and
improving clarity.

No intentional functional change.

Revision 1.187 / (download) - annotate - [select for diffs], Thu May 28 16:02:56 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.186: +2 -2 lines
Diff to previous 1.186 (colored)

A few stray 'ifa' overloadings.

Revision 1.186 / (download) - annotate - [select for diffs], Thu May 28 15:45:10 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.185: +9 -9 lines
Diff to previous 1.185 (colored)

Reduce 'ifa' overloading by renaming some parameters 'address'.

Revision 1.185 / (download) - annotate - [select for diffs], Thu May 28 15:23:46 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.184: +4 -4 lines
Diff to previous 1.184 (colored)

Reduce 'ifa' overloading by renaming proposal field from 'ifa' to
'address'.

Revision 1.184 / (download) - annotate - [select for diffs], Tue May 26 23:42:11 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.183: +5 -3 lines
Diff to previous 1.183 (colored)

Wrap some overly long lines.

Revision 1.183 / (download) - annotate - [select for diffs], Thu May 21 12:31:02 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.182: +39 -40 lines
Diff to previous 1.182 (colored)

Rename various parameters and variables to eliminate misleading
allusions to 'rtstatic'.

Revision 1.182 / (download) - annotate - [select for diffs], Thu May 21 01:07:52 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.181: +8 -6 lines
Diff to previous 1.181 (colored)

extract_classless_route() -> extract_route() as there is only the one route
extraction function.

Revision 1.181 / (download) - annotate - [select for diffs], Thu May 21 00:22:37 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.180: +5 -5 lines
Diff to previous 1.180 (colored)

Rename route_in_rtstatic() to route_pos() to more clearly reflect its
current usage.

Revision 1.180 / (download) - annotate - [select for diffs], Wed May 20 23:54:53 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.179: +2 -3 lines
Diff to previous 1.179 (colored)

Remove no longer necessary RTLEN.

Revision 1.179 / (download) - annotate - [select for diffs], Wed May 20 23:47:23 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.178: +2 -2 lines
Diff to previous 1.178 (colored)

Fix typo in comment.

Revision 1.178 / (download) - annotate - [select for diffs], Wed May 20 19:13:34 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.177: +13 -13 lines
Diff to previous 1.177 (colored)

Rename proposal{} fields rtstatic_len, rtsearch_len and rtdns_len to
routes_len, domains_len, ns_len. Removes obsolete alignment with
names of RTM_PROPOSAL fields and makes code easier to read.

No intentional functional change.

Revision 1.177 / (download) - annotate - [select for diffs], Wed May 20 18:27:16 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.176: +28 -10 lines
Diff to previous 1.176 (colored)

Replace fixed 128-byte fields for search domains, static routes and
domain name servers with variable sized uint8_t chunks.

Allows larger lists of search domains and static routes while making
common situations use much less memory.

Original report of breaching the 128-byte limit for static routes from
James Cook via misc@.

Testing of various versions by Andreas Kusalananda.

Revision 1.176 / (download) - annotate - [select for diffs], Tue May 19 17:59:47 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.175: +19 -25 lines
Diff to previous 1.175 (colored)

Eliminate imsg_propose{}, imsg_revoke{} and imsg_tell_unwind{} as
unnecessary wrappers, since they all contained a single field that
could be used as is.

Suggested by claudio@

Revision 1.175 / (download) - annotate - [select for diffs], Fri May 15 11:14:00 2020 UTC (4 years ago) by krw
Branch: MAIN
Changes since 1.174: +2 -2 lines
Diff to previous 1.174 (colored)

Be more careful in extracting the uint16_t value of interface-mtu, and
in printing the int field we store it in. i.e. '%d' not '%u.

Discovered while tracking down breakage reported by Andreas Kahari on
bugs@.

Revision 1.174 / (download) - annotate - [select for diffs], Sat May 9 16:46:22 2020 UTC (4 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.173: +44 -80 lines
Diff to previous 1.173 (colored)

Shuffle and clarify logic creating the contents of resolv.conf.

No intentional functional change.

Revision 1.173 / (download) - annotate - [select for diffs], Fri May 8 19:00:19 2020 UTC (4 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.172: +2 -2 lines
Diff to previous 1.172 (colored)

Nuke unneeded 'inits' field in struct proposal. 'mtu' being 0 is enough of a clue
to avoid setting interface mtu.

Revision 1.172 / (download) - annotate - [select for diffs], Fri Nov 22 22:45:52 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.171: +8 -13 lines
Diff to previous 1.171 (colored)

Polish logic talking to unwind.

ok florian@

Revision 1.171 / (download) - annotate - [select for diffs], Fri Nov 22 15:32:42 2019 UTC (4 years, 6 months ago) by florian
Branch: MAIN
Changes since 1.170: +9 -5 lines
Diff to previous 1.170 (colored)

DNS Proposals are treated as replacements in unwind now.
To withdraw a proposal sent an empty list of nameservers.
This one is a bit of a hack by me to keep everything in sync for now.
A better version from krw is coming soon.

Revision 1.170 / (download) - annotate - [select for diffs], Tue Nov 19 14:35:08 2019 UTC (4 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.169: +70 -1 lines
Diff to previous 1.169 (colored)

Inform unwind about DNS servers it finds in leases.

ok florian@

Revision 1.169 / (download) - annotate - [select for diffs], Wed Nov 6 11:34:37 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.168: +14 -3 lines
Diff to previous 1.168 (colored)

Correct the logic deciding when to write resolv.conf.

Fixes switching back to wifi relevant resolv.conf when wired interface
loses link.

Revision 1.168 / (download) - annotate - [select for diffs], Thu Oct 31 16:39:09 2019 UTC (4 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.167: +26 -10 lines
Diff to previous 1.167 (colored)

Constrain and correct the routes being deleted when applying a new
lease. Constrain by only looking at static routes, which are the only
kind dhclient will add.  Correct by realizing direct /32 routes in the
lease look different when returned from the routing table.

Further correct route comparison by applying appropriate netmask to
both destination addresses before comparing them.

Fixes "arpresolve: ... route contains no arp information" issue
reported on bugs@.

Much problem analysis and fix testing by Lauri Tirkkonen. Thanks!

Revision 1.167 / (download) - annotate - [select for diffs], Thu Aug 1 15:52:15 2019 UTC (4 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.166: +2 -1 lines
Diff to previous 1.166 (colored)

Don't leak resolv.conf contents.

Revision 1.166 / (download) - annotate - [select for diffs], Tue Jul 30 12:48:27 2019 UTC (4 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.165: +9 -1 lines
Diff to previous 1.165 (colored)

Use AUTOCONF4 flag. Set the flag on startup. But if the flag is
subsequently reset by ifconfig(8) then stop applying leases. If the
flag is set after being reset then get a new lease and carry on.

Clean up man page verbiage and add AUTOCONF4 description.

ok benno@, man page formatting ok ingo@

Revision 1.165 / (download) - annotate - [select for diffs], Fri Jul 26 14:36:26 2019 UTC (4 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.164: +4 -3 lines
Diff to previous 1.164 (colored)

Whitespace tweak, fold long line.

Revision 1.164 / (download) - annotate - [select for diffs], Sun Jun 30 19:19:08 2019 UTC (4 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.163: +2 -2 lines
Diff to previous 1.163 (colored)

getifaddrs() returns -1.

Change fatal() to fatalx() where errno has not been set.

Revision 1.163 / (download) - annotate - [select for diffs], Fri May 17 20:42:44 2019 UTC (5 years ago) by krw
Branch: MAIN
Changes since 1.162: +10 -4 lines
Diff to previous 1.162 (colored)

Don't put dhclient into a loop when interface-mtu is present
in a lease.

dhclient.c r1.634 made every RTM_IFINFO restart the DHCP protocol
and obtain a new/renewed lease. If the lease contained
interface-mtu the interface MTU was set. An RTM_IFINFO is
generated every time an interface MTU is set.

So only set the interface MTU if it is different from the
existing MTU. Fix using %d to print an unsigned value in passing.

Noticed and fix inmproved & tested by Bj??rn Ketelaars while
usihg the wifi on Dutch Railways.

Revision 1.162 / (download) - annotate - [select for diffs], Fri May 10 16:51:13 2019 UTC (5 years, 1 month ago) by benno
Branch: MAIN
Changes since 1.161: +26 -10 lines
Diff to previous 1.161 (colored)

Make it possible to switch between wireless and physical interfacs
(again?): when adding the default route, set it with the interface
address of the interface we are configuring. This way its possible to
have two default routes (from two running dhclient processes) in the
routing table. Since wireless interfaces have a higher prio value,
when a physical interface is connected it will be prefered (for new
connections).
ok krw@ mumble yes mumble claudio@

Revision 1.161 / (download) - annotate - [select for diffs], Sat Feb 23 13:37:34 2019 UTC (5 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.160: +2 -2 lines
Diff to previous 1.160 (colored)

Correct comment on delete_addresses() return value.

Revision 1.160 / (download) - annotate - [select for diffs], Sat Feb 23 13:24:19 2019 UTC (5 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.159: +14 -10 lines
Diff to previous 1.159 (colored)

Restore pre-a2k19 behaviour of clearing out all existing addresses
when setting new address.

That change needs specific consideration rather than inadvertant
inclusion, especially after claiming no functional change was
being made.

Change and related problems noted and reversion tested by Kurt
Mosiejczuk.

Revision 1.159 / (download) - annotate - [select for diffs], Tue Feb 12 16:50:44 2019 UTC (5 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.158: +542 -476 lines
Diff to previous 1.158 (colored)

Restructure code to simplifiy imsg communications, further separating
DHCP knowledge and interface manipulation.

Unprivileged process now sends proposal derived from the accepted
lease to the privileged process rather than individual interface
manipulation requests.

The only intended functional change is that /etc/resolv.conf.tail is
not re-read each time a new proposal is implemented, rather than once
at dhclient startup.

Revision 1.158 / (download) - annotate - [select for diffs], Sat Jan 26 23:14:36 2019 UTC (5 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.157: +2 -2 lines
Diff to previous 1.157 (colored)

Zap trailing space that stuck its head up.

Revision 1.157 / (download) - annotate - [select for diffs], Thu Jan 10 14:49:07 2019 UTC (5 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.156: +2 -2 lines
Diff to previous 1.156 (colored)

"AF_* values are *almost* always the correct choice, particularly with
POSIX APIs".

Also sprach guenther@. So switch PF_ROUTE to AF_ROUTE in socket() and
setsockopt() calls. Keep PF_ROUTE in sysctl(2) uses. adding a comment
for future visitors,

Also replace PF_UNSPEC with 0 in socketpair(), as socketpair(2) points
out this is the only sensible value.

Cluebat from and ok guenther@

Revision 1.156 / (download) - annotate - [select for diffs], Wed Jun 13 01:37:54 2018 UTC (6 years ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.155: +20 -9 lines
Diff to previous 1.155 (colored)

Add a cloning direct route to the default route gateway when the
gateway is not reachable via the IP address/netmask provided by the
lease. Allows OpenBSD to work as well as iOS in certain
weird/misconfigured/overly clever hotspots.

A generalization of the handling of the /32 addresses handed out by
Goggle Cloud, suggested by claudio@

Error in initial diff pointed out by henning@.

Feedback from job@, mpi@, kn@.

Tweaks & ok claudio@

Revision 1.155 / (download) - annotate - [select for diffs], Tue Feb 6 00:25:09 2018 UTC (6 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.154: +6 -2 lines
Diff to previous 1.154 (colored)

Flip -q (be quiet) into -v (be noisy), making terseness the default
behaviour.

Always go daemon after link_timeout seconds and complete lease
negotiations in the background if necessary. No hanging around in the
foreground for the full 64 seconds waiting for a server to appear.

Log a more relevant message when a default route can't be obtained via
RTM_GET. i.e. "no default route" rather than "No such process".

-q -> -v ok mpi@

Revision 1.154 / (download) - annotate - [select for diffs], Mon Oct 23 13:31:35 2017 UTC (6 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.153: +2 -2 lines
Diff to previous 1.153 (colored)

Use 'for (;;)' instead of a mix of "while (1) {}" and
"do {} while (1)".

Revision 1.153 / (download) - annotate - [select for diffs], Wed Sep 20 19:21:00 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.152: +3 -4 lines
Diff to previous 1.152 (colored)

Tweak, shorten, use more consistant verbiage.

Revision 1.152 / (download) - annotate - [select for diffs], Wed Sep 20 18:28:14 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.151: +23 -24 lines
Diff to previous 1.151 (colored)

Make log messages more informative by using the
name of the function that failed and the significant
parameters. Distinguish between poll() errors and
problematic revents values.

Revision 1.151 / (download) - annotate - [select for diffs], Wed Sep 20 16:34:29 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.150: +4 -4 lines
Diff to previous 1.150 (colored)

Use consistant simple verbiage when SIOC* ioctl's fail.

Revision 1.150 / (download) - annotate - [select for diffs], Wed Sep 20 16:09:42 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.149: +3 -2 lines
Diff to previous 1.149 (colored)

Wrong captilization, long lines.

Revision 1.149 / (download) - annotate - [select for diffs], Sun Sep 17 21:20:23 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.148: +34 -27 lines
Diff to previous 1.148 (colored)

Create global 'log_procname' and set it to '<ifname>' or
'<ifname> [priv]' as appropriate for the process doing the
setting. Use it as the prefix in all log_*() output. Makes
tracking messages for an interface or a process much easier.

Revision 1.148 / (download) - annotate - [select for diffs], Fri Sep 15 15:22:14 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.147: +45 -27 lines
Diff to previous 1.147 (colored)

Use a poll() loop when trying read the default route from
a routing socket. Fixes at least one cause of resolv.conf
confusion and possibly hanging/looping dhclient if the
RTM_GET gets lost.

Fingered by phessler@ when doing many suspend/resumes
while switching between wifi and wired interfaces.

Testing & ok phessler@

Revision 1.147 / (download) - annotate - [select for diffs], Thu Sep 14 00:10:17 2017 UTC (6 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.146: +6 -6 lines
Diff to previous 1.146 (colored)

Strive to rationalize fatal[x]() usage and
verbiage.

Revision 1.146 / (download) - annotate - [select for diffs], Sat Sep 9 15:07:59 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.145: +22 -17 lines
Diff to previous 1.145 (colored)

Tweak extract_classless_route() to return unsigned int
and accept NULL pointers for unwanted components of
the route.

Revision 1.145 / (download) - annotate - [select for diffs], Fri Sep 8 13:49:00 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.144: +17 -15 lines
Diff to previous 1.144 (colored)

Tweak route_in_rtstatic() to return the position of the
route if found. Cleans up some int vs unsigned int
confusion and makes the function more generally useful
for future changes.

Revision 1.144 / (download) - annotate - [select for diffs], Thu Aug 31 17:01:48 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.143: +72 -7 lines
Diff to previous 1.143 (colored)

Don't delete v4 routes that are going to be
added back.

ok mpi@

Revision 1.143 / (download) - annotate - [select for diffs], Tue Aug 29 13:21:30 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.142: +33 -22 lines
Diff to previous 1.142 (colored)

Add a utility function extract_classless_route() and
use it to simplify logic at both places that process
RFC 3442 data.

Revision 1.142 / (download) - annotate - [select for diffs], Sat Aug 26 18:52:56 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.141: +5 -9 lines
Diff to previous 1.141 (colored)

Since we no longer try to uniquely label routes added
by dhclients, there is no need to retry adding a route
if the first attempt fails with EEXIST. And EUNREACHABLE
should be considered final since the address if any is
already configured.

Use log_getverbose() to allow logging of EEXIST errors.

Revision 1.141 / (download) - annotate - [select for diffs], Sat Aug 26 15:36:25 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.140: +2 -2 lines
Diff to previous 1.140 (colored)

Remove inadvertantly included param names in
get_rtaddrs() prototype.

Revision 1.140 / (download) - annotate - [select for diffs], Sat Aug 26 15:31:00 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.139: +6 -9 lines
Diff to previous 1.139 (colored)

Change currently unused populate_rti_info() with
the get_rtaddrs() everyone is using. Soon to be
used or deleted.

Revision 1.139 / (download) - annotate - [select for diffs], Fri Aug 18 15:06:11 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.138: +14 -11 lines
Diff to previous 1.138 (colored)

Truncating a file and then deciding not to change its
contents doesn't do what you think it does.

Restore "no dns servers, no search, means don't touch
resolv.conf" behaviour unintentionally changed at t2k17.

Noticed by ajacoutot@ during an upgrade using a
non-OpenBSD dhcpd server that only provides the
options it is asked for.

Revision 1.138 / (download) - annotate - [select for diffs], Mon Aug 14 22:12:59 2017 UTC (6 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.137: +5 -5 lines
Diff to previous 1.137 (colored)

Try for consistency in sizeof() usage.

No intentional functional change.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Aug 12 16:57:38 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.136: +25 -138 lines
Diff to previous 1.136 (colored)

Stop trying to outfox the routing table
by labelling dhclient routes. Just use
the route(8) logic when flushing routes.

ok benno@ claudio@

Revision 1.136 / (download) - annotate - [select for diffs], Thu Aug 10 17:15:05 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.135: +22 -16 lines
Diff to previous 1.135 (colored)

Add IMSG_SET_RESOLV_CONF and keep the cached contents
in the priv process, so that they do not have to be
continually retransmitted. IMSG_WRITE_RESOLV_CONF
now just triggers a write of the cached info.

Simplifies a bunch of logic.

Revision 1.135 / (download) - annotate - [select for diffs], Wed Aug 9 19:57:54 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.134: +1 -33 lines
Diff to previous 1.134 (colored)

Stop obsessively flushing the imsg connection. Just
flush any queued messages on getting a POLLOUT.

Revision 1.134 / (download) - annotate - [select for diffs], Tue Aug 8 17:54:24 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.133: +3 -3 lines
Diff to previous 1.133 (colored)

Rename resolv_conf_priority() to default_route_index() to
reflect what it does.

Revision 1.133 / (download) - annotate - [select for diffs], Tue Aug 8 17:20:09 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.132: +5 -3 lines
Diff to previous 1.132 (colored)

KNF some long lines.

Revision 1.132 / (download) - annotate - [select for diffs], Sun Aug 6 22:05:16 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.131: +12 -27 lines
Diff to previous 1.131 (colored)

Simplify logic seeking/checking the interface over
which the current default route exits.

If the dhclient instance owns that interface it
owns resolv.conf and will overwrite it no matter
who created the default route.

Feedback & suggestions claudio@

Revision 1.131 / (download) - annotate - [select for diffs], Sat Aug 5 13:39:17 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.130: +62 -46 lines
Diff to previous 1.130 (colored)

Factor out get_routes() to do the sysctl() dance
needed to get a set of routes.

Revision 1.130 / (download) - annotate - [select for diffs], Sat Aug 5 12:35:17 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.129: +59 -94 lines
Diff to previous 1.129 (colored)

Bring route creation into line with what route(8) does. In
particular stop providing RFA_IFA, and instead supply the
relevant interface index in the RTM_ADD message.

Various code simplifications as a result.

Revision 1.129 / (download) - annotate - [select for diffs], Sat Aug 5 12:08:33 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.128: +24 -11 lines
Diff to previous 1.128 (colored)

Don't delete the address/netmask that is about to be
added. Just skip both the delete and the add.

Revision 1.128 / (download) - annotate - [select for diffs], Fri Aug 4 00:10:14 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.127: +3 -3 lines
Diff to previous 1.127 (colored)

Do not attempt to parse zero'd input buffer after
read() on routing socket fails. Just bail.

Revision 1.127 / (download) - annotate - [select for diffs], Thu Aug 3 14:53:22 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.126: +5 -5 lines
Diff to previous 1.126 (colored)

Whitespace.

Revision 1.126 / (download) - annotate - [select for diffs], Thu Aug 3 00:33:07 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.125: +2 -2 lines
Diff to previous 1.125 (colored)

Flush static (RTF_STATIC) routes and not just
gateway (RTF_GATEWAY) routes. Thus catching and
flushing direct routes that could have been
added by dhclient.

Revision 1.125 / (download) - annotate - [select for diffs], Wed Aug 2 13:07:48 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.124: +1 -4 lines
Diff to previous 1.124 (colored)

Delete duplicated switch {} case: block.

Revision 1.124 / (download) - annotate - [select for diffs], Sun Jul 30 15:26:46 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.123: +29 -35 lines
Diff to previous 1.123 (colored)

Use effective_proposal data to build resolv.conf contents.

Fix a missing != NULL, and add a comment on why no search
path and no dns servers means resolv.conf.tail is ignored.

Revision 1.123 / (download) - annotate - [select for diffs], Sun Jul 30 14:05:41 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.122: +8 -12 lines
Diff to previous 1.122 (colored)

Use effective_proposal data to set mtu and address.

Revision 1.122 / (download) - annotate - [select for diffs], Sat Jul 29 15:07:47 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.121: +58 -58 lines
Diff to previous 1.121 (colored)

Default routes supplied via DHO_CLASSLESS[_MS]_STATIC_ROUTES
should have the same add_route() logic applied to them as
the one supplied via DHO_ROUTERS. i.e. add the /32 route
if needed, create direct route if gateway address is the
same as interface address.

Simplify logic by using the canonical rtstatic[] version
of static routes created by lease_as_proposal().

Revision 1.121 / (download) - annotate - [select for diffs], Thu Jul 27 12:52:58 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.120: +2 -2 lines
Diff to previous 1.120 (colored)

Kill extra whitespace that snuck in.

Revision 1.120 / (download) - annotate - [select for diffs], Thu Jul 27 12:45:06 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.119: +82 -113 lines
Diff to previous 1.119 (colored)

Fold add_direct_route(), add_default_route() and
add_classless_static_routes() into set_routes(). One
less layer of abstraction and all five add_route()
invocations now in one place.

Clearly comment the route(8) command equivalents for each
add_route() invocation.

Revision 1.119 / (download) - annotate - [select for diffs], Wed Jul 26 13:22:03 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.118: +7 -9 lines
Diff to previous 1.118 (colored)

Fix add_default_route() so -iface routes are actually
created when gateway == interface address.

Revision 1.118 / (download) - annotate - [select for diffs], Mon Jul 24 18:13:19 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.117: +2 -5 lines
Diff to previous 1.117 (colored)

Throw DHO_STATIC_ROUTES to the floor! Roughly! Ensure
they don't appear in effective leases at all.

Revision 1.117 / (download) - annotate - [select for diffs], Mon Jul 24 17:15:41 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.116: +3 -1 lines
Diff to previous 1.116 (colored)

Shuffle some declarations and functions into the only
files they are used in. Tweak a bunch of whitespace.

Revision 1.116 / (download) - annotate - [select for diffs], Mon Jul 24 13:51:43 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.115: +9 -3 lines
Diff to previous 1.115 (colored)

Move invocations of flush_routes() and delete_addresses() from
bind_lease() into set_routes() and set_address() respectively.

Revision 1.115 / (download) - annotate - [select for diffs], Mon Jul 24 11:00:01 2017 UTC (6 years, 10 months ago) by friehm
Branch: MAIN
Changes since 1.114: +3 -3 lines
Diff to previous 1.114 (colored)

Unify ROUNDUP macros for parsing route messages.
Use the macro from route(8) / ospf6d(8) since it works also with argument 0.

OK claudio@

Revision 1.114 / (download) - annotate - [select for diffs], Sun Jul 23 13:44:53 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.113: +3 -32 lines
Diff to previous 1.113 (colored)

Cease pretending to support option 33 (classFULL static routes). They
are dead to the internet. And the current code actually creates /32
routes since kernel magic for classfull routes died a while ago.

ok phessler@ claudio@ reyk@ sthen@

Revision 1.113 / (download) - annotate - [select for diffs], Sat Jul 22 17:55:20 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.112: +41 -2 lines
Diff to previous 1.112 (colored)

Add set_routes() and move bind_lease() route magic
into it. Swap parameter order in add_default_route() to
be consistant with other add_*_route() functions.

Revision 1.112 / (download) - annotate - [select for diffs], Sat Jul 22 14:56:27 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.111: +22 -11 lines
Diff to previous 1.111 (colored)

Rename *_add_address to *_set_address to reflect that the
lease address replaces all current addresses. Shuffle some
code from bind_lease() into set_mtu()/set_address() to
shrink  bind_lease().

Revision 1.111 / (download) - annotate - [select for diffs], Fri Jul 21 18:57:55 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.110: +9 -10 lines
Diff to previous 1.110 (colored)

s/set_interface_mtu/set_mtu/g

Revision 1.110 / (download) - annotate - [select for diffs], Mon Jul 17 17:53:59 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.109: +1 -10 lines
Diff to previous 1.109 (colored)

Nuke unused variables 'deleting' and 'adding'.

Revision 1.109 / (download) - annotate - [select for diffs], Fri Jul 14 16:21:03 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.108: +13 -13 lines
Diff to previous 1.108 (colored)

Replace remaining "!var" expressions with
"<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.

Revision 1.108 / (download) - annotate - [select for diffs], Fri Jul 14 14:03:15 2017 UTC (6 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.107: +2 -2 lines
Diff to previous 1.107 (colored)

Replace remaining "!<pointer>" expressions with
"<pointer> == NULL". And of course "<pointer>"
expressions with "<pointer> != NULL".

Revision 1.107 / (download) - annotate - [select for diffs], Mon Jul 10 14:11:47 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.106: +4 -9 lines
Diff to previous 1.106 (colored)

Use ioctlfd/routefd sockets rather than rolling one's own
for resolving 'egress' and adding a route. Move creation
of main()'s ioctlfd up so it can be used for the
'egress' resolution.

Revision 1.106 / (download) - annotate - [select for diffs], Mon Jul 10 00:47:47 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.105: +38 -36 lines
Diff to previous 1.105 (colored)

Use a modern spacious idiom on all function local variable
declarations.

Revision 1.105 / (download) - annotate - [select for diffs], Sun Jul 9 19:19:58 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.104: +13 -13 lines
Diff to previous 1.104 (colored)

Be consistent. "return (e);" -> "return e;"

Revision 1.104 / (download) - annotate - [select for diffs], Sun Jul 9 12:38:47 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.103: +3 -3 lines
Diff to previous 1.103 (colored)

Whitespace tweaks to assuage auto-indent.

Revision 1.103 / (download) - annotate - [select for diffs], Sat Jul 8 00:36:10 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.102: +6 -6 lines
Diff to previous 1.102 (colored)

Always use uintNN_t instead of sometimes u_intNN_t
and sometimes uintNN_t.

Revision 1.102 / (download) - annotate - [select for diffs], Sun Jul 2 09:11:13 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.101: +1 -2 lines
Diff to previous 1.101 (colored)

Unbreak tree by putting revised resolv_conf_priority() declaration in
correct place and passing the invocation the correct parameters.

Noticed by & initial diff from matthieu@

Revision 1.101 / (download) - annotate - [select for diffs], Sat Jul 1 23:27:56 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.100: +30 -60 lines
Diff to previous 1.100 (colored)

Eliminate multiple socket openings/closings and pass
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.

Revision 1.100 / (download) - annotate - [select for diffs], Thu Jun 29 13:55:53 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored)

delete_addresses(), interface_status(), addressinuse(),
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.

Revision 1.99 / (download) - annotate - [select for diffs], Wed Jun 28 16:31:52 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.98: +17 -19 lines
Diff to previous 1.98 (colored)

Only pass required fields of interface_info to priv_* functions
and friends. i.e. ifi->name, ifi->rdomain, or both.

Revision 1.98 / (download) - annotate - [select for diffs], Wed Jun 28 15:45:32 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.97: +6 -7 lines
Diff to previous 1.97 (colored)

delete_route() doesn't need any info from its struct interface_info
parameter as the route message already has the correct tableid. So
eliminate the useless parameter.

Revision 1.97 / (download) - annotate - [select for diffs], Wed Jun 28 15:23:19 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.96: +6 -4 lines
Diff to previous 1.96 (colored)

resolv_conf_priority() is a function local to kroute.c, no
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).

Revision 1.96 / (download) - annotate - [select for diffs], Wed Jun 28 14:35:43 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.95: +4 -31 lines
Diff to previous 1.95 (colored)

Stop trying to clean up addresses, routes and "-L" file
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.

Revision 1.95 / (download) - annotate - [select for diffs], Wed Jun 28 11:53:08 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.94: +4 -4 lines
Diff to previous 1.94 (colored)

Be consistent and always use socket(..., SOCK_DGRAM, ...) for
the sockets being used to issue ioctl()'s.

ok claudio@

Revision 1.94 / (download) - annotate - [select for diffs], Sun Jun 25 00:44:49 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.93: +1 -12 lines
Diff to previous 1.93 (colored)

priv_add_address() is no longer invoked to signal the deletion of the
active address. So no need to check for the magic INADDR_ANY address.

Revision 1.93 / (download) - annotate - [select for diffs], Sat Jun 24 23:32:57 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.92: +4 -4 lines
Diff to previous 1.92 (colored)

Tweak handling of HUP and new LLADDR. Just use expose and use sighup()
function. Don't exit dispatch() loop on SIGHUP, wait for privileged
child to execvp() dhclient. Eliminate struct imsg_hup since its
contents were not being used except in priv_cleanup(). And
'active_addr' works just as well there.

Cleaner and eliminates some extraneous log entries.

Revision 1.92 / (download) - annotate - [select for diffs], Fri Jun 23 15:40:56 2017 UTC (6 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.91: +7 -17 lines
Diff to previous 1.91 (colored)

Take reyk's imsg resolv.conf improvements of a while ago to their
logical conclusion.

Nuke _PATH_RESOLV_CONF since the value is only meant to be
known inside priv_write_resolv_conf(). Just use a local const char *.

Bring priv_write_resolv_conf() into line with other priv_ functions
invoked from the dispatch loop. i.e. don't pass it the imsg, just pass
a pointer to the data and a size after ensuring there is data to pass.

Revision 1.91 / (download) - annotate - [select for diffs], Wed Apr 12 12:22:25 2017 UTC (7 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.90: +21 -21 lines
Diff to previous 1.90 (colored)

Shuffle another function.

Revision 1.90 / (download) - annotate - [select for diffs], Tue Apr 11 13:59:27 2017 UTC (7 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.89: +324 -61 lines
Diff to previous 1.89 (colored)

Shuffle route/interface changing functions together into kroute.c. Try to
group related functions in kroute.c together and comment them a bit.

No intentional functional change.

Revision 1.89 / (download) - annotate - [select for diffs], Tue Apr 11 10:40:14 2017 UTC (7 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.88: +44 -1 lines
Diff to previous 1.88 (colored)

Fold priv_write_file() into its only remaining user
priv_write_resolv_conf() and move the latter into kroute.c
with all its priv_ friends.

No intentional functional change.

Revision 1.88 / (download) - annotate - [select for diffs], Sun Apr 9 20:44:13 2017 UTC (7 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.87: +3 -9 lines
Diff to previous 1.87 (colored)

Seven casts, a couple of tweaks and CFLAGS+=-Wsign-compare for the
win.

No intentional functional change.

Revision 1.87 / (download) - annotate - [select for diffs], Sat Apr 8 20:16:04 2017 UTC (7 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.86: +2 -3 lines
Diff to previous 1.86 (colored)

Reduce the overburden of signed vs unsigned comparisons by sprinkling
'int' -> 'unsigned int' (and visa versa) where obvious.

Steal a couple of 'unsigned' -> u_int32_t from reyk@'s dhcrelay
tweaks.

No intentional functional change.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Apr 5 18:22:31 2017 UTC (7 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.85: +1 -23 lines
Diff to previous 1.85 (colored)

Shuffle sendhup() into dispatch.c, the only place it is used.

Revision 1.85 / (download) - annotate - [select for diffs], Wed Mar 8 15:07:32 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.84: +4 -4 lines
Diff to previous 1.84 (colored)

Move ROUNDUP() to top of file, outside of warring #ifdef's to come.

Revision 1.84 / (download) - annotate - [select for diffs], Sun Feb 12 15:53:15 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.83: +27 -34 lines
Diff to previous 1.83 (colored)

Eliminate most strerror() invocations by using log_warn() and fatal()
instead of log_warnx() and fatalx(). A few log_info() to log_warn()
for the same reason.

Suggested by millert@.

Revision 1.83 / (download) - annotate - [select for diffs], Sun Feb 12 13:55:01 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.82: +7 -5 lines
Diff to previous 1.82 (colored)

Adjust lines that are too long.

Revision 1.82 / (download) - annotate - [select for diffs], Sun Feb 12 13:15:50 2017 UTC (7 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.81: +29 -28 lines
Diff to previous 1.81 (colored)

Switch from 'legacy' errwarn.c to standard daemon logging functions.

No objections heard. Feedback from millert@ guenther@

Revision 1.81 / (download) - annotate - [select for diffs], Tue Aug 23 09:26:02 2016 UTC (7 years, 9 months ago) by mpi
Branch: MAIN
Changes since 1.80: +18 -16 lines
Diff to previous 1.80 (colored)

Make the 'ifi' global local to dhclient.c and pass it as an argument to
functions needing it.

This is the first step to support multiple interfaces in one dhclient(8)
instance.

ok krw@

Revision 1.80 / (download) - annotate - [select for diffs], Thu Jul 21 09:58:55 2016 UTC (7 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.79: +3 -3 lines
Diff to previous 1.79 (colored)

Use explicit idiom when testing the result of strcmp() and strncmp().
i.e. == 0 and != 0 as appropriate. No intentional functional change.

Suggested by & ok tom@

Revision 1.79 / (download) - annotate - [select for diffs], Sat Feb 6 19:30:52 2016 UTC (8 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.78: +20 -5 lines
Diff to previous 1.78 (colored)

Eliminate #include inside *.h files and include only needed headers in
each *.c file.

Inspired by mention of header silliness by Edgar Pettijohn and mmcc@
on tech@.

Revision 1.78 / (download) - annotate - [select for diffs], Sat Dec 19 14:56:22 2015 UTC (8 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.77: +18 -4 lines
Diff to previous 1.77 (colored)

Don't exit if a route can't be added. Just log particulars and
let someone else figure it out.

ok mpi@

Revision 1.77 / (download) - annotate - [select for diffs], Sat Dec 19 01:09:10 2015 UTC (8 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.76: +1 -3 lines
Diff to previous 1.76 (colored)

Delete superfluous "close(s);return" just before "close(s);<function
exit>".

Revision 1.76 / (download) - annotate - [select for diffs], Fri Dec 18 22:17:46 2015 UTC (8 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.75: +4 -3 lines
Diff to previous 1.75 (colored)

Check ioctl() result with == -1, not < 0. Break long line.

Revision 1.75 / (download) - annotate - [select for diffs], Tue Feb 10 04:20:26 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.74: +19 -5 lines
Diff to previous 1.74 (colored)

Groundwork for better route support over multiple interfaces by
using RTM_IFA to bind routes to an interface. Keep the subnet route
conflict avoidance code for the time being.

diff from claudio@ as part of larger routing magic diff.

ok claudio@ mpi@

Revision 1.74 / (download) - annotate - [select for diffs], Sun Feb 8 01:20:40 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.73: +3 -16 lines
Diff to previous 1.73 (colored)

Get rid of a bunch of memset()'s where struct variables and arrays
are clearly properly initialized in the same area. Prompted by the
recent shrinkage of most imsg structs.

Revision 1.73 / (download) - annotate - [select for diffs], Sat Feb 7 10:08:06 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.72: +42 -1 lines
Diff to previous 1.72 (colored)

Add support for interface-mtu (option 26).

Original request+diff from matthew@

ok dlg@

Revision 1.72 / (download) - annotate - [select for diffs], Sat Feb 7 02:07:32 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.71: +10 -11 lines
Diff to previous 1.71 (colored)

GC unused parameters now that ifname and rdomain are not used in
constructing imsgs.

ok reyk@

Revision 1.71 / (download) - annotate - [select for diffs], Fri Feb 6 06:47:29 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.70: +13 -27 lines
Diff to previous 1.70 (colored)

matthew@ points out that it's a bad idea to rely on the non-privileged,
network-facing process to properly fill out the interface name and
rdomain on which operations are to be performed.

Instead, always use the interface name and rdomain discovered before
forking and dropping privs. Lets all the imsg structs to drop a
couple of members.

ok matthew@ henning@

Revision 1.70 / (download) - annotate - [select for diffs], Sat Jan 31 03:13:04 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.69: +2 -3 lines
Diff to previous 1.69 (colored)

Always free(buf) if errmsg is set while trying to flush routes.

Revision 1.69 / (download) - annotate - [select for diffs], Fri Jan 30 14:14:53 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

Tweak error message to say 'realloc' since that's what's failing,
not 'malloc'.

Revision 1.68 / (download) - annotate - [select for diffs], Mon Oct 27 13:36:21 2014 UTC (9 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.67: +3 -3 lines
Diff to previous 1.67 (colored)

Zap extraneous whitespace and a stuttered extra 'break;'.

Revision 1.67 / (download) - annotate - [select for diffs], Mon Jul 14 18:16:27 2014 UTC (9 years, 11 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.66: +3 -3 lines
Diff to previous 1.66 (colored)

Make sure to correctly exit the loop in priv_flush_routes() in case of
allocation failure; ok krw@

Revision 1.66 / (download) - annotate - [select for diffs], Wed Jul 9 15:16:38 2014 UTC (9 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.65: +2 -2 lines
Diff to previous 1.65 (colored)

Print sizeof() value and size_t variable with %zu rather than %zd.

Revision 1.65 / (download) - annotate - [select for diffs], Mon May 5 18:02:49 2014 UTC (10 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.64: +4 -4 lines
Diff to previous 1.64 (colored)

Zap trailing whitespace. Started by pointed comments from andre@.

Revision 1.64 / (download) - annotate - [select for diffs], Thu Feb 13 00:24:13 2014 UTC (10 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.63: +2 -2 lines
Diff to previous 1.63 (colored)

Hard looping on EAGAIN is bad. Just fall out to outer event loop
when EAGAIN is encountered while trying to flush messages.

Revision 1.63 / (download) - annotate - [select for diffs], Sun Feb 9 20:45:56 2014 UTC (10 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.62: +25 -13 lines
Diff to previous 1.62 (colored)

Don't use imsg_flush(), roll a local flush_unpriv_ibuf() that loops
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.

Revision 1.62 / (download) - annotate - [select for diffs], Sun Feb 9 20:23:22 2014 UTC (10 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.61: +1 -3 lines
Diff to previous 1.61 (colored)

Nuke a couple of extraneous blank lines.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Feb 9 20:08:25 2014 UTC (10 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.60: +3 -3 lines
Diff to previous 1.60 (colored)

Use correct function name in error message. 'cleanup' was renamed
'sendhup' a while ago.

Revision 1.60 / (download) - annotate - [select for diffs], Mon Jan 20 02:54:07 2014 UTC (10 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.59: +3 -3 lines
Diff to previous 1.59 (colored)

%d cleanups, to other formats; ok krw

Revision 1.59 / (download) - annotate - [select for diffs], Sun Dec 8 22:49:02 2013 UTC (10 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.58: +1 -2 lines
Diff to previous 1.58 (colored)

Reduce in_addr memcpy() dances by simply using assignments where the source
variable has been copied to [cm]alloc'ed memory and thus properly aligned.

Revision 1.58 / (download) - annotate - [select for diffs], Thu Dec 5 21:32:59 2013 UTC (10 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.57: +4 -5 lines
Diff to previous 1.57 (colored)

Use destination size as size of memcpy(). Use <in_addr> rather than
<in_addr>.s_addr to shorten code.

ok deraadt@ matthew@ as part of larger diff

Revision 1.57 / (download) - annotate - [select for diffs], Wed Dec 4 19:39:50 2013 UTC (10 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.56: +2 -2 lines
Diff to previous 1.56 (colored)

More memcpy() stylistic repairs and size checks.

Revision 1.56 / (download) - annotate - [select for diffs], Sat Aug 17 14:50:05 2013 UTC (10 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.55: +1 -14 lines
Diff to previous 1.55 (colored)

Do not create a route to the bound address via 127.0.0.1. Our stack
should be able to correctly short-circuit packet routing to local
addresses without this. Requested by many over the years, most
recently chrisz@.

Get it in early to see if anything does break.

ok claudio@ henning@

Revision 1.55 / (download) - annotate - [select for diffs], Fri Jul 5 22:13:10 2013 UTC (10 years, 11 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.54: +5 -5 lines
Diff to previous 1.54 (colored)

Zap trailing whitespace.

Revision 1.54 / (download) - annotate - [select for diffs], Sun Jun 9 22:39:51 2013 UTC (11 years ago) by krw
Branch: MAIN
Changes since 1.53: +13 -78 lines
Diff to previous 1.53 (colored)

Make route adding interface more flexible by passing flags to be
used rather than deducing them. Use priv_add_route() to add
the 127.0.0.1 address when adding an address.

Revision 1.53 / (download) - annotate - [select for diffs], Sun Jun 9 17:31:54 2013 UTC (11 years ago) by krw
Branch: MAIN
Changes since 1.52: +7 -26 lines
Diff to previous 1.52 (colored)

Fix/clarify some comments. do memset()'s only when variable is going
to be used.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Jun 9 16:21:50 2013 UTC (11 years ago) by krw
Branch: MAIN
Changes since 1.51: +22 -17 lines
Diff to previous 1.51 (colored)

Re-apply static route and classless static route support -- this time
passing the correct destination for the default route, '0.0.0.0', rather
than the new lease address.

Populating egress group works this time.

Problem found the hard way by Chris Smith.

Revision 1.51 / (download) - annotate - [select for diffs], Sun Jun 9 15:06:34 2013 UTC (11 years ago) by krw
Branch: MAIN
Changes since 1.50: +13 -13 lines
Diff to previous 1.50 (colored)

Re-apply route adding code refactoring -- it wasn't the problem that
broke populating the egress group.

Revision 1.50 / (download) - annotate - [select for diffs], Sun Jun 9 00:30:06 2013 UTC (11 years ago) by krw
Branch: MAIN
Changes since 1.49: +27 -32 lines
Diff to previous 1.49 (colored)

Backout static/classless route handling and default route refactoring
since the former relies on the latter and the latter breaks 'egress'
group populating.

Revision 1.49 / (download) - annotate - [select for diffs], Tue Jun 4 21:04:53 2013 UTC (11 years ago) by krw
Branch: MAIN
Changes since 1.48: +22 -17 lines
Diff to previous 1.48 (colored)

Add support for static routes option (33) and classless static
routes option (121).

ok sthen@

Revision 1.48 / (download) - annotate - [select for diffs], Sat Jun 1 16:26:07 2013 UTC (11 years ago) by krw
Branch: MAIN
Changes since 1.47: +13 -13 lines
Diff to previous 1.47 (colored)

Refactor the default route adding code to use a general route adding
function that will be reused for future work.

ok claudio@

Revision 1.47 / (download) - annotate - [select for diffs], Sat Mar 30 16:10:01 2013 UTC (11 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.46: +23 -61 lines
Diff to previous 1.46 (colored)

Since deleting all the addresses on an interface removes all the
relevant entries from the arp cache, don't bother asking for/processing
arp entries in the route dumps. Thus allowing use of NET_RT_FLAGS
with RTF_GATEWAY and AF_INET, to ask for only the routes dhclient
wants to expunge rather than all routes in existance.

Greatly shrinks and simplifies the code. No intentional functional
change. Tested by sthen@.

Revision 1.46 / (download) - annotate - [select for diffs], Sun Mar 24 12:53:20 2013 UTC (11 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.45: +30 -24 lines
Diff to previous 1.45 (colored)

Simplify logic when processing route dump by using a helper function
delete_route(). No functional change.

Revision 1.45 / (download) - annotate - [select for diffs], Thu Mar 21 04:43:17 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.44: +19 -16 lines
Diff to previous 1.44 (colored)

create realloc() loops around sysctl for array-based mibs, in programs
which want a "full" dump
ok dlg

Revision 1.44 / (download) - annotate - [select for diffs], Wed Mar 13 16:28:05 2013 UTC (11 years, 3 months ago) by weerd
Branch: MAIN
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

Make sure dhclient doesn't delete IPv6 routes.

OK krw@

Revision 1.43 / (download) - annotate - [select for diffs], Mon Mar 11 16:01:02 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.42: +8 -62 lines
Diff to previous 1.42 (colored)

When binding a lease, check for and clear out any 'zombie' routes
left behind by dead dhclients. i.e. dhclients that no longer respond
to 'kill(pid, 0)'.

As a result, no need to handle the 127.0.0.1 route separately when
deleting an interface.

Appears to fix in passing a problem with routes vs link addresses
that sthen@ was seeing.

ok sthen@

Revision 1.42 / (download) - annotate - [select for diffs], Fri Mar 8 12:25:15 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.41: +30 -31 lines
Diff to previous 1.41 (colored)

Consolidate parsing of rtm address lists. Use RTAX_GATEWAY entry
to get ARP sockaddr_dl info, rather than re-parsing manually.

ok sthen@

Revision 1.41 / (download) - annotate - [select for diffs], Thu Mar 7 13:23:27 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.40: +93 -56 lines
Diff to previous 1.40 (colored)

Refactor code around route label creation and checking to make it easier
to read. No functional change.

ok sthen@

Revision 1.40 / (download) - annotate - [select for diffs], Thu Feb 28 21:00:53 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.39: +28 -15 lines
Diff to previous 1.39 (colored)

Try 10 times to obtain the routing table via sysctl(), and if it
can't be done just abandon attempt to clean up the routing and arp
tables and carry on. Code adapted from itojun's route6d.c.

May address problem reported on misc@ by Marc Peters.

Best we can do for now.

ok claudio@

Revision 1.39 / (download) - annotate - [select for diffs], Sun Feb 24 01:23:19 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.38: +4 -2 lines
Diff to previous 1.38 (colored)

Don't log a complaint that a non-existant default route could not be
deleted. Be happy that the goal of no default route has been achieved.

Part of the cleaning up the logs prodding by deraadt@.

ok guenther@. error in first version pointed out by sthen@.

Revision 1.38 / (download) - annotate - [select for diffs], Thu Feb 21 14:10:22 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.37: +6 -2 lines
Diff to previous 1.37 (colored)

Use imsg_flush() to force delivery of IMSG_DELETE_ADDRESS to
privileged process. This ensures a quicker exit of any previous
copy of dhclient.

Prodded by deraadt@

Revision 1.37 / (download) - annotate - [select for diffs], Mon Feb 18 22:10:04 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.36: +3 -1 lines
Diff to previous 1.36 (colored)

Don't delete permanent arp cache entries when clearing the arp
cache. Issue pointed out by Don Nasco.

Deemed the correct thing to do by sthne@, phessler@ and chris@.

Revision 1.36 / (download) - annotate - [select for diffs], Mon Feb 18 15:57:08 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.35: +9 -6 lines
Diff to previous 1.35 (colored)

Rework log messages to be more useful. Rename
IMGS_CLEANUP/imsg_cleanup/cleanup to IMSG_HUP/imsg_hup/sendhup to
more accurately reflect intent of causing the privileged process
to initiate restart.

There should now be one and only one message logged at termination
or restart, logged by the process initiating the termination or
restart.

As part of fixing this, remove duplicate cleanup attempts and exit
after sending IMSG_HUP. These make logged messages more consistant and
fix issues with incorrect cleanups.

More prodding from deraadt@

Revision 1.35 / (download) - annotate - [select for diffs], Sun Feb 17 17:36:31 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

Using the value SIGQUIT to cause the dispatch loops to exit produced
universal revulsion and no little confusion.  #define our own value,
currently INT_MAX, which should not overlap any likely signal value.

Revision 1.34 / (download) - annotate - [select for diffs], Sun Feb 17 17:04:41 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.33: +5 -4 lines
Diff to previous 1.33 (colored)

Suppress some pointless debugging message:

1) If the pipe to the priv process is closed while waiting for
something to happen in the non-priv dispatch() loop, assume the
priv process issued an error message and exit without additional
verbiage.

2) Ditto if the pipe to the priv process is closed when the flush
of IMSG_CLEANUP is attempted.

3) No need to report when SIOCDIFADDR fails because the address is
already gone.

Start to ensure the priv process always issues a useful message
before exiting by noting when it restarts due to the LLADDR having
changed.

Prodded by deraadt@ to clean this up.

Revision 1.33 / (download) - annotate - [select for diffs], Sun Feb 17 15:48:03 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.32: +4 -4 lines
Diff to previous 1.32 (colored)

Kill a magic number. 0 -> RTP_NONE for priority in constructing routing
messages. Prodded by otto@. RTP_NONE's home pointed out by jsg@.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Feb 17 15:08:13 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.31: +2 -4 lines
Diff to previous 1.31 (colored)

dhclient-script did 'route -q $rdomain add $new_ip_address 127.0.0.1'.
i.e.  did not complain (-q) if 127/8 was unreachabel from $rdomain.
So don't pollute the log with new warnings about being unable to
create the route. Just complain if a truly unexpected error occurs.

Noted by Andreas Bartelt.

Revision 1.31 / (download) - annotate - [select for diffs], Fri Feb 15 01:20:39 2013 UTC (11 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.30: +10 -9 lines
Diff to previous 1.30 (colored)

Don't leak routing socket fd if getting the default route fails.
e.g. with ESRCH.

Ask for default route in correct routing domain.

While here, tweak variable names to be consistant with other
functions using a routing socket.

Likely the cause of the periodic failures reported by Andreas Bartelt
via bugs@.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Feb 3 15:10:36 2013 UTC (11 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.29: +86 -62 lines
Diff to previous 1.29 (colored)

Use RTM_GET rather than the sysctl/scan all routes dance to obtain
the current default route. Much less work for the routing system.

Suggested by claudio@. ok beck@

Revision 1.29 / (download) - annotate - [select for diffs], Fri Feb 1 01:33:44 2013 UTC (11 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.28: +85 -1 lines
Diff to previous 1.28 (colored)

Write out resolv.conf only if the default route is under the control
of the process binding the lease. Re-check the default route whenever
a routing message arrives that might mean the default route has
changed, and write out resolv.conf if appropriate.

Reduces the chances that the name servers in resolv.conf are
unreachable.

Problem most eloquently explained, and solution suggested by beck@.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jan 22 06:02:52 2013 UTC (11 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

Whitespace nit. Better error messages.

Revision 1.27 / (download) - annotate - [select for diffs], Thu Jan 17 23:41:07 2013 UTC (11 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.26: +35 -9 lines
Diff to previous 1.26 (colored)

Try harder to clear out default routes on the interface being
configured. Only exempt default routes labelled as being the
property of another dhclient.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Dec 29 14:40:00 2012 UTC (11 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

Make HUP to either one of the processes cause a restart that will
have dhclient re-read dhclient.conf and get a new lease. Constrain
the filename passed to '-l' (alternate dhclient.lease.if location)
to be a regular file for the moment.

Original suggestion from phessler@. Feedback from deraadt@ and
espie@.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Dec 19 12:25:38 2012 UTC (11 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.24: +8 -1 lines
Diff to previous 1.24 (colored)

Don't attempt to delete an address that has already been deleted
by a new dhclient (or anyone else). Instead, use add_address(...,
INADDR_ANY, ...) to tell the privileged process that its active
address is gone. Thus the cleanup process doesn't try to delete it.

Eliminates extraneous log entries complaining that the address can't
be deleted. Narrows race window where old dhclient might delete the
address the new dhclient has just added.

Make rapid-fire starting of dhclient even more reliable.

Revision 1.24 / (download) - annotate - [select for diffs], Mon Dec 17 22:52:59 2012 UTC (11 years, 5 months ago) by krw
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

Don't daemonize until the RTM_NEWADDR message is received. Shuffle
things a bit so configuring the address and default route are done
last. This makes it much more likely that all the work is done when
the 'bound to ...' message is displayed.

Amoung other things fixes a problem with the install scripts, where
the first (hostname-associated) dhclient can exit so quickly the
interface doesn't yet have an address and a second (free-floating)
dhclient is therefore often run.

Noted by rpe@, who also tested the fix.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Dec 4 19:24:03 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.22: +33 -26 lines
Diff to previous 1.22 (colored)

Eliminate hand-rolled pseudo-strerror() %m strangeness by replacing
all occurances of %m with strerror(errno). And then nuking do_percentm()
and related buffer shuffling.

Also simplify parse_warn() so it takes a simple char * of the error,
and thus rely on pointing to error location in input for details.

Makes sense to beck@

Revision 1.22 / (download) - annotate - [select for diffs], Mon Dec 3 22:36:16 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.21: +2 -4 lines
Diff to previous 1.21 (colored)

Backout last. It breaks existing 'ifconfig down ; dhclient' usage.

Pointed out by deraadt@

Revision 1.21 / (download) - annotate - [select for diffs], Mon Dec 3 22:19:47 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.20: +4 -2 lines
Diff to previous 1.20 (colored)

Cleanup after a 'ifconfig down', but stick around so 'ifconfig up'
will get a new lease without having to restart dhclient. Also tweak
cleanup() to cancel any existing timeout, so one doesn't fire between
'down' and 'up'.

Makes sense to chris@ beck@.

Revision 1.20 / (download) - annotate - [select for diffs], Sun Dec 2 17:03:19 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.19: +52 -1 lines
Diff to previous 1.19 (colored)

Try harder to cleanup when exiting. In particular catch signals
SIGHUP, SIGINT, SIGTERM, SIGUSR1, SIGUS2 and cleanup before exiting
when getting them. Cleanup meaning removing routes and the interface
address added.

Tweaks and feedback from phessler@, sthen@, otto@, deraadt@

Revision 1.19 / (download) - annotate - [select for diffs], Fri Nov 23 15:25:47 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.18: +79 -119 lines
Diff to previous 1.18 (colored)

Use the libutil imsg framework rather than a hand-rolled local
version. This is the last hand-rolled imsg implementation I could
spot. Doesn't seem to break sparc64.

Suggested by chris@, tweaks from brad@ and reyk@.

ok reyk@

Revision 1.18 / (download) - annotate - [select for diffs], Sat Nov 17 10:39:24 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

'deeleting' -> 'deleting' in comment.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Nov 16 14:59:36 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

Add missing 'break;' so that IFT_ETHER, etc. routes are deleted as
intended.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Nov 15 14:54:18 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.15: +4 -8 lines
Diff to previous 1.15 (colored)

Shuffle #include's to use the majority idiom everywhere - i.e. use
dhcpd.h to pull in most sys/net/netinet/etc. .h file. Eliminate
superfluous #include's.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Nov 14 15:47:41 2012 UTC (11 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.14: +10 -10 lines
Diff to previous 1.14 (colored)

Remove useless _new_ and _old_ from various function names to make
them shorter and eliminate implications about what the function
does. No functional change.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Nov 8 21:32:55 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.13: +25 -32 lines
Diff to previous 1.13 (colored)

Remove confusing extra address abstraction 'struct iaddr'. Just use
'in_addr'. Remove many double conversions and other perversions.
piaddr() replaced with inet_ntoa(). dhclient is extremely unlikely
to support anything but ipv4/dhcp without a complete rewrite.

Joint work with chris@.

Positive feedback from deraadt@ zinke@ phessler@.

Revision 1.13 / (download) - annotate - [select for diffs], Thu Nov 8 16:40:21 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.12: +3 -1 lines
Diff to previous 1.12 (colored)

Close routing socket fd leak when deleting old address.

Spotted by zinke@.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Nov 7 15:40:13 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.11: +5 -11 lines
Diff to previous 1.11 (colored)

Always memcpy() into/out of option data rather than hoping the char *
will be always be aligned. Don't pass around pointers into option
data - use variable that has the memcpy()'d data.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Nov 7 15:20:28 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.10: +18 -18 lines
Diff to previous 1.10 (colored)

Use memset() consistently rather than tossing in a few bzero()'s.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Nov 7 15:07:02 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.9: +4 -4 lines
Diff to previous 1.9 (colored)

Use memcpy() consistently rather than tossing in a few bcopy()'s.

Revision 1.9 / (download) - annotate - [select for diffs], Wed Nov 7 14:47:30 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.8: +4 -4 lines
Diff to previous 1.8 (colored)

Kill some annoying extra spaces. No code change.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Nov 5 03:49:16 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.7: +6 -2 lines
Diff to previous 1.7 (colored)

Some systems give ENETUNREACH when trying to add the 'standard'
host route, a.k.a. 'route add w.x.y.z 127.0.0.1'. Since dhclient-script
ignored the failure, ignore it here too until it can be explained
or we stop creating these routes.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Nov 4 03:36:39 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.6: +3 -8 lines
Diff to previous 1.6 (colored)

No need to pass interface name around when flushing routes.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Nov 4 03:25:31 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.5: +3 -13 lines
Diff to previous 1.5 (colored)

No need to pass interface name around when creating routes.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Nov 3 01:59:31 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.4: +4 -2 lines
Diff to previous 1.4 (colored)

While this identical idiom caused problems when building an ifaliasreq
to *add* an address, here (building an ifaliasreq to delete an
address) it worked fine. But change it to the bcopy() dance that
works in the adding case just to be consistant until a sparc64/gcc
guru is cornered in a bar with a full keg of guiness.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Nov 2 20:21:32 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.3: +5 -3 lines
Diff to previous 1.3 (colored)

Avoid some misaligned access on sparc64 (at least) by bcopy()'ing
in_addr_t values into s_addr's rather than assigning them.

Possibly not the ideal solution, but at least dhclient will work
again on sparc64.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Nov 1 22:07:07 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.2: +27 -27 lines
Diff to previous 1.2 (colored)

KNF some leading spaces into tabs.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Oct 31 15:50:47 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.1: +37 -1 lines
Diff to previous 1.1 (colored)

Forcibly delete all existing ipv4 addresses from an interface when
binding a lease to that interface. This fixes issues sthen@ found
with unexpectedly persistant addresses and failures of dhclient
when switching an interface repeatedly between different networks.

This crude but predictable behaviour may be toned down once it
is figured out what we want to do with mixed static/dynamic
configurations on an interface.

ok sthen@

Revision 1.1 / (download) - annotate - [select for diffs], Tue Oct 30 16:41:28 2012 UTC (11 years, 7 months ago) by krw
Branch: MAIN

New file holding functions to perform direct interface and routing
maninpulations. Inspired by similar files in bgpd, dvmrpd, ldpd, etc.
Necessary for imminent nuking of dhclient-script.

Not linked into build at the moment.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.