wwan: wait for pppd to exit before relaying the port to ModemManager

System Internals / NetworkManager - Aleksander Morgado [aleksander.es] - 21 January 2015 18:36 EST

ModemManager needs to have CLOCAL set in the TTY termios configuration, in order to notify the kernel that modem control lines are not in effect (e.g. so that a transition to LOW in the DCD input control line doesn't trigger a hangup in the TTY).

pppd in the other hand, needs CLOCAL unset in order to have proper modem control lines in effect during the PPP session. So, when pppd starts it will store the original termios settings, and before exiting it will restore the original settings in the TTY. In other words, if CLOCAL was set before launching pppd, CLOCAL will be also set after pppd exits.

Now, in order for this sequence to work correctly, NetworkManager also needs to make sure that ModemManager is notified about the disconnection only after pppd has really finished re-configuring the TTY.


Once the patch is applied, we will be making sure that ModemManager is only notified about the disconnection AFTER pppd has fully exited: NetworkManager[27589]: (ttyUSB2): device state change: activated -> deactivating (reason 'user-requested') [100 110 39] Terminating on signal 15 nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 10 / phase 'terminate' nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network' Connect time 0.3 minutes. Sent 56 bytes, received 0 bytes. nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish' nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 11 / phase 'disconnect' Connection terminated. nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead' nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up NetworkManager[27589]: pppd pid 27617 exited with error: pppd received a signal NetworkManager[27589]: (ttyUSB2): modem state changed, 'connected' --> 'disconnecting' (reason: user-requested) NetworkManager[27589]: (ttyUSB2): modem state changed, 'disconnecting' --> 'registered' (reason: user-requested) NetworkManager[27589]: (ttyUSB2) modem deactivation finished NetworkManager[27589]: (ttyUSB2): device state change: deactivating -> disconnected (reason 'user-requested') [110 30 39] NetworkManager[27589]: (ttyUSB2): deactivating device (reason 'user-requested') [39]

fe090c3 wwan: wait for pppd to exit before relaying the port to ModemManager
src/devices/wwan/nm-device-modem.c | 46 ++++++++
src/devices/wwan/nm-modem-broadband.c | 8 +-
src/devices/wwan/nm-modem.c | 195 ++++++++++++++++++++++++++++++---
src/devices/wwan/nm-modem.h | 11 +-
src/devices/wwan/wwan-exports.ver | 2 +
5 files changed, 245 insertions(+), 17 deletions(-)

Upstream: cgit.freedesktop.org

  • Share