#
272461 |
|
02-Oct-2014 |
gjb |
Copy stable/10@r272459 to releng/10.1 as part of the 10.1-RELEASE process.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
261828 |
|
13-Feb-2014 |
brueffer |
MFC: r261566
Use CAP_EVENT instead of the deprecated CAP_POLL_EVENT.
PR: 185382 (based on) Submitted by: Loganaden Velvindron Reviewed by: pjd
|
#
256281 |
|
10-Oct-2013 |
gjb |
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation
|
#
255219 |
|
04-Sep-2013 |
pjd |
Change the cap_rights_t type from uint64_t to a structure that we can extend in the future in a backward compatible (API and ABI) way.
The cap_rights_t represents capability rights. We used to use one bit to represent one right, but we are running out of spare bits. Currently the new structure provides place for 114 rights (so 50 more than the previous cap_rights_t), but it is possible to grow the structure to hold at least 285 rights, although we can make it even larger if 285 rights won't be enough.
The structure definition looks like this:
struct cap_rights { uint64_t cr_rights[CAP_RIGHTS_VERSION + 2]; };
The initial CAP_RIGHTS_VERSION is 0.
The top two bits in the first element of the cr_rights[] array contain total number of elements in the array - 2. This means if those two bits are equal to 0, we have 2 array elements.
The top two bits in all remaining array elements should be 0. The next five bits in all array elements contain array index. Only one bit is used and bit position in this five-bits range defines array index. This means there can be at most five array elements in the future.
To define new right the CAPRIGHT() macro must be used. The macro takes two arguments - an array index and a bit to set, eg.
#define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL)
We still support aliases that combine few rights, but the rights have to belong to the same array element, eg:
#define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL) #define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL)
#define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP)
There is new API to manage the new cap_rights_t structure:
cap_rights_t *cap_rights_init(cap_rights_t *rights, ...); void cap_rights_set(cap_rights_t *rights, ...); void cap_rights_clear(cap_rights_t *rights, ...); bool cap_rights_is_set(const cap_rights_t *rights, ...);
bool cap_rights_is_valid(const cap_rights_t *rights); void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src); void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little);
Capability rights to the cap_rights_init(), cap_rights_set(), cap_rights_clear() and cap_rights_is_set() functions are provided by separating them with commas, eg:
cap_rights_t rights;
cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT);
There is no need to terminate the list of rights, as those functions are actually macros that take care of the termination, eg:
#define cap_rights_set(rights, ...) \ __cap_rights_set((rights), __VA_ARGS__, 0ULL) void __cap_rights_set(cap_rights_t *rights, ...);
Thanks to using one bit as an array index we can assert in those functions that there are no two rights belonging to different array elements provided together. For example this is illegal and will be detected, because CAP_LOOKUP belongs to element 0 and CAP_PDKILL to element 1:
cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL);
Providing several rights that belongs to the same array's element this way is correct, but is not advised. It should only be used for aliases definition.
This commit also breaks compatibility with some existing Capsicum system calls, but I see no other way to do that. This should be fine as Capsicum is still experimental and this change is not going to 9.x.
Sponsored by: The FreeBSD Foundation
|
#
252697 |
|
04-Jul-2013 |
pjd |
Fix dhclient for interfaces that are down. The discover_interfaces() function that looks for interface skips interfaces that are not UP. We need to call dhclient-script PREINIT before we call discover_interfaces(), so the script has a chance to bring the interface UP.
Reported by: alfred
|
#
252634 |
|
03-Jul-2013 |
pjd |
MFp4 @229488:
Sandbox unprivileged process using capability mode.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252633 |
|
03-Jul-2013 |
pjd |
MFp4 @229487:
Revoke all capability rights from STDIN and allow only for write to STDOUT and STDERR. All those descriptors are redirected to /dev/null.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252632 |
|
03-Jul-2013 |
pjd |
MFp4 @229486:
Once PID is written to the pidfile, revoke all capability rights. We just want to keep the pidfile open.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252631 |
|
03-Jul-2013 |
pjd |
MFp4 @229485:
Only allow to overwrite lease file.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252630 |
|
03-Jul-2013 |
pjd |
MFp4 @229484:
Limit routing socket so only poll(2) and read(2) are allowed (CAP_POLL_EVENT and CAP_READ). This prevents unprivileged process from adding, removing or modifying system routes.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252629 |
|
03-Jul-2013 |
pjd |
MFp4 @229483:
Limit communication pipe with privileged process to CAP_READ and CAP_WRITE.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252626 |
|
03-Jul-2013 |
pjd |
MFp4 @229481:
Currently it was allowed to send any UDP packets from unprivileged process and possibly any packets because /dev/bpf was open for writing.
Move sending packets to privileged process. Unprivileged process has no longer access to not connected UDP socket and has only access to /dev/bpf in read-only mode.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252625 |
|
03-Jul-2013 |
pjd |
MFp4 @229480:
Shutdown write direction of the routing socket. We only need to read from it.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252623 |
|
03-Jul-2013 |
pjd |
MFp4 @229477:
The gethostname(3) function won't work in capability mode, because reading kern.hostname sysctl is not permitted there. Cache hostname early and use cached value later.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252621 |
|
03-Jul-2013 |
pjd |
Remove redundant white-spaces.
|
#
252618 |
|
03-Jul-2013 |
pjd |
MFp4 @229473:
No caller checks send_packet() return value, so make it void.
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252616 |
|
03-Jul-2013 |
pjd |
MFp4 @229472:
Use the same type for 'from' and 'to' argument in send_packet().
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252614 |
|
03-Jul-2013 |
pjd |
MFp4 @229470:
Remove unused argument from send_packet().
Reviewed by: brooks Sponsored by: The FreeBSD Foundation
|
#
252506 |
|
02-Jul-2013 |
bms |
When acquiring a lease, record the value of the BOOTP siaddr field contained in the DHCP offer, and write it out to the lease file as an unquoted value of the "next-server" keyword. The value is ignored when the lease is read back by dhclient, however other applications are free to parse it.
The intent behind this change is to allow easier interoperability with automated installation systems e.g. Cobbler, Foreman, Razor; FreeBSD installation kernels can automatically probe the network to discover deployment servers. There are no plans to MFC this change unless a backport is specifically requested.
The syntax of the "next-server <ip>" lease keyword is intended to be identical to that used by the ISC DHCPD server in its configuration files. The required defines are already present in dhclient but were unused before this change. (Note: This is NOT the same as Option 66, tftp-server-name).
It has been exercised in a university protocol testbed environment, with Cobbler and an mfsBSD image containing pc-sysinstall (driven by Cobbler Cheetah templates). The SYSLINUX memdisk driver is used to boot mfsBSD. Currently this approach requires that a dedicated system profile has been created for the node where FreeBSD is to be deployed. If this is not present, the pc-sysinstall wrapper will be unable to obtain a node configuration. There is code in progress to allow mfsBSD images to obtain the required hints from the memdisk environment by parsing the MBFT ACPI chunk. This is non-standard as it is not linked into the platform's ACPI RSDT.
Reviewed by: des
|
#
239564 |
|
22-Aug-2012 |
jhb |
Revert r239356 and use an alternate algorithm.
First, don't exit when the link goes down on an interface. Instead, teach dhclient to track changes in link state and to enter the reboot state when the link on an interface goes up causing dhclient to attempt to renew its existing lease.
Second, remove the change I added to clear the old lease when dhclient exits due to an error (such as ifconfig down). If an interface is using autoconfiguration it should keep its autoconfiguration as much as possible. If the next time it needs a configuration it is able to reuse the previous autoconfiguration, then leaving the settings intact allows existing connections to survive temporary outages, etc.
PR: bin/166656 MFC after: 1 month
|
#
239356 |
|
17-Aug-2012 |
jhb |
Fix dhclient to properly exit and teardown the configured lease when link is lost. devd will start a new dhclient instance when link is restored.
PR: bin/166656 Submitted by: Peter Jeremy (mostly) Reviewed by: brooks (earlier version from Peter) MFC after: 1 month
|
#
228259 |
|
04-Dec-2011 |
dumbbell |
Support domain-search in dhclient(8)
The "domain-search" option (option 119) allows a DHCP server to publish a list of implicit domain suffixes used during name lookup. This option is described in RFC 3397.
For instance, if the domain-search option says: ".example.org .example.com" and one wants to resolve "foobar", the resolver will try: 1. "foobar.example.org" 2. "foobar.example.com"
The file /etc/resolv.conf is updated with a "search" directive if the DHCP server provides "domain-search".
A regression test suite is included in this patch under tools/regression/sbin/dhclient.
PR: bin/151940 Sponsored by Yakaz (http://www.yakaz.com)
|
#
226345 |
|
13-Oct-2011 |
des |
Make dhclient use a pid file. Modify the rc script accordingly; while there, clean it up and add some error checks.
Glanced at by: brooks@ MFC after: 3 weeks
|
#
209756 |
|
07-Jul-2010 |
brian |
When dhclient obtains a lease, it runs dhclient-script and expects it to configure the interface. When the script is complete, dhclient monitors the routing socket and will terminate if its address is deleted or if its interface is removed or brought down.
Because the routing socket is already open when dhclient-script is run, dhclient ignores address deletions for 10 seconds after the script was run.
If the address that will be obtained is already configured on the interface before dhclient starts, and if dhclient-script takes more than 10 seconds (perhaps due to dhclient-*-hooks latencies), on script completion, dhclient will immediately and silently exit when it sees the RTM_DELADDR routing message resulting from the script reassigning the address to the interface.
This change logs dhclient's reason for exiting and also changes the 10 second timeout to be effective from completion of dhclient-script rather than from when it was started.
We now ignore RTM_DELADDR and RTM_NEWADDR messages when the message contains no interface address (which should not happen) rather than exiting.
Not reviewed by: brooks (timeout) MFC after: 3 weeks
|
#
193765 |
|
08-Jun-2009 |
brian |
Fix an off by one error when we limit append/prepend text sizes based on our internal buffer sizes.
When we 'append', assume we're appending to text. Some MS dhcp servers will give us a string with the length including the trailing NUL. when we 'append domain-name', we get something like "search x.y\000 z" in resolv.conf :(
MFC after: 1 week Security: A buffer overflow (by one NUL byte) was possible.
|
#
183974 |
|
17-Oct-2008 |
brooks |
Support the remaining options listed in dhcp-options(5) and RFC 2132.
PR: bin/127076 Submitted by: jkim MFC after: 1 week
|
#
180130 |
|
30-Jun-2008 |
ed |
Run the privileged dhclient process in its own session.
In the MPSAFE TTY branch, I noticed PTY's to be leaked, because dhclient's privileged process was run inside the session of, say, the login shell. Make sure we call setsid() here.
Approved by: philip (mentor), brooks
|
#
177501 |
|
22-Mar-2008 |
sam |
Defer state change on disassociate to avoid unnecessarily dropping the lease: track the current bssid and if it changes (as reported in an assoc/reassoc) event only then kick the state machine. This gives us immediate response when roaming but otherwise causes us to fallback on the normal state machine.
Reviewed by: brooks, jhb MFC after: 3 weeks
|
#
177500 |
|
22-Mar-2008 |
sam |
correct syslog mask so LOG_DEBUG msgs are not lost
MFC after: 2 weeks
|
#
166602 |
|
09-Feb-2007 |
emaste |
Implement RFC3442, the Classless Static Route option.
The original DHCP specification includes a route option but it supports only class-based routes. RFC3442 adds support for specifying the netmask width for each static route. A variable length encoding is used to minimize the size of this option.
PR: bin/99534 Submitted by: Andrey V. Elsukov <bu7cher@yandex.ru> Reviewed by: brooks
|
#
166330 |
|
29-Jan-2007 |
brooks |
Actually implement rev 1.12 for host names and NIS domain names. We were removing the invalid option, but still rejecting the lease.
Reported by: Yoshihiko Sarumaru <mistral at imasy dot or dot jp>
|
#
161514 |
|
21-Aug-2006 |
brian |
Revert the addition of -p. It's flawed in that dhclient should not run on an interface without carrier. devd should be used instead to handle link up/down events.
Put on the right path by: brooks, sam
|
#
161411 |
|
17-Aug-2006 |
brian |
Correct usage()
|
#
161410 |
|
17-Aug-2006 |
brian |
Add a -p switch to dhclient. The switch tells dhclient to persist despite the interface link status.
Add dhclient_flags_iface and background_dhclient_iface rc.conf options. (where iface is a specific interface). These can be used to give interface specific flags to dhclient.
Reviewed by: brooks@
|
#
160089 |
|
03-Jul-2006 |
jkim |
Send client identifier unconditionally. My ancient D-Link router response with NACK if I don't set it. Setting 'option dhcp-client-identifier' is alternative but it is inconvenient because I have to keep the list of all MAC addresses. As bin/94743 pointed out, it is always sent from Windows clients and I found Mac OS X does the same.
OK'd by: brooks
|
#
158856 |
|
23-May-2006 |
imp |
Remove 'n' from the getopt string. There's no -n option that is parsed, so it winds up at usage anyway.
Add 'b' to the usage summary. Noticed by Ben Mesander.
|
#
158353 |
|
07-May-2006 |
brooks |
Be more like Windows and Linux and send our hostname in the host-name option if none is given in the config file. Also add #ifdefd out support for sending a client ID based on our MAC address.
PR: bin/94743, bin/76401 Submitted by: Frank Behrens <frank at pinky dot sax dot de> X-MFC after: 6.1-RELEASE
|
#
154161 |
|
10-Jan-2006 |
brooks |
Allow users to add aliases to the interface.
PR: bin/87465 (different solution used) MFC after: 1 week
|
#
153287 |
|
10-Dec-2005 |
brooks |
When we get a bogus hostname in an option, drop the option rather than refusing the lease. This allow obtaining leases on misadministered networks that use host names with underscores in them.
MFC After: 3 days
|
#
149727 |
|
02-Sep-2005 |
brooks |
When we supersed the subnet-mask, write the forced value to the lease file. This is what the ISC client does.
Submitted by: Rostislav Krasny <rosti dot bsd at gmail dot com>
|
#
149639 |
|
30-Aug-2005 |
brooks |
Introduce a new helper function check_search() derived for res_hnok to check the domain-name parameter according to the rules for "search" strings as documented in resolv.conf(5). Specifically, the string must be no more than 256 bytes long and contain no more than six valid domain names separated by white space.
The previous unchecked values could result in a mangled resolv.conf file which could effectively deny access to local sites. This is not a security issue as rogue dhcp servers could already do this without sending invalid strings.
Reviewed by: cperciva MFC After: 3 days
|
#
149399 |
|
23-Aug-2005 |
brooks |
Add __FBSDID to all .c files in dhclient to aid in determining file versions when dealing with user problems.
|
#
148465 |
|
27-Jul-2005 |
brooks |
Don't reject packets with server names containing characters that are not allowed in domain names. RFC 2132 does not list valid or invalid characters and the ISC client accepts anything here.
Reported by: ps
|
#
148373 |
|
25-Jul-2005 |
sam |
treat REASSOC events just like ASSOC
MFC after: 3 days
|
#
147689 |
|
30-Jun-2005 |
brooks |
Don't complain when we receive smtp, pop, nntp, www, finger, and irc server options.
Reported by: Max Boyarov <max_b at tut dot by> Approved by: re (dhclient blanket)
|
#
147686 |
|
30-Jun-2005 |
brooks |
People like to do RFC violating things with the domain-name option and include a space seperated list of domains instead of the domain of the host. This is supported on too many platforms to break for now so, remove validation of this option for the moment.
The correct solution longer term is to implement RFC 3397 support and then treat domain-name options containing space seperated lists of domains as domain-search options for backwards compatability.
Approved by: re (dhclient blanket)
|
#
147351 |
|
13-Jun-2005 |
brooks |
Avoid a null pointer dereference by not expiring our lease if we don't have an active one.
Submitted by: sam Reported by: James Snow <snow at teardrop dot org> Approved by: re (dhclient blanket)
|
#
147106 |
|
07-Jun-2005 |
brooks |
Fix build on 64-bit platforms where time_t is 64 bit. Since where talking about time related to leases, it should be OK to cast these to (int)s rather than using intmax_t.
Submitted by: ru Pointy hat: brooks
|
#
147085 |
|
07-Jun-2005 |
brooks |
Define _PATH_VAREMPTY.
Add a -b option to background immediatly.
Add support for 802.11 routing messages to "instantly" renegotiate at lease when we associate with a new network.
Submitted by: sam
|
#
147073 |
|
07-Jun-2005 |
brooks |
This commit was generated by cvs2svn to compensate for changes in r147072, which included commits to RCS files with non-trunk default branches.
|
#
147072 |
|
07-Jun-2005 |
brooks |
Import the OpenBSD dhclient as shipped with OpenBSD-3.7 (the tag OPENBSD_3_7).
|