From cba05c10b1ef7e919e3fc2a2f1287fae42ea5566 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Wed, 22 May 2019 12:56:32 +0000 Subject: Don't get & apply a new lease for an RTM_IFINFO that reports a change to the MTU of the interface. Such message are generated by the application of a lease containing interface-mtu, and thus caused a duplicate lease negotiation and application when that option was present. This rapid duplication confused Google Compute Engine. Noticed and fix tested by Greg Steuck. Also tested by Bj??rn Ketelaars to make sure Dutch Railways still worked. Thanks! ok claudio@ --- sbin/dhclient/dhclient.c | 11 +++++++++-- sbin/dhclient/dhcpd.h | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index fe3ed74a1d5..c7df8d40cea 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.634 2019/05/10 18:50:11 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.635 2019/05/22 12:56:31 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -259,6 +259,8 @@ interface_state(struct interface_info *ifi) } else { ifi->link_state = ((struct if_data *)ifa->ifa_data)->ifi_link_state; + ifi->mtu = + ((struct if_data *)ifa->ifa_data)->ifi_mtu; } freeifaddrs(ifap); @@ -342,6 +344,7 @@ rtm_dispatch(struct interface_info *ifi, struct rt_msghdr *rtm) struct if_announcemsghdr *ifan; struct ifa_msghdr *ifam; struct if_ieee80211_data *ifie; + uint32_t oldmtu; switch (rtm->rtm_type) { case RTM_PROPOSAL: @@ -375,9 +378,13 @@ rtm_dispatch(struct interface_info *ifi, struct rt_msghdr *rtm) if ((rtm->rtm_flags & RTF_UP) == 0) fatalx("down"); + oldmtu = ifi->mtu; interface_state(ifi); - if (quit == 0) + if (oldmtu == ifi->mtu) quit = RESTART; + else + log_debug("%s: MTU change RTM_IFINFO ignored", + log_procname); break; case RTM_80211INFO: diff --git a/sbin/dhclient/dhcpd.h b/sbin/dhclient/dhcpd.h index 980777a629d..0505a39611e 100644 --- a/sbin/dhclient/dhcpd.h +++ b/sbin/dhclient/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.277 2019/04/02 02:59:43 krw Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.278 2019/05/22 12:56:31 krw Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -129,6 +129,7 @@ struct interface_info { int rdomain; int flags; #define IFI_IN_CHARGE 0x01 + uint32_t mtu; struct dhcp_packet recv_packet; struct dhcp_packet sent_packet; int sent_packet_length; -- cgit v1.2.3