On Mon, Aug 29, 2016 at 01:08:30AM +0530, Sunil Mohan Adapa wrote: > ... > We need to understand if network manager has support for this kind of > device. The best way check is to plug the device into a desktop system > and get it working with network manager. Network manager community > might help with this. It already has support for many types of phones
With help from the networkmanager-list (@gnome.org) I got NM to handle ppp. > ... I had originally set up the ppp connection like this: $ sudo nmcli con add con-name "ppp" ifname "ppp0" type cdma $ sudo nmcli con modify "ppp" connection.zone external But the ifname option caused confusion for NetworkManager. $ sudo nmcli con up ppp Error: Connection activation failed: No suitable device found for this connection. $ sudo nmcli con up ppp ifname ttyACM0 Error: device 'ttyACM0' not compatible with connection 'ppp'. $ sudo nmcli con up ppp ifname ppp0 Error: device 'ppp0' not compatible with connection 'ppp'. In the end, I had to clear the interface-name: $ sudo nmcli connection modify ppp connection.interface-name "" as that restricts the connection to 'ifname "ppp0"' and $ nmcli dev DEVICE TYPE STATE CONNECTION enp1s0 ethernet connected FreedomBox WAN enp3s0 ethernet connected FreedomBox LAN enp3s0 ttyACM0 cdma disconnected -- enp2s0 ethernet unavailable -- lo loopback unmanaged -- reports ttyACM0. Thanks Thomas! (of the networkmanager-list). So the proper way to set up a ppp connection is without the ifname option: $ sudo nmcli con add con-name "ppp" type cdma $ sudo nmcli con modify "ppp" connection.zone external > Once network manager has support, having Plinth manage this from web > interface is a matter of writing some web forms for configuration input > and status display. After digging into nm-settings (man nm-settings) I had to set these to duplicate the ppp configuration in /etc/ppp/peers/cell: $ sudo nmcli con modify "ppp" cdma.username qnc $ sudo nmcli con modify "ppp" cdma.password qnc $ sudo nmcli con modify "ppp" ppp.refuse-chap true $ sudo nmcli con modify "ppp" ppp.crtscts true $ sudo nmcli con modify "ppp" ppp.lcp-echo-interval 65535 $ sudo nmcli con modify "ppp" ppp.lcp-echo-failure 4 $ sudo nmcli con modify "ppp" ppp.baud 115200 I'm not sure all of these are absolutely necessary, particularly the baud since the connection is a usb connection, but that's what has worked for years. Per nm-settings, there are quite a few cdma.*, ppp.*, gsm.*, etc... options. That could make for a quite lengthy web form. At the very least the above options seem so be sufficient to make ppp work, at least on my cdma device. > >... > > If and when network manager supports type of connection, it can be > trusted to handle these tasks of starting and managing process and > handling errors. Chances are that it will do it well. Correct. This is the full log of NetworkManager handling the ppp connection successfully after the phone is plugged into the usb cable: As before, the kernel detection of the usb device: Sep 4 22:58:35 fbx kernel: [ 2698.111804] usb 4-1: new full-speed USB device number 3 using ohci-pci Sep 4 22:58:35 fbx kernel: [ 2698.278969] usb 4-1: New USB device found, idVendor=22b8, idProduct=2a62 Sep 4 22:58:35 fbx kernel: [ 2698.278986] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Sep 4 22:58:35 fbx kernel: [ 2698.278994] usb 4-1: Product: Motorola E815 Sep 4 22:58:35 fbx kernel: [ 2698.279002] usb 4-1: Manufacturer: Motorola, Inc. Sep 4 22:58:35 fbx kernel: [ 2698.283664] cdc_acm 4-1:1.0: ttyACM0: USB ACM device Now, NM detects the device: Sep 4 22:58:51 fbx NetworkManager[1223]: <info> [1473044331.5151] manager: (ttyACM0): new Broadband device (/org/freedesktop/NetworkManager/Devices/6) Sep 4 22:58:51 fbx NetworkManager[1223]: <info> [1473044331.5172] device (ttyACM0): state change: unmanaged -> unavailable (reason 'managed') [10 20 2] Sep 4 22:58:51 fbx NetworkManager[1223]: <info> [1473044331.5188] device (ttyACM0): modem state 'enabling' Sep 4 22:58:51 fbx NetworkManager[1223]: <warn> [1473044331.5194] (ttyACM0): failed to retrieve SIM object: No SIM object available Sep 4 22:58:51 fbx NetworkManager[1223]: <info> [1473044331.5207] device (ttyACM0): state change: unavailable -> disconnected (reason 'none') [20 30 0] And now, the connection gets activated: Sep 4 23:00:42 fbx NetworkManager[1223]: <info> [1473044442.8932] device (ttyACM0): Activation: starting connection 'ppp' (f2cc6f30-1726-42c2-b580-3ac8a98a21ec) Sep 4 23:00:42 fbx NetworkManager[1223]: <info> [1473044442.8954] audit: op="connection-activate" uuid="f2cc6f30-1726-42c2-b580-3ac8a98a21ec" name="ppp" pid=3587 uid=0 result="success" Sep 4 23:00:42 fbx NetworkManager[1223]: <info> [1473044442.8971] device (ttyACM0): state change: disconnected -> prepare (reason 'none') [30 40 0] Sep 4 23:00:42 fbx NetworkManager[1223]: <info> [1473044442.8994] manager: NetworkManager state is now CONNECTING Sep 4 23:00:42 fbx NetworkManager[1223]: <info> [1473044442.9045] device (ttyACM0): state change: prepare -> need-auth (reason 'none') [40 60 0] Sep 4 23:00:42 fbx NetworkManager[1223]: <info> [1473044442.9463] device (ttyACM0): state change: need-auth -> prepare (reason 'none') [60 40 0] Sep 4 23:00:51 fbx NetworkManager[1223]: <warn> [1473044451.5218] device (ttyACM0): failed to look up interface index Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.5224] device (ttyACM0): state change: prepare -> config (reason 'none') [40 50 0] Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.5785] device (ttyACM0): state change: config -> ip-config (reason 'none') [50 70 0] Sep 4 23:00:51 fbx NetworkManager[1223]: <warn> [1473044451.5792] device (ttyACM0): interface ttyACM0 not up for IP configuration Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.5792] (ttyACM0): using modem-specified IP timeout: 20 seconds And now ppp gets started: Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.5803] ppp-manager: starting PPP connection Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.5867] ppp-manager: pppd started with pid 3595 Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.5870] (ttyACM0): IPv6 configuration disabled Sep 4 23:00:51 fbx pppd[3595]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded. Sep 4 23:00:51 fbx pppd[3595]: pppd 2.4.7 started by root, uid 0 Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.6327] manager: (ppp0): new Generic device (/org/freedesktop/NetworkManager/Devices/7) Success! Sep 4 23:00:51 fbx pppd[3595]: Using interface ppp0 Sep 4 23:00:51 fbx pppd[3595]: Connect: ppp0 <--> /dev/ttyACM0 Sep 4 23:00:51 fbx pppd[3595]: local IP address 75.213.252.136 Sep 4 23:00:51 fbx pppd[3595]: remote IP address 66.174.121.64 Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.6688] ppp-manager: (IPv4 Config Get) reply received. Sep 4 23:00:51 fbx pppd[3595]: primary DNS address 198.224.186.135 Sep 4 23:00:51 fbx pppd[3595]: secondary DNS address 198.224.187.135 Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.6931] device (ttyACM0): state change: ip-config -> ip-check (reason 'none') [70 80 0] Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7422] devices added (path: /sys/devices/virtual/net/ppp0, iface: ppp0) Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7423] device added (path: /sys/devices/virtual/net/ppp0, iface: ppp0): no ifupdown configuration found. Now: IP... Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7708] device (ttyACM0): state change: ip-check -> secondaries (reason 'none') [80 90 0] Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7721] device (ttyACM0): state change: secondaries -> activated (reason 'none') [90 100 0] Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7725] manager: NetworkManager state is now CONNECTED_LOCAL Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7856] manager: NetworkManager state is now CONNECTED_GLOBAL And DNS... Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7876] policy: set 'ppp' (ppp0) as default for IPv4 routing and DNS Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.7880] dns-mgr: Writing DNS information to /sbin/resolvconf Sep 4 23:00:51 fbx NetworkManager[1223]: <info> [1473044451.8711] device (ttyACM0): Activation: successful, device activated. The following, not necessary any more, I removed from /etc/NetworkManager/dispatcher.d. Interesting that it's being called with blank IFACE and ACTION paramaters... Sep 4 23:00:52 fbx root: 10-ppp.sh executed, IFACE = ACTION = _______________________________________________ Freedombox-discuss mailing list Freedombox-discuss@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/freedombox-discuss