summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2022-03-16 11:13:55 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2022-03-16 11:13:55 +0100
commit3a8a1b0e26ef156ba579ff3aa6d1eb91a88496bd (patch)
tree3f965af4a684d07bd906d67f9212f144f69a6e64
parent2ffa6f7693586987790d87dce773af15fa08a472 (diff)
parentaa9b5e28eb6d85262c785b0ccd9c1d98c222089c (diff)
pppoe: merge branch 'bg/pppoe-fix'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1148
-rw-r--r--src/core/devices/nm-device-ethernet.c34
-rw-r--r--src/core/devices/nm-device-ppp.c7
2 files changed, 33 insertions, 8 deletions
diff --git a/src/core/devices/nm-device-ethernet.c b/src/core/devices/nm-device-ethernet.c
index 842d863e8f..4b6adfc13d 100644
--- a/src/core/devices/nm-device-ethernet.c
+++ b/src/core/devices/nm-device-ethernet.c
@@ -1163,11 +1163,10 @@ _ppp_mgr_callback(NMPppMgr *ppp_mgr, const NMPppMgrCallbackData *callback_data,
gs_free char *old_name = NULL;
gs_free_error GError *error = NULL;
- if (!nm_device_take_over_link(device, callback_data->data.ifindex, &old_name, &error)) {
+ if (!nm_device_set_ip_ifindex(device, callback_data->data.ifindex)) {
_LOGW(LOGD_DEVICE | LOGD_PPP,
- "could not take control of link %d: %s",
- callback_data->data.ifindex,
- error->message);
+ "could not set ip-ifindex %d",
+ callback_data->data.ifindex);
_ppp_mgr_cleanup(self);
nm_device_state_changed(device,
NM_DEVICE_STATE_FAILED,
@@ -1892,6 +1891,32 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
return !!nm_device_get_initial_hw_address(device);
}
+static const char *
+get_ip_method_auto(NMDevice *device, int addr_family)
+{
+ NMSettingConnection *s_con;
+
+ s_con = nm_device_get_applied_setting(device, NM_TYPE_SETTING_CONNECTION);
+ g_return_val_if_fail(s_con,
+ NM_IS_IPv4(addr_family) ? NM_SETTING_IP4_CONFIG_METHOD_AUTO
+ : NM_SETTING_IP6_CONFIG_METHOD_AUTO);
+
+ if (!nm_streq(nm_setting_connection_get_connection_type(s_con),
+ NM_SETTING_PPPOE_SETTING_NAME)) {
+ return NM_DEVICE_CLASS(nm_device_ethernet_parent_class)
+ ->get_ip_method_auto(device, addr_family);
+ }
+
+ if (NM_IS_IPv4(addr_family)) {
+ /* We cannot do DHCPv4 on a PPP link, instead we get "auto" IP addresses
+ * by pppd. Return "manual" here, which has the suitable effect to a
+ * (zero) manual addresses in addition. */
+ return NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
+ }
+
+ return NM_SETTING_IP6_CONFIG_METHOD_AUTO;
+}
+
static gboolean
can_reapply_change(NMDevice *device,
const char *setting_name,
@@ -2047,6 +2072,7 @@ nm_device_ethernet_class_init(NMDeviceEthernetClass *klass)
device_class->act_stage2_config = act_stage2_config;
device_class->act_stage3_ip_config = act_stage3_ip_config;
device_class->get_configured_mtu = get_configured_mtu;
+ device_class->get_ip_method_auto = get_ip_method_auto;
device_class->deactivate = deactivate;
device_class->get_s390_subchannels = get_s390_subchannels;
device_class->update_connection = update_connection;
diff --git a/src/core/devices/nm-device-ppp.c b/src/core/devices/nm-device-ppp.c
index 5ff3240107..61e32348c4 100644
--- a/src/core/devices/nm-device-ppp.c
+++ b/src/core/devices/nm-device-ppp.c
@@ -222,10 +222,9 @@ get_ip_method_auto(NMDevice *device, int addr_family)
return NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
}
- /* We can do autoconf6 on an PPP link, but we should already get an IPv6
- * address from pppd. Use that instead. We however do want to generate our
- * (own) IPv6 link local address, so return "link-local". */
- return NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL;
+ /* We get a interface identifier via IPV6CP, used to construct a link-local
+ * address. Method auto means autoconf6 as usual.*/
+ return NM_SETTING_IP6_CONFIG_METHOD_AUTO;
}
static gboolean