diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-09 23:50:40 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-11-09 23:50:40 +0000 |
commit | 23de9a3f7bee7c5eb70684f44e04d28e98bddb4a (patch) | |
tree | 05cb5bd4171ec8f719fef7bd68003fe9b8659f63 | |
parent | 2fbd405a652c2c06df3a16f49da52fc935a79b8c (diff) |
Remove now unused files.
-rw-r--r-- | sbin/dhclient/dhclient-script | 257 | ||||
-rw-r--r-- | sbin/dhclient/dhclient-script.8 | 202 | ||||
-rw-r--r-- | sbin/dhclient/inet.c | 74 |
3 files changed, 0 insertions, 533 deletions
diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script deleted file mode 100644 index 3298b1d3095..00000000000 --- a/sbin/dhclient/dhclient-script +++ /dev/null @@ -1,257 +0,0 @@ -#!/bin/sh -# -# $OpenBSD: dhclient-script,v 1.23 2012/09/18 18:27:55 krw Exp $ -# -# Copyright (c) 2003 Kenneth R Westerback <krw@openbsd.org> -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# - -# -# Helper functions that implement common actions. -# - -delete_old_address() { - if [ -n "$old_ip_address" ]; then - ifconfig $interface inet $old_ip_address delete - route -q $rdomain delete "$old_ip_address" 127.0.0.1 - fi -} - -ip6_delete_old_address() { - if [ -n "$old_ip6_address" ]; then - ifconfig $interface inet6 $old_ip6_address delete - fi -} - -add_new_address() { - ifconfig $interface \ - inet $new_ip_address \ - netmask $new_subnet_mask \ - broadcast $new_broadcast_address - - # XXX Original TIMEOUT code did not do this unless $new_routers was set? - route -q $rdomain add $new_ip_address 127.0.0.1 -} - -ip6_add_new_address() { - ifconfig $interface \ - inet6 $new_ip6_address \ - prefixlen $new_ip6_prefixlen -} - -delete_old_routes() { - # Delete existing default route. We only allow one, so no need to - # process $old_routers list. - route -q $rdomain -n flush -inet -iface $interface - arp -dan -} - -add_new_routes() { - route -q $rdomain -n flush -inet -iface $interface - for router in $new_routers; do - if [ "$new_ip_address" = "$router" ]; then - route -q $rdomain add default -iface $router - else - route -q $rdomain add default $router - fi - # 2nd and subsequent default routers error out, so explicitly - # stop processing the list after the first one. - break - done -} - -add_new_resolv_conf() { - # Create resolv.conf when either $new_domain_name_servers or - # $new_domain_name are provided. As reported in PR#3135, some ISPs - # provide only $new_domain_name_servers. - - rm -f /etc/resolv.conf.std - - if [ -n "$new_domain_name" ]; then - echo "search $new_domain_name" >>/etc/resolv.conf.std - fi - - if [ -n "$new_domain_name_servers" ]; then - for nameserver in $new_domain_name_servers; do - echo "nameserver $nameserver" >>/etc/resolv.conf.std - done - fi - - if [ -f /etc/resolv.conf.std ]; then - if [ -f /etc/resolv.conf.tail ]; then - cat /etc/resolv.conf.tail >>/etc/resolv.conf.std - fi - - # In case (e.g. during OpenBSD installs) /etc/resolv.conf - # is a symbolic link, take care to preserve the link and write - # the new data in the correct location. - - if [ -f /etc/resolv.conf ]; then - cat /etc/resolv.conf > /etc/resolv.conf.save - fi - cat /etc/resolv.conf.std > /etc/resolv.conf - rm -f /etc/resolv.conf.std - - # Try to ensure correct ownership and permissions. - chown -RL root:wheel /etc/resolv.conf - chmod -RL 644 /etc/resolv.conf - - return 0 - fi - - return 1 -} - -ip6_add_new_resolv_conf() { - # Create resolv.conf when either $new_dhcp6_name_servers or - # $new_dhcp6_domain_search are provided. - - rm -f /etc/resolv.conf.std6 - - if [ -n "$new_dhcp6_domain_search" ]; then - echo "search $new_dhcp6_domain_search" >>/etc/resolv.conf.std6 - fi - - if [ -n "$new_dhcp6_name_servers" ]; then - for nameserver in $new_dhcp6_name_servers; do - echo "nameserver $nameserver" >>/etc/resolv.conf.std6 - done - fi - - if [ -f /etc/resolv.conf.std6 ]; then - if [ -f /etc/resolv.conf.tail ]; then - cat /etc/resolv.conf.tail >>/etc/resolv.conf.std6 - fi - - # In case (e.g. during OpenBSD installs) /etc/resolv.conf - # is a symbolic link, take care to preserve the link and write - # the new data in the correct location. - - if [ -f /etc/resolv.conf ]; then - cat /etc/resolv.conf > /etc/resolv.conf.save - fi - cat /etc/resolv.conf.std6 > /etc/resolv.conf - rm -f /etc/resolv.conf.std6 - - # Try to ensure correct ownership and permissions. - chown -RL root:wheel /etc/resolv.conf - chmod -RL 644 /etc/resolv.conf - - return 0 - fi - - return 1 -} - -# -# Start of active code. -# - -case $reason in -MEDIUM) - # Not called by OpenBSD dhclient(8). - ;; - -PREINIT) - # Not called by OpenBSD dhclient(8). - ;; - -PREINIT6) - # Not called by OpenBSD dhclient(8). - ;; - -ARPSEND) - # Not called by OpenBSD dhclient(8). - # Always fail. i.e. don't wait for ARP packet here. - exit 1 - ;; - -ARPCHECK) - # Not called by OpenBSD dhclient(8). - # Always succeed. i.e. accept lease. - ;; - -BOUND|RENEW|REBIND|REBOOT) - if [ -n "$old_ip_address" ]; then - if [ "$old_ip_address" != "$new_ip_address" ]; then - delete_old_address - delete_old_routes - fi - fi - if [ "$reason" = BOUND ] || - [ "$reason" = REBOOT ] || - [ -z "$old_ip_address" ] || - [ "$old_ip_address" != "$new_ip_address" ]; then - add_new_address - add_new_routes - fi - add_new_resolv_conf - ;; - -BOUND6|RENEW6|REBIND6) - if [ -n "$old_ip6_address" ]; then - if [ "$old_ip6_address" != "$new_ip6_address" ]; then - ip6_delete_old_address - fi - fi - if [ "$reason" = BOUND6 ] || - [ -z "$old_ip6_address" ] || - [ "$old_ip6_address" != "$new_ip6_address" ]; then - ip6_add_new_address - fi - ip6_add_new_resolv_conf - ;; - -EXPIRE|FAIL) - if [ -n "$old_ip_address" ]; then - delete_old_address - delete_old_routes - fi - if [ -f /etc/resolv.conf.save ]; then - cat /etc/resolv.conf.save > /etc/resolv.conf - rm -f /etc/resolv.conf.save - fi - ;; - -EXPIRE6|RELEASE6|STOP6) - if [ -n "$old_ip6_address" ]; then - ip6_delete_old_address - fi - if [ -f /etc/resolv.conf.save ]; then - cat /etc/resolv.conf.save > /etc/resolv.conf - rm -f /etc/resolv.conf.save - fi - ;; - -TIMEOUT) - add_new_address - sleep 1 - if [ -n "$new_routers" ]; then - set "$new_routers" - if ping -q -c 1 -w 1 "$1"; then - add_new_routes - if add_new_resolv_conf; then - exit 0 - fi - fi - fi - ifconfig $interface inet $new_ip_address delete - # XXX Why not a delete_old_address as before all other invocations of - # delete_old_routes? - delete_old_routes - exit 1 - ;; -esac - -exit 0 diff --git a/sbin/dhclient/dhclient-script.8 b/sbin/dhclient/dhclient-script.8 deleted file mode 100644 index 12911c2b6c8..00000000000 --- a/sbin/dhclient/dhclient-script.8 +++ /dev/null @@ -1,202 +0,0 @@ -.\" $OpenBSD: dhclient-script.8,v 1.6 2011/04/04 11:43:20 krw Exp $ -.\" -.\" Copyright (c) 1997 The Internet Software Consortium. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of The Internet Software Consortium nor the names -.\" of its contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND -.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -.\" DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR -.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" This software has been written for the Internet Software Consortium -.\" by Ted Lemon <mellon@fugue.com> in cooperation with Vixie -.\" Enterprises. To learn more about the Internet Software Consortium, -.\" see ``http://www.isc.org/isc''. To learn more about Vixie -.\" Enterprises, see ``http://www.vix.com''. -.\" -.Dd $Mdocdate: April 4 2011 $ -.Dt DHCLIENT-SCRIPT 8 -.Os -.Sh NAME -.Nm dhclient-script -.Nd DHCP client network configuration script -.Sh DESCRIPTION -The DHCP client network configuration script is invoked from time to -time by -.Xr dhclient 8 . -.Pp -.\" No standard client script exists for some operating systems, even though -.\" the actual client may work, so a pioneering user may well need to create -.\" a new script or modify an existing one. -In general, customizations specific to a particular computer should be done -in the -.Pa /etc/dhclient.conf -file. -.Sh OPERATION -When -.Xr dhclient 8 -needs to invoke the client configuration script, it sets up a number of -environment variables and runs -.Nm dhclient-script . -In all cases, -.Va $reason -is set to the name of the reason why the script has been invoked. -The following reasons are currently defined: -BOUND, RENEW, REBIND, REBOOT, EXPIRE, FAIL and TIMEOUT. -.Bl -tag -width "ARPCHECK" -.It BOUND -The DHCP client has done an initial binding to a new address. -The new IP address is passed in -.Va $new_ip_address , -and the interface name is passed in -.Va $interface . -Any options acquired from the server are passed using the option name -described in -.Xr dhcp-options 5 , -except that dashes -.Pq Sq - -are replaced by underscores -.Pq Sq _ -in order to make valid shell variables, and the variable names start with new_. -So for example, the new subnet mask would be passed in -.Va $new_subnet_mask . -.Pp -When a binding has been completed, a lot of network parameters are -likely to need to be set up. -A new -.Pa /etc/resolv.conf -needs to be created, using the values of -.Va $new_domain_name -and -.Va $new_domain_name_servers -(which may list more than one server, separated by spaces). -A default route should be set using -.Va $new_routers , -and static routes may need to be set up using -.Va $new_static_routes . -.Pp -Note: since -.Nm -effectively overwrites -.Pa /etc/resolv.conf , -any information contained therein is lost. -If options must be passed to the resolver, -they may be contained in -.Pa /etc/resolv.conf.tail , -which is appended to the generated -.Pa /etc/resolv.conf -by -.Nm . -See -.Xr resolv.conf.tail 5 -for further information. -.Pp -.It RENEW -When a binding has been renewed, the script is called as in BOUND, -except that in addition to all the variables starting with $new_, -there is another set of variables starting with $old_. -Persistent settings that may have changed need to be deleted \- for example, -if a local route to the bound address is being configured, the old local -route should be deleted. -If the default route has changed, the old default route should be deleted. -If the static routes have changed, the old ones should be deleted. -Otherwise, processing can be done as with BOUND. -.It REBIND -The DHCP client has rebound to a new DHCP server. -This can be handled as with RENEW, except that if the IP address has changed, -the ARP table should be cleared. -.It REBOOT -The DHCP client has successfully reacquired its old address after a reboot. -This can be processed as with BOUND. -.It EXPIRE -The DHCP client has failed to renew its lease or acquire a new one, -and the lease has expired. -The IP address must be relinquished, and all related parameters should be -deleted, as in RENEW and REBIND. -.It FAIL -The DHCP client has been unable to contact any DHCP servers, and any -leases that have been tested have not proved to be valid. -The parameters from the last lease tested should be deconfigured. -This can be handled in the same way as EXPIRE. -.It TIMEOUT -The DHCP client has been unable to contact any DHCP servers. -However, an old lease has been identified, and its parameters have -been passed in as with BOUND. -The client configuration script should test these parameters and, -if it has reason to believe they are valid, should exit with a value of zero. -If not, it should exit with a nonzero value. -.El -.Pp -The usual way to test a lease is to set up the network as with REBIND -(since this may be called to test more than one lease) and then ping -the first router defined in -.Va $routers . -If a response is received, the lease must be valid for the network to -which the interface is currently connected. -It would be more complete to try to ping all of the routers listed in -.Va $new_routers , -as well as those listed in -.Va $new_static_routes , -but current scripts do not do this. -.\" .Sh FILES -.\" Each operating system should generally have its own script file, -.\" although the script files for similar operating systems may be similar -.\" or even identical. -.\" The script files included in the Internet Software Consortium DHCP -.\" distribution appear in the distribution tree under client/scripts, -.\" and bear the names of the operating systems on which they are intended -.\" to work. -.Sh SEE ALSO -.Xr dhclient.conf 5 , -.Xr dhclient.leases 5 , -.Xr resolv.conf.tail 5 , -.Xr dhclient 8 , -.Xr dhcpd 8 , -.Xr dhcrelay 8 -.Sh AUTHORS -.An -nosplit -The original version of -.Nm -was written for the Internet Software Consortium by -.An Ted Lemon Aq mellon@fugue.com -in cooperation with Vixie Enterprises. -.Pp -The -.Ox -implementation of -.Nm -was written by -.An Kenneth R. Westerback Aq krw@openbsd.org . -.Sh BUGS -If more than one interface is being used, there's no obvious way to -avoid clashes between server-supplied configuration parameters \- for -example, the stock dhclient-script rewrites -.Pa /etc/resolv.conf . -If more than one interface is being configured, -.Pa /etc/resolv.conf -will be repeatedly initialized to the values provided by one server, and then -the other. -Assuming the information provided by both servers is valid, this shouldn't -cause any real problems, but it could be confusing. diff --git a/sbin/dhclient/inet.c b/sbin/dhclient/inet.c deleted file mode 100644 index 6365b2b2c08..00000000000 --- a/sbin/dhclient/inet.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: inet.c,v 1.8 2012/11/06 00:05:11 krw Exp $ */ - -/* - * Subroutines to manipulate internet addresses in a safely portable - * way... - */ - -/* - * Copyright (c) 1996 The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon <mellon@fugue.com> in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#include "dhcpd.h" - -int -addr_eq(struct iaddr addr1, struct iaddr addr2) -{ - if (addr1.len != addr2.len) - return (0); - return (memcmp(addr1.iabuf, addr2.iabuf, addr1.len) == 0); -} - -char * -piaddr(struct iaddr addr) -{ - static char pbuf[32]; - struct in_addr a; - char *s; - - memcpy(&a, &(addr.iabuf), sizeof(struct in_addr)); - - if (addr.len == 0) - strlcpy(pbuf, "<null address>", sizeof(pbuf)); - else { - s = inet_ntoa(a); - if (s != NULL) - strlcpy(pbuf, s, sizeof(pbuf)); - else - strlcpy(pbuf, "<invalid address>", sizeof(pbuf)); - } - return (pbuf); -} |