OK, so with the magic of debug symbols and gdb on Cosmic:
(gdb) run
...
ens8: Gained IPv6LL
Assertion 'link->state == LINK_STATE_SETTING_ADDRESSES' failed at ../src/network/networkd-link.c:803, function link_enter_set_routes(). Aborting.
...
(gdb) up
#3 0x000055555566b194 in link_enter_set_routes (link=0x55555571d050) at ../src/network/networkd-link.c:803
803 ../src/network/networkd-link.c: No such file or directory.
(gdb) p link->state
$3 = LINK_STATE_PENDING
Looking at the code, it seems we are hitting link_enter_set_routes() before link_enter_set_addresses() which is where the state is set. We're hitting link_enter_set_routes() because link_check_ready() now calls it straight off the bat.
I think the backport just needs to add a check to not flow through to setting the routes until after we've gone through the process of setting the addresses; we can do that with the attached patch. (It applies to the cosmic version, I haven't tested it against Bionic.)
Having said that Dan you've obviously had a closer look at the code and more recently, what patches did you think were needed? It looks like perhaps you could solve this by backporting c42ff3a1a7bf ("networkd: Track address configuration")
and 289e6774d0da ("networkd: Use only a generic CONFIGURING state") - is that what you had in mind?
OK, so with the magic of debug symbols and gdb on Cosmic:
(gdb) run SETTING_ ADDRESSES' failed at ../src/ network/ networkd- link.c: 803, function link_enter_ set_routes( ). Aborting. set_routes (link=0x5555557 1d050) at ../src/ network/ networkd- link.c: 803 network/ networkd- link.c: No such file or directory.
...
ens8: Gained IPv6LL
Assertion 'link->state == LINK_STATE_
...
(gdb) up
#3 0x000055555566b194 in link_enter_
803 ../src/
(gdb) p link->state
$3 = LINK_STATE_PENDING
Looking at the code, it seems we are hitting link_enter_ set_routes( ) before link_enter_ set_addresses( ) which is where the state is set. We're hitting link_enter_ set_routes( ) because link_check_ready() now calls it straight off the bat.
I think the backport just needs to add a check to not flow through to setting the routes until after we've gone through the process of setting the addresses; we can do that with the attached patch. (It applies to the cosmic version, I haven't tested it against Bionic.)
Having said that Dan you've obviously had a closer look at the code and more recently, what patches did you think were needed? It looks like perhaps you could solve this by backporting c42ff3a1a7bf ("networkd: Track address configuration")
and 289e6774d0da ("networkd: Use only a generic CONFIGURING state") - is that what you had in mind?