Commit Diff


commit - ce8077eccc5233b5f21eb44989f89cd0daa504d1
commit + 8b2d313fcfd72c808e3b125f1c5033a1270e7bca
blob - 7da1c63710f2852205df3e10d461e0d6b93ab569
blob + 59857e36537bbbad39dc7b6f9c2fea7a2f4adc67
--- conf.c
+++ conf.c
@@ -86,7 +86,6 @@ void conf_keepalive(FILE *, int, char *);
 void conf_rtflags(char *, int, struct rt_msghdr *rtm);
 int dhcpleased_has_defaultroute(struct sockaddr_rtlabel *);
 int dhcpleased_controls_interface(char *, int);
-int dhclient_isenabled(char *);
 int default_txprio(char *);
 int default_rxprio(char *);
 int default_llpriority(char *);
@@ -591,40 +590,6 @@ dhcpleased_has_address(char *ifname, const char *addre
 	return (address_found);
 }
 
-/*
- * see if ("option routers %s;\n",dst) is preset in any possible dhclient
- * lease file
- */
-int dhclient_isenabled(char *dst)
-{
-	int gatewayfound = 0;
-	struct stat enst;
-	struct if_nameindex *ifn_list, *ifnp;
-	char ortext[128];
-	char leasefile[sizeof(LEASEPREFIX)+IFNAMSIZ+1];
-
-	if ((ifn_list = if_nameindex()) == NULL) {
-		printf("%% dhclient_isenabled: if_nameindex failed\n");
-		return 0;
-	}
-
-	snprintf(ortext, sizeof(ortext), "  option routers %s;\n", dst);
-
-	for (ifnp = ifn_list; ifnp->if_name != NULL; ifnp++) {
-		snprintf(leasefile, sizeof(leasefile), "%s.%s", LEASEPREFIX,
-		    ifnp->if_name);
-		if (stat(leasefile, &enst) == 0 && S_ISREG(enst.st_mode))
-			if(scantext(leasefile, ortext)) {
-				gatewayfound = 1;
-				break;
-			}
-	}
-
-	if_freenameindex(ifn_list);
-
-	return (gatewayfound);
-}
-
 /* find string in file */
 int scantext(char *fname, char *string)
 {
@@ -811,18 +776,11 @@ void conf_lladdr(FILE *output, char *ifname)
 
 int conf_ifaddr_dhcp(FILE *output, char *ifname, int ifs, int flags)
 {
-	FILE *dhcpif = NULL;
 	int ippntd;
-	char leasefile[sizeof(LEASEPREFIX)+1+IFNAMSIZ];
 
-	/* find dhcpleased/dhclient controlled interfaces */
-	snprintf(leasefile, sizeof(leasefile), "%s.%s",
-	    LEASEPREFIX, ifname);
-	if (dhcpleased_controls_interface(ifname, ifs) ||
-	    (dhcpif = fopen(leasefile, "r")) != NULL) {
+	/* find dhcpleased controlled interfaces */
+	if (dhcpleased_controls_interface(ifname, ifs)) {
 		fprintf(output, " autoconf4\n");
-		if (dhcpif)
-			fclose(dhcpif);
 		/* print all non-autoconf ipv6 addresses */
 		conf_ifaddrs(output, ifname, flags, AF_INET6);
 		ippntd = 1;
@@ -1680,11 +1638,10 @@ conf_print_rtm(FILE *output, struct rt_msghdr *rtm, ch
 		}
 		/*
 		 * Suppress printing IPv4 route if it's the default
-		 * route and dhcp (dhcpleased or dhclient) is enabled.
+		 * route and dhcp (dhcpleased) is enabled.
 		 */
 		else if (!(af == AF_INET && isdefaultroute(dst, mask)
-		    && (dhcpleased_has_defaultroute(sa_rl) ||
-		    dhclient_isenabled(routename(gate))))) {
+		    && dhcpleased_has_defaultroute(sa_rl))) {
 			fprintf(output, "%s%s ", delim, netname(dst, mask));
 			fprintf(output, "%s%s\n", routename(gate), flags);
 		}
blob - 912dbe18ab09e19ad069cbb8f326af4aeaadc82b
blob + 77c7f615a00b8ffc5d8277ad8217db734712b39c
--- ctl.h
+++ ctl.h
@@ -2,7 +2,6 @@
    daemon control */
 
 /* if.c related */
-#define DHCLIENT        "/sbin/dhclient"
 #define DHCRELAY        "/usr/sbin/dhcrelay"
 #define RAD             "/usr/sbin/rad"
 #define DHCPLEASED_SOCK "/dev/dhcpleased.sock"
blob - 97a5efd074846dac2909aadaa8f91bcd97f45152
blob + 3eed39cfe7a6df63939115a4588ca1b1a515f480
--- externs.h
+++ externs.h
@@ -86,7 +86,6 @@ void conf_pppoe(FILE *, int, char *);
 void conf_sppp(FILE *, int, char *);
 
 /* conf.c */
-#define LEASEPREFIX	"/var/db/dhclient.leases"
 #define DHCPLEASECTL	"/usr/sbin/dhcpleasectl"
 #define SLAACCTL	"/usr/sbin/slaacctl"
 int conf(FILE *);
@@ -326,7 +325,6 @@ int parse_ipv6(char *, struct in6_addr *);
 #endif
 
 /* if.c */
-#define DHCLIENT	"/sbin/dhclient"
 #define DHCRELAY	"/usr/sbin/dhcrelay"
 #define RAD		"/usr/sbin/rad"
 #define DHCPLEASED_SOCK	"/dev/dhcpleased.sock"
blob - 3ce533e8520bb1bafe37c936a01db0994c3db5c2
blob + 6b53fbb6dd34907c5c9db71a1e0049f934873831
--- if.c
+++ if.c
@@ -1337,23 +1337,8 @@ intip(char *ifname, int ifs, int argc, char **argv)
 			}
 			return intxflags(ifname, ifs, argc_dhcp, argv_dhcp);
 		} else {
-			/*
-			 * On OpenBSD 7.2, dhclient(8) is just a stub and will
-			 * likewise set the autoconf4 flag for dhcpleased(8).
-			 * On earlier releases, dhclient(8) will get a lease.
-			 */
-			char *args[] = { PKILL, "dhclient", ifname, NULL };
-			char *args_set[] = { DHCLIENT, ifname, NULL };
-			char leasefile[sizeof(LEASEPREFIX)+1+IFNAMSIZ];
-
-			if (set)
-				cmdargs(DHCLIENT, args_set);
-			else {
-				cmdargs(PKILL, args);
-				snprintf(leasefile, sizeof(leasefile), "%s.%s",
-				    LEASEPREFIX, ifname);
-				rmtemp(leasefile);
-			}
+			printf("%% cannot get DHCP leases because dhcpleased "
+			    "is not running\n");
 			return (0);
 		}
 	}