core: sync IPv6 pre-commit hook with IPv4 behavior

The IPv4 pre-commit hook was called right before the config was
committed, while the IPv6 one was called before commit in only
one case (from nm_device_activate_ip6_config_commit).  The IPv4
behavior is the intended behavior.

Note that this doesn't have any actual effect yet, since nothing
actually implements the IPv6 pre-commit hook
This commit is contained in:
Dan Williams
2014-08-13 14:24:45 -05:00
parent 7c9d4e8f5a
commit 17e323fd22
2 changed files with 7 additions and 5 deletions

View File

@@ -3054,6 +3054,12 @@ ip6_config_merge_and_apply (NMDevice *self,
nm_ip6_config_addresses_sort (composite, nm_ip6_config_addresses_sort (composite,
priv->rdisc ? priv->rdisc_use_tempaddr : NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); priv->rdisc ? priv->rdisc_use_tempaddr : NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
/* Allow setting MTU etc */
if (commit) {
if (NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit)
NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit (self, composite);
}
success = nm_device_set_ip6_config (self, composite, commit, out_reason); success = nm_device_set_ip6_config (self, composite, commit, out_reason);
g_object_unref (composite); g_object_unref (composite);
return success; return success;
@@ -4626,10 +4632,6 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
/* Device should be up before we can do anything with it */ /* Device should be up before we can do anything with it */
g_warn_if_fail (nm_platform_link_is_up (nm_device_get_ip_ifindex (self))); g_warn_if_fail (nm_platform_link_is_up (nm_device_get_ip_ifindex (self)));
/* Allow setting MTU etc */
if (NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit)
NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit (self);
if (ip6_config_merge_and_apply (self, TRUE, &reason)) { if (ip6_config_merge_and_apply (self, TRUE, &reason)) {
/* If IPv6 wasn't the first IP to complete, and DHCP was used, /* If IPv6 wasn't the first IP to complete, and DHCP was used,
* then ensure dispatcher scripts get the DHCP lease information. * then ensure dispatcher scripts get the DHCP lease information.

View File

@@ -180,7 +180,7 @@ typedef struct {
/* Called right before IP config is set; use for setting MTU etc */ /* Called right before IP config is set; use for setting MTU etc */
void (* ip4_config_pre_commit) (NMDevice *self, NMIP4Config *config); void (* ip4_config_pre_commit) (NMDevice *self, NMIP4Config *config);
void (* ip6_config_pre_commit) (NMDevice *self); void (* ip6_config_pre_commit) (NMDevice *self, NMIP6Config *config);
void (* deactivate) (NMDevice *self); void (* deactivate) (NMDevice *self);