From f962f455392736306d480c56549cb58e14fca725 Mon Sep 17 00:00:00 2001 From: krw Date: Wed, 24 Feb 2021 16:18:59 +0000 Subject: [PATCH] Remove incomplete/incorrect connection with autoconf, clearing ground for future attempts at making it more IPv6-like. ok florian@ --- sbin/dhclient/dhclient.8 | 17 ++--------------- sbin/dhclient/dhclient.c | 40 ++-------------------------------------- sbin/dhclient/dhcpd.h | 3 +-- sbin/dhclient/kroute.c | 13 ++----------- 4 files changed, 7 insertions(+), 66 deletions(-) diff --git a/sbin/dhclient/dhclient.8 b/sbin/dhclient/dhclient.8 index a64a75a4e7d..b69608c53d4 100644 --- a/sbin/dhclient/dhclient.8 +++ b/sbin/dhclient/dhclient.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dhclient.8,v 1.46 2020/12/10 18:35:31 krw Exp $ +.\" $OpenBSD: dhclient.8,v 1.47 2021/02/24 16:18:59 krw Exp $ .\" .\" Copyright (c) 1997 The Internet Software Consortium. .\" All rights reserved. @@ -35,7 +35,7 @@ .\" 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: December 10 2020 $ +.Dd $Mdocdate: February 24 2021 $ .Dt DHCLIENT 8 .Os .Sh NAME @@ -62,19 +62,6 @@ in the appropriate .Xr hostname.if 5 file. .Pp -.Nm -sets the -.Sy AUTOCONF4 -flag on -.Ar interface . -If the flag is later cleared by -.Xr ifconfig 8 -.Nm -will continue to obtain leases normally but it will not apply any -changes to the interface or the host until -.Xr ifconfig 8 -restores the flag. -.Pp The options are as follows: .Bl -tag -width Ds .It Fl c Ar file diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index cc84a8bebe2..8311d8c5335 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.698 2021/02/22 02:19:03 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.699 2021/02/24 16:18:59 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -119,7 +119,6 @@ void get_address(struct interface_info *); void get_ssid(struct interface_info *, int); void get_sockets(struct interface_info *); int get_routefd(int); -void set_autoconf(struct interface_info *, int); void set_iff_up(struct interface_info *, int); void set_user(char *); int get_ifa_family(char *, int); @@ -311,10 +310,8 @@ initialize_interface(char *name, int noaction) get_sockets(ifi); get_ssid(ifi, ioctlfd); - if (noaction == 0) { - set_autoconf(ifi, ioctlfd); + if (noaction == 0) set_iff_up(ifi, ioctlfd); - } close(ioctlfd); @@ -389,25 +386,6 @@ get_ssid(struct interface_info *ifi, int ioctlfd) } } -void -set_autoconf(struct interface_info *ifi, int ioctlfd) -{ - struct ifreq ifr; - - memset(&ifr, 0, sizeof(ifr)); - strlcpy(ifr.ifr_name, ifi->name, sizeof(ifr.ifr_name)); - - if (ioctl(ioctlfd, SIOCGIFXFLAGS, (caddr_t)&ifr) < 0) - fatal("SIOGIFXFLAGS"); - if ((ifr.ifr_flags & IFXF_AUTOCONF4) == 0) { - ifr.ifr_flags |= IFXF_AUTOCONF4; - if (ioctl(ioctlfd, SIOCSIFXFLAGS, (caddr_t)&ifr) == -1) - fatal("SIOCSIFXFLAGS"); - } - - ifi->flags |= IFI_AUTOCONF; -} - void set_iff_up(struct interface_info *ifi, int ioctlfd) { @@ -568,19 +546,6 @@ rtm_dispatch(struct interface_info *ifi, struct rt_msghdr *rtm) if ((rtm->rtm_flags & RTF_UP) == 0) fatalx("down"); - if ((ifm->ifm_xflags & IFXF_AUTOCONF4) == 0 && - (ifi->flags & IFI_AUTOCONF) != 0) { - /* Tell unwind when IFI_AUTOCONF is cleared. */ - tell_unwind(NULL, ifi->flags); - ifi->flags &= ~IFI_AUTOCONF; - } else if ((ifm->ifm_xflags & IFXF_AUTOCONF4) != 0 && - (ifi->flags & IFI_AUTOCONF) == 0) { - /* Get new lease when IFI_AUTOCONF is set. */ - ifi->flags |= IFI_AUTOCONF; - quit = RESTART; - break; - } - oldmtu = ifi->mtu; interface_state(ifi); if (oldmtu == ifi->mtu) @@ -629,7 +594,6 @@ rtm_dispatch(struct interface_info *ifi, struct rt_msghdr *rtm) * Responsibility for resolv.conf may have changed hands. */ if (quit == 0 && ifi->active != NULL && - (ifi->flags & IFI_AUTOCONF) != 0 && (ifi->flags & IFI_IN_CHARGE) != 0 && ifi->state == S_BOUND) write_resolv_conf(); diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 57c0af2bcf5..6634baaba25 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.294 2021/02/22 23:43:59 jsg Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.295 2021/02/24 16:18:59 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -129,7 +129,6 @@ struct interface_info { int rdomain; int flags; #define IFI_IN_CHARGE 0x01 -#define IFI_AUTOCONF 0x02 uint32_t mtu; struct dhcp_packet recv_packet; struct dhcp_packet sent_packet; diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c index b1beeb6855e..97cd817819f 100644 --- a/sbin/dhclient/kroute.c +++ b/sbin/dhclient/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.194 2021/02/01 16:29:22 cheloha Exp $ */ +/* $OpenBSD: kroute.c,v 1.195 2021/02/24 16:18:59 krw Exp $ */ /* * Copyright 2012 Kenneth R Westerback @@ -917,7 +917,6 @@ priv_propose(char *name, int ioctlfd, struct proposal *proposal, int *lastidx) { struct unwind_info unwind_info; - struct ifreq ifr; uint8_t *dns, *domains, *routes; char *search = NULL; int rslt; @@ -932,13 +931,6 @@ priv_propose(char *name, int ioctlfd, struct proposal *proposal, domains = routes + proposal->routes_len; dns = domains + proposal->domains_len; - memset(&ifr, 0, sizeof(ifr)); - strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); - if (ioctl(ioctlfd, SIOCGIFXFLAGS, (caddr_t)&ifr) < 0) - fatal("SIOGIFXFLAGS"); - if ((ifr.ifr_flags & IFXF_AUTOCONF4) == 0) - return; - memset(&unwind_info, 0, sizeof(unwind_info)); if (proposal->ns_len >= sizeof(in_addr_t)) { if (proposal->ns_len > sizeof(unwind_info.ns)) { @@ -1016,8 +1008,7 @@ tell_unwind(struct unwind_info *unwind_info, int ifi_flags) struct unwind_info noinfo; int rslt; - if ((ifi_flags & IFI_AUTOCONF) == 0 || - (ifi_flags & IFI_IN_CHARGE) == 0) + if ((ifi_flags & IFI_IN_CHARGE) == 0) return; if (unwind_info != NULL) -- 2.20.1