mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-28 08:40:49 +01:00
device: restart DHCP when the MAC changes
If the MAC changes there is the possibility that the DHCP client will not be able to renew the address because it uses the old MAC as CHADDR. Depending on the implementation, the DHCP server might use CHADDR (so, the old address) as the destination MAC for DHCP replies, and those packets will be lost. To avoid this problem, restart the DHCP client when the MAC changes. https://bugzilla.redhat.com/show_bug.cgi?id=2110000 (cherry picked from commit905adabdba) (cherry picked from commit5a49a2f6b2) (cherry picked from commitd0fb3fbf8e) (cherry picked from commit59a52510f3) (cherry picked from commit0766d08db9) (cherry picked from commit25abc22ac9)
This commit is contained in:
parent
943e84a2c1
commit
18c635779d
1 changed files with 9 additions and 6 deletions
|
|
@ -5394,9 +5394,10 @@ device_update_interface_flags(NMDevice *self, const NMPlatformLink *plink)
|
|||
static gboolean
|
||||
device_link_changed(NMDevice *self)
|
||||
{
|
||||
NMDeviceClass * klass = NM_DEVICE_GET_CLASS(self);
|
||||
NMDevicePrivate * priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
gboolean ip_ifname_changed = FALSE;
|
||||
NMDeviceClass * klass = NM_DEVICE_GET_CLASS(self);
|
||||
NMDevicePrivate * priv = NM_DEVICE_GET_PRIVATE(self);
|
||||
gboolean ip_ifname_changed = FALSE;
|
||||
gboolean hw_addr_changed;
|
||||
nm_auto_nmpobj const NMPObject *pllink_keep_alive = NULL;
|
||||
const NMPlatformLink * pllink;
|
||||
const char * str;
|
||||
|
|
@ -5443,9 +5444,9 @@ device_link_changed(NMDevice *self)
|
|||
if (ifindex == nm_device_get_ip_ifindex(self))
|
||||
_stats_update_counters_from_pllink(self, pllink);
|
||||
|
||||
had_hw_addr = (priv->hw_addr != NULL);
|
||||
nm_device_update_hw_address(self);
|
||||
got_hw_addr = (!had_hw_addr && priv->hw_addr);
|
||||
had_hw_addr = (priv->hw_addr != NULL);
|
||||
hw_addr_changed = nm_device_update_hw_address(self);
|
||||
got_hw_addr = (!had_hw_addr && priv->hw_addr);
|
||||
nm_device_update_permanent_hw_address(self, FALSE);
|
||||
|
||||
if (pllink->name[0] && !nm_streq(priv->iface, pllink->name)) {
|
||||
|
|
@ -5495,6 +5496,8 @@ device_link_changed(NMDevice *self)
|
|||
/* Update DHCP, etc, if needed */
|
||||
if (ip_ifname_changed)
|
||||
nm_device_update_dynamic_ip_setup(self, "IP interface changed");
|
||||
else if (hw_addr_changed)
|
||||
nm_device_update_dynamic_ip_setup(self, "hw-address changed");
|
||||
|
||||
was_up = priv->up;
|
||||
priv->up = NM_FLAGS_HAS(pllink->n_ifi_flags, IFF_UP);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue