ethernet: fix setting ip-ifindex for PPPoE connections

When a NMDevice is involved in a PPPoE activation, it means that the
connection has connection.interface-name=<ethernet-interface>. In such
case, the ppp ifindex should be set as ip-ifindex of the ethernet
device.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
This commit is contained in:
Beniamino Galvani 2022-03-15 17:44:49 +01:00
parent 7b2bea7ceb
commit aa9b5e28eb

View file

@ -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,