core/pppd-plugin: wait to recover port settings before notifying death

pppd restores the previous settings for the serial port it uses right
before exiting. It is especially important to do so because otherwise
ModemManager is not able to recover the port as it can receive a hangup
event from the port due to CLOCAL not being restored.  However, there is
currently a race condition that produces this issue. This is because
when PHASE_DEAD is notified, pppd still has not restored the port
settings - it does that a bit later, in the die() function.

This patch delays notifying PHASE_DEAD until when the exitnotify() hook
is called by pppd: when this happens the port settings have already been
restored.

There were previously efforts to fix this in commit fe090c34, so
PHASE_DEAD was used instead of PHASE_DISCONNECT to notify MM that the
port was disconnected, but that still early to ensure that the port
settings are restored.

The MM traces seen when the bug is triggered are:

ModemManager[2158]: <warn>  (ttyACM1): could not re-acquire serial port lock: (5) Input/output error
ModemManager[2158]: <warn>  Couldn't load Operator Code: 'Cannot run sequence: 'Could not open serial device ttyACM1: it has been forced close'

https://mail.gnome.org/archives/networkmanager-list/2019-June/msg00014.html

(cherry picked from commit a251712a)
(cherry picked from commit 3caa0657)
5 jobs for nm-1-16 in 127 minutes and 17 seconds (queued for 15 minutes and 31 seconds)
Status Job ID Name Coverage
  Test
passed #360050
build_f28

00:24:27

failed #360051
build_f29

02:06:18

passed #360052
build_f30

00:25:58

failed #360053
allowed to fail
build_frawhide

00:15:37

passed #360049
allowed to fail
checkpatch

00:01:10

 
Name Stage Failure
failed
build_f29 Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
[296/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-connection.c.o'.
[297/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-ip4-config.c.o'.
[298/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-macvlan.c.o'.
[299/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-olpc-mesh.c.o'.
[300/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/meson-generated_.._nm-core-enum-types.c.o'.
[301/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-ovs-bridge.c.o'.
[302/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-gsm.c.o'.
[303/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-macsec.c.o'.
[304/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-match.c.o'.
[305/936] Compiling C object 'libnm-core/2b1af02@@nm-core@sta/nm-setting-ovs-patch.c.o'.
failed
build_frawhide Test
UUID=3a1e7f7b-718f-4a46-900a-ae1c100a0396
BASEDIR=/builds/NetworkManager/NetworkManager/contrib/fedora/rpm/NetworkManager.20190614-121009.q24c21
warning: Macro expanded in comment on line 144: %{real_version_major}/%{name}-%{real_version}.tar.xz

error: This macro requires some arguments
error: line 858: %systemd_postun

ERROR: rpmbuild FAILED
ERROR: Job failed: exit code 1