summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient
Commit message (Collapse)AuthorAgeFilesLines
* Merge head from 7/28sjg2014-08-197-15/+11
|\
| * Remove duplicated includes.pjd2014-06-262-4/+0
| | | | | | | | Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org>
| * use .Mt to mark up email addresses consistently (part1)bapt2014-06-205-11/+11
| | | | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco@lastsummer.de>
* | Updated dependenciessjg2014-05-161-1/+0
| |
* | Updated dependenciessjg2014-05-101-0/+2
| |
* | Merge from headsjg2014-05-081-1/+1
|\ \ | |/
| * Use src.opts.mk in preference to bsd.own.mk except where we need stuffimp2014-05-061-1/+1
| | | | | | | | from the latter.
* | Merge headsjg2014-04-286-7/+420
|\ \ | |/
| * Update most userspace consumers of capability.h to use capsicum.h instead.rwatson2014-03-162-4/+4
| | | | | | | | | | | | | | auditdistd is not updated as I will make the change upstream and then do a vendor import sometime in the next week or two. MFC after: 3 weeks
| * Migrate tools/regression/sbin/ to the new tests layout.jmmv2014-03-164-0/+413
| | | | | | | | | | Pretty much all that this change does is shuffles the code around and hooks it into the regular build. The code of the old tests has not changed.
| * Use CAP_EVENT instead of the deprecated CAP_POLL_EVENT.brueffer2014-02-062-2/+2
| | | | | | | | | | | | | | PR: 185382 (based on) Submitted by: Loganaden Velvindron Reviewed by: pjd MFC after: 1 week
| * dhclient: change the pidfile's permissions to 644eadler2014-02-031-1/+1
| | | | | | | | | | | | | | This change permits non-root users to determine if dhclient is running ('service dhclient status wlan0'). Discussed with: mjg, cperciva
* | Merge from headsjg2013-09-057-150/+272
|\ \ | |/
| * Change the cap_rights_t type from uint64_t to a structure that we can extendpjd2013-09-052-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Fix dhclient for interfaces that are down. The discover_interfaces() functionpjd2013-07-041-5/+5
| | | | | | | | | | | | | | | | 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
| * MFp4 @229488:pjd2013-07-031-0/+3
| | | | | | | | | | | | | | Sandbox unprivileged process using capability mode. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229487:pjd2013-07-031-0/+7
| | | | | | | | | | | | | | | | 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
| * MFp4 @229486:pjd2013-07-031-1/+6
| | | | | | | | | | | | | | | | 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
| * MFp4 @229485:pjd2013-07-031-0/+5
| | | | | | | | | | | | | | Only allow to overwrite lease file. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229484:pjd2013-07-031-0/+4
| | | | | | | | | | | | | | | | | | 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
| * MFp4 @229483:pjd2013-07-031-0/+6
| | | | | | | | | | | | | | Limit communication pipe with privileged process to CAP_READ and CAP_WRITE. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229482:pjd2013-07-031-0/+12
| | | | | | | | | | | | | | | | | | - Limit bpf descriptor in unprivileged process to CAP_POLL_EVENT, CAP_READ and allow for SIOCGIFFLAGS, SIOCGIFMEDIA ioctls. - While here limit bpf descriptor in privileged process to only CAP_WRITE. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229481:pjd2013-07-034-18/+75
| | | | | | | | | | | | | | | | | | | | | | | | 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
| * MFp4 @229480:pjd2013-07-031-0/+2
| | | | | | | | | | | | | | Shutdown write direction of the routing socket. We only need to read from it. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229479:pjd2013-07-031-1/+4
| | | | | | | | | | | | | | | | - Add new request (IMSG_SEND_PACKET) that will be handled by privileged process. - Add $FreeBSD$. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229477:pjd2013-07-031-4/+11
| | | | | | | | | | | | | | | | | | 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
| * Remove redundant white-spaces.pjd2013-07-031-9/+9
| |
| * MFp4 @229476,229478:pjd2013-07-032-60/+70
| | | | | | | | | | | | | | | | | | Make use of two fields: rfdesc and wfdesc to keep bpf descriptor open for reading only in rfdesc and bpf descriptor open for writing only in wfdesc. In the end they will be used by two different processes. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229474:pjd2013-07-031-2/+2
| | | | | | | | | | | | | | iov_base field is 'void *' in FreeBSD, no need to cast. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229473:pjd2013-07-033-6/+5
| | | | | | | | | | | | | | No caller checks send_packet() return value, so make it void. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229472:pjd2013-07-033-34/+28
| | | | | | | | | | | | | | Use the same type for 'from' and 'to' argument in send_packet(). Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229471:pjd2013-07-033-8/+4
| | | | | | | | | | | | | | Remove unused argument from assemble_hw_header(). Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4 @229470:pjd2013-07-033-7/+6
| | | | | | | | | | | | | | Remove unused argument from send_packet(). Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * MFp4: @229469:pjd2013-07-032-11/+0
| | | | | | | | | | | | | | Garbage-collect dead prototypes. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
| * When acquiring a lease, record the value of the BOOTP siaddr fieldbms2013-07-023-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Use a higher TTL (128) for DHCP packets. This matches the ISC DHCP client.jhb2013-04-221-1/+1
| | | | | | | | | | PR: bin/170279 MFC after: 1 week
* | Updated dependenciessjg2013-03-111-0/+1
| |
* | Updated dependenciessjg2013-02-161-2/+0
| |
| |
| \
*-. \ Sync from headsjg2012-11-042-0/+12
|\ \ \ | | |/ | |/|
| * | Revert r239356 and use an alternate algorithm.jhb2012-08-222-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Fix dhclient to properly exit and teardown the configured lease whenjhb2012-08-171-0/+7
| |/ | | | | | | | | | | | | | | | | | | 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
* | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-221-0/+21
|/ | | | Requested by: Simon Gerraty <sjg@juniper.net>
* Spelling fixes for sbin/uqs2012-01-072-3/+3
|
* Set svn:executable on dhclient-scriptdumbbell2011-12-301-0/+0
| | | | Sponsored by: Yakaz (http://www.yakaz.com)
* Invalid Domain Search option isn't considered as a fatal errordumbbell2011-12-301-9/+17
| | | | | | | | | | | | In the original Domain Search option patch, an invalid option value would cause the whole lease to be rejected. However, DHCP servers who emit such an invalid value are more common than I thought. With this new patch, just the option is rejected, not the entire lease. PR: bin/163431 Submitted by: Fabian Keil <fk@fabiankeil.de> (earlier version) Reviewed by: Fabian Keil <fk@fabiankeil.de> Sponsored by: Yakaz (http://www.yakaz.com)
* In sbin/dhclient, since we know the size of the source strings anyway,dim2011-12-172-3/+3
| | | | | | we might as well use memcpy; strlcpy is really unnecessary here. MFC after: 1 week
* In sbin/dhclient, work around warnings about the size argument todim2011-12-172-6/+12
| | | | | | | strlcpy appearing to be the size of the source buffer, instead of the destination. MFC after: 1 week
* dhclient-script relied on incorrect behavior of SIOCAIFADDR ioctl,glebius2011-12-131-1/+1
| | | | | | | | | | | | that changed 0.0.0.0/0.0.0.0 prefix to 0.0.0.0/255.0.0.0. In the r228313 this behavior was fixed, and since dhclient-script got broken. I'm not sure this fix is a perfect one, it just changes dhclient-script to set 0.0.0.0/255.0.0.0 explicitly. PR: kern/163206
* Support domain-search in dhclient(8)dumbbell2011-12-047-3/+180
| | | | | | | | | | | | | | | | | | | | | 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)
* Make dhclient use a pid file. Modify the rc script accordingly; whiledes2011-10-135-3/+48
| | | | | | | there, clean it up and add some error checks. Glanced at by: brooks@ MFC after: 3 weeks
OpenPOWER on IntegriCloud