[Merge] ~joalif/ubuntu/+source/systemd:lp2003250-jammy into ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-jammy

Ioanna Alifieraki mp+476130 at code.launchpad.net
Mon Nov 18 16:50:36 UTC 2024


Nick thank you very much for your comment. I looked further into it and here are my findings.

TLDR; The state is never set back to 'configured' because the patch in order to avoid bringing the interfaces down and up sets the master in
link_is_ready_to_call_set_link() and makes request_process_set_link() return without calling link_configure (in networkd-setlink.c).
The link state is to configured in link_check_ready() which is down the call-chain from link_configure().

Details:
When we issue 'networkctl reload' 3 requests are performed for each interface, however in this case we focus only on the request to set the master,
because this is where the regression happens.

When issuing 'networkctl reload' in systemd-networkd link_reconfigure() is called.
This will at some point link_configure() in  networkd-link.c, this is where the state is set to 'configuring'.
The important function calls are as follows:
link_configure in networkd-link.c ->
link_request_to_set_master() -> 
link_request_set_link(link, SET_LINK_MASTER, link_set_master_handler, NULL) ->
link_queue_request(link, REQUEST_TYPE_SET_LINK, INT_TO_PTR(op), false, &link->set_link_messages, netlink_handler, &req);

At this point the request (to set the master) is queued on link->manager->request_queue to be processed in manager_process_requests().
It is important to note here that link->set_link_messages is passed by reference and incremented.

manager_process_requests() calls request_process_set_link(req) which in turn calls link_is_ready_to_call_set_link(req).
These are the 2 functions the patch modifies.

-- Without the patch.
Without the patch request_process_set_link(req) calls link_is_ready_to_call_set_link(req) which checks if the netdev is ready and 
if so it grabs ifindex and stores it in req. After this link_configure (in networkd-setlink.c) is called.
Then through callbacks link_set_master_hanlder and eventually set_link_handler_internal() are called.
set_link_handler_internal() among other things will decrease link->set_link_messages, set the link->master_set = true (in get_link_master_handler)
and finally call link_check_ready().
In link_check_ready() the link state is set to configured if link->set_link_messages == 0.

-- With the patch.
With the patch we set link->master_set = true in link_is_ready_to_call_set_link(), return and cancel the request.
We bypass all the above steps which bring the interface down and up causing the network outage but we never set 
the link state back to configured.
-- 
https://code.launchpad.net/~joalif/ubuntu/+source/systemd/+git/systemd/+merge/476130
Your team Ubuntu Core Development Team is subscribed to branch ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-jammy.




More information about the Ubuntu-reviews mailing list