Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
NetworkManager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
145
Issues
145
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NetworkManager
NetworkManager
Commits
5e71f016
Commit
5e71f016
authored
Mar 02, 2019
by
Thomas Haller
9
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
device: merge stage3 and stage4 ip-config function for IPv4 and IPv6
parent
03b708f7
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
378 additions
and
517 deletions
+378
-517
src/devices/adsl/nm-device-adsl.c
src/devices/adsl/nm-device-adsl.c
+13
-1
src/devices/bluetooth/nm-device-bt.c
src/devices/bluetooth/nm-device-bt.c
+18
-23
src/devices/nm-device-ethernet.c
src/devices/nm-device-ethernet.c
+13
-10
src/devices/nm-device-ppp.c
src/devices/nm-device-ppp.c
+22
-14
src/devices/nm-device.c
src/devices/nm-device.c
+197
-233
src/devices/nm-device.h
src/devices/nm-device.h
+7
-10
src/devices/ovs/nm-device-ovs-bridge.c
src/devices/ovs/nm-device-ovs-bridge.c
+5
-13
src/devices/ovs/nm-device-ovs-interface.c
src/devices/ovs/nm-device-ovs-interface.c
+7
-25
src/devices/ovs/nm-device-ovs-port.c
src/devices/ovs/nm-device-ovs-port.c
+5
-13
src/devices/wifi/nm-device-wifi-p2p.c
src/devices/wifi/nm-device-wifi-p2p.c
+16
-37
src/devices/wifi/nm-device-wifi.c
src/devices/wifi/nm-device-wifi.c
+49
-114
src/devices/wwan/nm-device-modem.c
src/devices/wwan/nm-device-modem.c
+25
-23
src/devices/wwan/nm-modem.c
src/devices/wwan/nm-modem.c
+1
-1
No files found.
src/devices/adsl/nm-device-adsl.c
View file @
5e71f016
...
...
@@ -518,6 +518,18 @@ act_stage3_ip4_config_start (NMDevice *device,
return
NM_ACT_STAGE_RETURN_POSTPONE
;
}
static
NMActStageReturn
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
if
(
addr_family
==
AF_INET
)
return
act_stage3_ip4_config_start
(
device
,
(
NMIP4Config
**
)
out_config
,
out_failure_reason
);
return
NM_DEVICE_CLASS
(
nm_device_adsl_parent_class
)
->
act_stage3_ip_config_start
(
device
,
addr_family
,
out_config
,
out_failure_reason
);
}
static
void
adsl_cleanup
(
NMDeviceAdsl
*
self
)
{
...
...
@@ -687,7 +699,7 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
device_class
->
complete_connection
=
complete_connection
;
device_class
->
act_stage2_config
=
act_stage2_config
;
device_class
->
act_stage3_ip
4_config_start
=
act_stage3_ip4
_config_start
;
device_class
->
act_stage3_ip
_config_start
=
act_stage3_ip
_config_start
;
device_class
->
deactivate
=
deactivate
;
obj_properties
[
PROP_ATM_INDEX
]
=
...
...
src/devices/bluetooth/nm-device-bt.c
View file @
5e71f016
...
...
@@ -899,33 +899,29 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
}
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMDeviceBtPrivate
*
priv
=
NM_DEVICE_BT_GET_PRIVATE
((
NMDeviceBt
*
)
device
);
nm_assert_addr_family
(
addr_family
);
if
(
priv
->
bt_type
==
NM_BT_CAPABILITY_DUN
)
{
return
nm_modem_stage3_ip4_config_start
(
priv
->
modem
,
device
,
NM_DEVICE_CLASS
(
nm_device_bt_parent_class
),
out_failure_reason
);
if
(
addr_family
==
AF_INET
)
{
return
nm_modem_stage3_ip4_config_start
(
priv
->
modem
,
device
,
NM_DEVICE_CLASS
(
nm_device_bt_parent_class
),
out_failure_reason
);
}
else
{
return
nm_modem_stage3_ip6_config_start
(
priv
->
modem
,
device
,
out_failure_reason
);
}
}
return
NM_DEVICE_CLASS
(
nm_device_bt_parent_class
)
->
act_stage3_ip4_config_start
(
device
,
out_config
,
out_failure_reason
);
}
static
NMActStageReturn
act_stage3_ip6_config_start
(
NMDevice
*
device
,
NMIP6Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMDeviceBtPrivate
*
priv
=
NM_DEVICE_BT_GET_PRIVATE
((
NMDeviceBt
*
)
device
);
if
(
priv
->
bt_type
==
NM_BT_CAPABILITY_DUN
)
return
nm_modem_stage3_ip6_config_start
(
priv
->
modem
,
device
,
out_failure_reason
);
return
NM_DEVICE_CLASS
(
nm_device_bt_parent_class
)
->
act_stage3_ip6_config_start
(
device
,
out_config
,
out_failure_reason
);
return
NM_DEVICE_CLASS
(
nm_device_bt_parent_class
)
->
act_stage3_ip_config_start
(
device
,
addr_family
,
out_config
,
out_failure_reason
);
}
static
void
...
...
@@ -1204,8 +1200,7 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
device_class
->
can_auto_connect
=
can_auto_connect
;
device_class
->
deactivate
=
deactivate
;
device_class
->
act_stage2_config
=
act_stage2_config
;
device_class
->
act_stage3_ip4_config_start
=
act_stage3_ip4_config_start
;
device_class
->
act_stage3_ip6_config_start
=
act_stage3_ip6_config_start
;
device_class
->
act_stage3_ip_config_start
=
act_stage3_ip_config_start
;
device_class
->
check_connection_compatible
=
check_connection_compatible
;
device_class
->
check_connection_available
=
check_connection_available
;
device_class
->
complete_connection
=
complete_connection
;
...
...
src/devices/nm-device-ethernet.c
View file @
5e71f016
...
...
@@ -1314,22 +1314,25 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
}
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMSettingConnection
*
s_con
;
const
char
*
connection_type
;
s_con
=
nm_device_get_applied_setting
(
device
,
NM_TYPE_SETTING_CONNECTION
);
if
(
addr_family
==
AF_INET
)
{
s_con
=
nm_device_get_applied_setting
(
device
,
NM_TYPE_SETTING_CONNECTION
);
g_return_val_if_fail
(
s_con
,
NM_ACT_STAGE_RETURN_FAILURE
);
g_return_val_if_fail
(
s_con
,
NM_ACT_STAGE_RETURN_FAILURE
);
connection_type
=
nm_setting_connection_get_connection_type
(
s_con
);
if
(
!
strcmp
(
connection_type
,
NM_SETTING_PPPOE_SETTING_NAME
))
return
pppoe_stage3_ip4_config_start
(
NM_DEVICE_ETHERNET
(
device
),
out_failure_reason
);
connection_type
=
nm_setting_connection_get_connection_type
(
s_con
);
if
(
!
strcmp
(
connection_type
,
NM_SETTING_PPPOE_SETTING_NAME
))
return
pppoe_stage3_ip4_config_start
(
NM_DEVICE_ETHERNET
(
device
),
out_failure_reason
);
}
return
NM_DEVICE_CLASS
(
nm_device_ethernet_parent_class
)
->
act_stage3_ip
4_config_start
(
device
,
out_config
,
out_failure_reason
);
return
NM_DEVICE_CLASS
(
nm_device_ethernet_parent_class
)
->
act_stage3_ip
_config_start
(
device
,
addr_family
,
out_config
,
out_failure_reason
);
}
static
guint32
...
...
@@ -1791,7 +1794,7 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
device_class
->
act_stage1_prepare
=
act_stage1_prepare
;
device_class
->
act_stage2_config
=
act_stage2_config
;
device_class
->
act_stage3_ip
4_config_start
=
act_stage3_ip4
_config_start
;
device_class
->
act_stage3_ip
_config_start
=
act_stage3_ip
_config_start
;
device_class
->
get_configured_mtu
=
get_configured_mtu
;
device_class
->
deactivate
=
deactivate
;
device_class
->
get_s390_subchannels
=
get_s390_subchannels
;
...
...
src/devices/nm-device-ppp.c
View file @
5e71f016
...
...
@@ -173,23 +173,31 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
}
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMDevicePpp
*
self
=
NM_DEVICE_PPP
(
device
);
NMDevicePppPrivate
*
priv
=
NM_DEVICE_PPP_GET_PRIVATE
(
self
);
if
(
addr_family
==
AF_INET
)
{
NMDevicePpp
*
self
=
NM_DEVICE_PPP
(
device
);
NMDevicePppPrivate
*
priv
=
NM_DEVICE_PPP_GET_PRIVATE
(
self
);
if
(
priv
->
ip4_config
)
{
if
(
out_config
)
*
out_config
=
g_steal_pointer
(
&
priv
->
ip4_config
);
else
g_clear_object
(
&
priv
->
ip4_config
);
return
NM_ACT_STAGE_RETURN_SUCCESS
;
}
if
(
priv
->
ip4_config
)
{
if
(
out_config
)
*
out_config
=
g_steal_pointer
(
&
priv
->
ip4_config
);
else
g_clear_object
(
&
priv
->
ip4_config
);
return
NM_ACT_STAGE_RETURN_SUCCESS
;
/* Wait IPCP termination */
return
NM_ACT_STAGE_RETURN_POSTPONE
;
}
/* Wait IPCP termination */
return
NM_ACT_STAGE_RETURN_POSTPONE
;
return
NM_DEVICE_CLASS
(
nm_device_ppp_parent_class
)
->
act_stage3_ip_config_start
(
device
,
addr_family
,
out_config
,
out_failure_reason
);
}
static
gboolean
...
...
@@ -271,7 +279,7 @@ nm_device_ppp_class_init (NMDevicePppClass *klass)
device_class
->
link_types
=
NM_DEVICE_DEFINE_LINK_TYPES
(
NM_LINK_TYPE_PPP
);
device_class
->
act_stage2_config
=
act_stage2_config
;
device_class
->
act_stage3_ip
4_config_start
=
act_stage3_ip4
_config_start
;
device_class
->
act_stage3_ip
_config_start
=
act_stage3_ip
_config_start
;
device_class
->
create_and_realize
=
create_and_realize
;
device_class
->
deactivate
=
deactivate
;
device_class
->
get_generic_capabilities
=
get_generic_capabilities
;
...
...
src/devices/nm-device.c
View file @
5e71f016
This diff is collapsed.
Click to expand it.
src/devices/nm-device.h
View file @
5e71f016
...
...
@@ -369,16 +369,13 @@ typedef struct _NMDeviceClass {
NMDeviceStateReason
*
out_failure_reason
);
NMActStageReturn
(
*
act_stage2_config
)
(
NMDevice
*
self
,
NMDeviceStateReason
*
out_failure_reason
);
NMActStageReturn
(
*
act_stage3_ip4_config_start
)
(
NMDevice
*
self
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
);
NMActStageReturn
(
*
act_stage3_ip6_config_start
)
(
NMDevice
*
self
,
NMIP6Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
);
NMActStageReturn
(
*
act_stage4_ip4_config_timeout
)
(
NMDevice
*
self
,
NMDeviceStateReason
*
out_failure_reason
);
NMActStageReturn
(
*
act_stage4_ip6_config_timeout
)
(
NMDevice
*
self
,
NMDeviceStateReason
*
out_failure_reason
);
NMActStageReturn
(
*
act_stage3_ip_config_start
)
(
NMDevice
*
self
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
);
NMActStageReturn
(
*
act_stage4_ip_config_timeout
)
(
NMDevice
*
self
,
int
addr_family
,
NMDeviceStateReason
*
out_failure_reason
);
void
(
*
ip4_config_pre_commit
)
(
NMDevice
*
self
,
NMIP4Config
*
config
);
...
...
src/devices/ovs/nm-device-ovs-bridge.c
View file @
5e71f016
...
...
@@ -77,17 +77,10 @@ get_generic_capabilities (NMDevice *device)
}
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
return
NM_ACT_STAGE_RETURN_IP_FAIL
;
}
static
NMActStageReturn
act_stage3_ip6_config_start
(
NMDevice
*
device
,
NMIP6Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
return
NM_ACT_STAGE_RETURN_IP_FAIL
;
}
...
...
@@ -146,8 +139,7 @@ nm_device_ovs_bridge_class_init (NMDeviceOvsBridgeClass *klass)
device_class
->
create_and_realize
=
create_and_realize
;
device_class
->
unrealize
=
unrealize
;
device_class
->
get_generic_capabilities
=
get_generic_capabilities
;
device_class
->
act_stage3_ip4_config_start
=
act_stage3_ip4_config_start
;
device_class
->
act_stage3_ip6_config_start
=
act_stage3_ip6_config_start
;
device_class
->
act_stage3_ip_config_start
=
act_stage3_ip_config_start
;
device_class
->
enslave_slave
=
enslave_slave
;
device_class
->
release_slave
=
release_slave
;
}
src/devices/ovs/nm-device-ovs-interface.c
View file @
5e71f016
...
...
@@ -131,39 +131,22 @@ _is_internal_interface (NMDevice *device)
}
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMDeviceOvsInterfacePrivate
*
priv
=
NM_DEVICE_OVS_INTERFACE_GET_PRIVATE
(
device
);
if
(
!
_is_internal_interface
(
device
))
return
NM_ACT_STAGE_RETURN_IP_FAIL
;
if
(
!
nm_device_get_ip_ifindex
(
device
)
)
{
if
(
nm_device_get_ip_ifindex
(
device
)
<=
0
)
{
priv
->
waiting_for_interface
=
TRUE
;
return
NM_ACT_STAGE_RETURN_POSTPONE
;
}
return
NM_DEVICE_CLASS
(
nm_device_ovs_interface_parent_class
)
->
act_stage3_ip4_config_start
(
device
,
out_config
,
out_failure_reason
);
}
static
NMActStageReturn
act_stage3_ip6_config_start
(
NMDevice
*
device
,
NMIP6Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMDeviceOvsInterfacePrivate
*
priv
=
NM_DEVICE_OVS_INTERFACE_GET_PRIVATE
(
device
);
if
(
!
_is_internal_interface
(
device
))
return
NM_ACT_STAGE_RETURN_IP_FAIL
;
if
(
!
nm_device_get_ip_ifindex
(
device
))
{
priv
->
waiting_for_interface
=
TRUE
;
return
NM_ACT_STAGE_RETURN_POSTPONE
;
}
return
NM_DEVICE_CLASS
(
nm_device_ovs_interface_parent_class
)
->
act_stage3_ip6_config_start
(
device
,
out_config
,
out_failure_reason
);
return
NM_DEVICE_CLASS
(
nm_device_ovs_interface_parent_class
)
->
act_stage3_ip_config_start
(
device
,
addr_family
,
out_config
,
out_failure_reason
);
}
static
gboolean
...
...
@@ -207,7 +190,6 @@ nm_device_ovs_interface_class_init (NMDeviceOvsInterfaceClass *klass)
device_class
->
is_available
=
is_available
;
device_class
->
check_connection_compatible
=
check_connection_compatible
;
device_class
->
link_changed
=
link_changed
;
device_class
->
act_stage3_ip4_config_start
=
act_stage3_ip4_config_start
;
device_class
->
act_stage3_ip6_config_start
=
act_stage3_ip6_config_start
;
device_class
->
act_stage3_ip_config_start
=
act_stage3_ip_config_start
;
device_class
->
can_unmanaged_external_down
=
can_unmanaged_external_down
;
}
src/devices/ovs/nm-device-ovs-port.c
View file @
5e71f016
...
...
@@ -71,17 +71,10 @@ get_generic_capabilities (NMDevice *device)
}
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
return
NM_ACT_STAGE_RETURN_IP_FAIL
;
}
static
NMActStageReturn
act_stage3_ip6_config_start
(
NMDevice
*
device
,
NMIP6Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
return
NM_ACT_STAGE_RETURN_IP_FAIL
;
}
...
...
@@ -186,8 +179,7 @@ nm_device_ovs_port_class_init (NMDeviceOvsPortClass *klass)
device_class
->
get_type_description
=
get_type_description
;
device_class
->
create_and_realize
=
create_and_realize
;
device_class
->
get_generic_capabilities
=
get_generic_capabilities
;
device_class
->
act_stage3_ip4_config_start
=
act_stage3_ip4_config_start
;
device_class
->
act_stage3_ip6_config_start
=
act_stage3_ip6_config_start
;
device_class
->
act_stage3_ip_config_start
=
act_stage3_ip_config_start
;
device_class
->
enslave_slave
=
enslave_slave
;
device_class
->
release_slave
=
release_slave
;
}
src/devices/wifi/nm-device-wifi-p2p.c
View file @
5e71f016
...
...
@@ -583,50 +583,30 @@ remove_all_peers (NMDeviceWifiP2P *self)
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
gboolean
indicate_addressing_running
;
NMConnection
*
connection
;
NMSettingIPConfig
*
s_ip4
;
const
char
*
method
=
NM_SETTING_IP4_CONFIG_METHOD_AUTO
;
const
char
*
method
;
connection
=
nm_device_get_applied_connection
(
device
);
g_return_val_if_fail
(
connection
,
NM_ACT_STAGE_RETURN_FAILURE
);
s_ip4
=
nm_connection_get_setting_ip4_config
(
connection
);
if
(
s_ip4
)
method
=
nm_setting_ip_config_get_method
(
s_ip4
);
/* Indicate that a critical protocol is about to start */
if
(
nm_streq
(
method
,
NM_SETTING_IP4_CONFIG_METHOD_AUTO
))
nm_platform_wifi_indicate_addressing_running
(
nm_device_get_platform
(
device
),
nm_device_get_ip_ifindex
(
device
),
TRUE
);
method
=
nm_utils_get_ip_config_method
(
connection
,
addr_family
);
return
NM_DEVICE_CLASS
(
nm_device_wifi_p2p_parent_class
)
->
act_stage3_ip4_config_start
(
device
,
out_config
,
out_failure_reason
);
}
static
NMActStageReturn
act_stage3_ip6_config_start
(
NMDevice
*
device
,
NMIP6Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMConnection
*
connection
;
NMSettingIPConfig
*
s_ip6
;
const
char
*
method
=
NM_SETTING_IP6_CONFIG_METHOD_AUTO
;
connection
=
nm_device_get_applied_connection
(
device
);
g_return_val_if_fail
(
connection
,
NM_ACT_STAGE_RETURN_FAILURE
);
s_ip6
=
nm_connection_get_setting_ip6_config
(
connection
);
if
(
s_ip6
)
method
=
nm_setting_ip_config_get_method
(
s_ip6
);
if
(
addr_family
==
AF_INET
)
indicate_addressing_running
=
NM_IN_STRSET
(
method
,
NM_SETTING_IP4_CONFIG_METHOD_AUTO
);
else
{
indicate_addressing_running
=
NM_IN_STRSET
(
method
,
NM_SETTING_IP6_CONFIG_METHOD_AUTO
,
NM_SETTING_IP6_CONFIG_METHOD_DHCP
);
}
/* Indicate that a critical protocol is about to start */
if
(
NM_IN_STRSET
(
method
,
NM_SETTING_IP6_CONFIG_METHOD_AUTO
NM_SETTING_IP6_CONFIG_METHOD_DHCP
))
if
(
indicate_addressing_running
)
nm_platform_wifi_indicate_addressing_running
(
nm_device_get_platform
(
device
),
nm_device_get_ip_ifindex
(
device
),
TRUE
);
return
NM_DEVICE_CLASS
(
nm_device_wifi_p2p_parent_class
)
->
act_stage3_ip
6_config_start
(
device
,
out_config
,
out_failure_reason
);
return
NM_DEVICE_CLASS
(
nm_device_wifi_p2p_parent_class
)
->
act_stage3_ip
_config_start
(
device
,
addr_family
,
out_config
,
out_failure_reason
);
}
static
void
...
...
@@ -1315,8 +1295,7 @@ nm_device_wifi_p2p_class_init (NMDeviceWifiP2PClass *klass)
device_class
->
act_stage2_config
=
act_stage2_config
;
device_class
->
get_configured_mtu
=
get_configured_mtu
;
device_class
->
get_auto_ip_config_method
=
get_auto_ip_config_method
;
device_class
->
act_stage3_ip4_config_start
=
act_stage3_ip4_config_start
;
device_class
->
act_stage3_ip6_config_start
=
act_stage3_ip6_config_start
;
device_class
->
act_stage3_ip_config_start
=
act_stage3_ip_config_start
;
device_class
->
deactivate
=
deactivate
;
device_class
->
unmanaged_on_quit
=
unmanaged_on_quit
;
...
...
src/devices/wifi/nm-device-wifi.c
View file @
5e71f016
...
...
@@ -2874,52 +2874,29 @@ out:
}
static
NMActStageReturn
act_stage3_ip4_config_start
(
NMDevice
*
device
,
NMIP4Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage3_ip_config_start
(
NMDevice
*
device
,
int
addr_family
,
gpointer
*
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
gboolean
indicate_addressing_running
;
NMConnection
*
connection
;
NMSettingIPConfig
*
s_ip4
;
const
char
*
method
=
NM_SETTING_IP4_CONFIG_METHOD_AUTO
;
const
char
*
method
;
connection
=
nm_device_get_applied_connection
(
device
);
g_return_val_if_fail
(
connection
,
NM_ACT_STAGE_RETURN_FAILURE
);
s_ip4
=
nm_connection_get_setting_ip4_config
(
connection
);
if
(
s_ip4
)
method
=
nm_setting_ip_config_get_method
(
s_ip4
);
/* Indicate that a critical protocol is about to start */
if
(
strcmp
(
method
,
NM_SETTING_IP4_CONFIG_METHOD_AUTO
)
==
0
)
nm_platform_wifi_indicate_addressing_running
(
nm_device_get_platform
(
device
),
nm_device_get_ifindex
(
device
),
TRUE
);
return
NM_DEVICE_CLASS
(
nm_device_wifi_parent_class
)
->
act_stage3_ip4_config_start
(
device
,
out_config
,
out_failure_reason
);
}
static
NMActStageReturn
act_stage3_ip6_config_start
(
NMDevice
*
device
,
NMIP6Config
**
out_config
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMConnection
*
connection
;
NMSettingIPConfig
*
s_ip6
;
const
char
*
method
=
NM_SETTING_IP6_CONFIG_METHOD_AUTO
;
connection
=
nm_device_get_applied_connection
(
device
);
g_return_val_if_fail
(
connection
,
NM_ACT_STAGE_RETURN_FAILURE
);
s_ip6
=
nm_connection_get_setting_ip6_config
(
connection
);
if
(
s_ip6
)
method
=
nm_setting_ip_config_get_method
(
s_ip6
);
method
=
nm_utils_get_ip_config_method
(
connection
,
addr_family
);
if
(
addr_family
==
AF_INET
)
indicate_addressing_running
=
NM_IN_STRSET
(
method
,
NM_SETTING_IP4_CONFIG_METHOD_AUTO
);
else
{
indicate_addressing_running
=
NM_IN_STRSET
(
method
,
NM_SETTING_IP6_CONFIG_METHOD_AUTO
,
NM_SETTING_IP6_CONFIG_METHOD_DHCP
);
}
/* Indicate that a critical protocol is about to start */
if
(
strcmp
(
method
,
NM_SETTING_IP6_CONFIG_METHOD_AUTO
)
==
0
||
strcmp
(
method
,
NM_SETTING_IP6_CONFIG_METHOD_DHCP
)
==
0
)
nm_platform_wifi_indicate_addressing_running
(
nm_device_get_platform
(
device
),
nm_device_get_ifindex
(
device
),
TRUE
);
if
(
indicate_addressing_running
)
nm_platform_wifi_indicate_addressing_running
(
nm_device_get_platform
(
device
),
nm_device_get_ip_ifindex
(
device
),
TRUE
);
return
NM_DEVICE_CLASS
(
nm_device_wifi_parent_class
)
->
act_stage3_ip
6_config_start
(
device
,
out_config
,
out_failure_reason
);
return
NM_DEVICE_CLASS
(
nm_device_wifi_parent_class
)
->
act_stage3_ip
_config_start
(
device
,
addr_family
,
out_config
,
out_failure_reason
);
}
static
guint32
...
...
@@ -2954,19 +2931,27 @@ is_static_wep (NMConnection *connection)
}
static
NMActStageReturn
handle_ip_config_timeout
(
NMDeviceWifi
*
self
,
NMConnection
*
connection
,
gboolean
may_fail
,
gboolean
*
chain_up
,
NMDeviceStateReason
*
out_failure_reason
)
act_stage4_ip_config_timeout
(
NMDevice
*
device
,
int
addr_family
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMActStageReturn
ret
=
NM_ACT_STAGE_RETURN_FAILURE
;
NMDeviceWifi
*
self
=
NM_DEVICE_WIFI
(
device
);
NMDeviceWifiPrivate
*
priv
=
NM_DEVICE_WIFI_GET_PRIVATE
(
self
);
NMConnection
*
connection
;
NMSettingIPConfig
*
s_ip
;
gboolean
may_fail
;
g_return_val_if_fail
(
connection
!=
NULL
,
NM_ACT_STAGE_RETURN_FAILURE
);
connection
=
nm_device_get_applied_connection
(
device
);
s_ip
=
nm_connection_get_setting_ip4_config
(
connection
);
may_fail
=
nm_setting_ip_config_get_may_fail
(
s_ip
);
if
(
NM_DEVICE_WIFI_GET_PRIVATE
(
self
)
->
mode
==
NM_802_11_MODE_AP
)
{
*
chain_up
=
TRUE
;
return
NM_ACT_STAGE_RETURN_FAILURE
;
if
(
priv
->
mode
==
NM_802_11_MODE_AP
)
goto
call_parent
;
if
(
may_fail
&&
!
is_static_wep
(
connection
))
{
/* Not static WEP or failure allowed; let superclass handle it */
goto
call_parent
;
}
/* If IP configuration times out and it's a static WEP connection, that
...
...
@@ -2975,71 +2960,23 @@ handle_ip_config_timeout (NMDeviceWifi *self,
* to wait for DHCP to fail to figure it out. For all other Wi-Fi security
* types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the
* connection would have failed before IP configuration.
*/
if
(
!
may_fail
&&
is_static_wep
(
connection
))
{
/* Activation failed, we must have bad encryption key */
_LOGW
(
LOGD_DEVICE
|
LOGD_WIFI
,
"Activation: (wifi) could not get IP configuration for connection '%s'."
,
nm_connection_get_id
(
connection
));
*
* Activation failed, we must have bad encryption key */
_LOGW
(
LOGD_DEVICE
|
LOGD_WIFI
,
"Activation: (wifi) could not get IP configuration for connection '%s'."
,
nm_connection_get_id
(
connection
));
if
(
handle_auth_or_fail
(
self
,
NULL
,
TRUE
))
{
_LOGI
(
LOGD_DEVICE
|
LOGD_WIFI
,
"Activation: (wifi) asking for new secrets"
);
ret
=
NM_ACT_STAGE_RETURN_POSTPONE
;
}
else
{
NM_SET_OUT
(
out_failure_reason
,
NM_DEVICE_STATE_REASON_NO_SECRETS
);
ret
=
NM_ACT_STAGE_RETURN_FAILURE
;
}
}
else
{
/* Not static WEP or failure allowed; let superclass handle it */
*
chain_up
=
TRUE
;
if
(
!
handle_auth_or_fail
(
self
,
NULL
,
TRUE
))
{
NM_SET_OUT
(
out_failure_reason
,
NM_DEVICE_STATE_REASON_NO_SECRETS
);
return
NM_ACT_STAGE_RETURN_FAILURE
;
}
return
ret
;
}
static
NMActStageReturn
act_stage4_ip4_config_timeout
(
NMDevice
*
device
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMConnection
*
connection
;
NMSettingIPConfig
*
s_ip4
;
gboolean
may_fail
=
FALSE
,
chain_up
=
FALSE
;
NMActStageReturn
ret
;
connection
=
nm_device_get_applied_connection
(
device
);
g_return_val_if_fail
(
connection
,
NM_ACT_STAGE_RETURN_FAILURE
);
s_ip4
=
nm_connection_get_setting_ip4_config
(
connection
);
may_fail
=
nm_setting_ip_config_get_may_fail
(
s_ip4
);
ret
=
handle_ip_config_timeout
(
NM_DEVICE_WIFI
(
device
),
connection
,
may_fail
,
&
chain_up
,
out_failure_reason
);
if
(
chain_up
)
ret
=
NM_DEVICE_CLASS
(
nm_device_wifi_parent_class
)
->
act_stage4_ip4_config_timeout
(
device
,
out_failure_reason
);
return
ret
;
}
static
NMActStageReturn
act_stage4_ip6_config_timeout
(
NMDevice
*
device
,
NMDeviceStateReason
*
out_failure_reason
)
{
NMConnection
*
connection
;
NMSettingIPConfig
*
s_ip6
;
gboolean
may_fail
=
FALSE
,
chain_up
=
FALSE
;
NMActStageReturn
ret
;
connection
=
nm_device_get_applied_connection
(
device
);
g_return_val_if_fail
(
connection
,
NM_ACT_STAGE_RETURN_FAILURE
);
s_ip6
=
nm_connection_get_setting_ip6_config
(
connection
);
may_fail
=
nm_setting_ip_config_get_may_fail
(
s_ip6
);
ret
=
handle_ip_config_timeout
(
NM_DEVICE_WIFI
(
device
),
connection
,
may_fail
,
&
chain_up
,
out_failure_reason
);
if
(
chain_up
)
ret
=
NM_DEVICE_CLASS
(
nm_device_wifi_parent_class
)
->
act_stage4_ip6_config_timeout
(
device
,
out_failure_reason
);
_LOGI
(
LOGD_DEVICE
|
LOGD_WIFI
,
"Activation: (wifi) asking for new secrets"
);
return
NM_ACT_STAGE_RETURN_POSTPONE
;
return
ret
;
call_parent:
return
NM_DEVICE_CLASS
(
nm_device_wifi_parent_class
)
->
act_stage4_ip_config_timeout
(
device
,
addr_family
,
out_failure_reason
);
}
static
void
...
...
@@ -3447,10 +3384,8 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
device_class
->
act_stage1_prepare
=
act_stage1_prepare
;