Project

General

Profile

Actions

Feature #2308

closed

prepare GPRS for osmo-gsm-tester: try to use ofono to connect to an osmocom GPRS service

Added by neels almost 7 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Target version:
-
Start date:
05/30/2017
Due date:
% Done:

100%

Spec Reference:

Description

To prepare adding GPRS to the osmo-gsm-tester, manually run a local GSM network with data services and try querying some URL using ofono and a modem (e.g. the Sierra Wireless model, then the EC20 and Gobi). Does ofono work?


Related issues

Related to OsmoGSMTester - Feature #2202: osmo-gsm-tester: add GPRS data servicesResolvedpespin04/26/2017

Actions
Actions #1

Updated by pespin almost 7 years ago

  • Assignee set to 55360
Actions #2

Updated by pespin over 6 years ago

  • Status changed from New to In Progress
  • Assignee changed from 55360 to pespin
Actions #3

Updated by pespin over 6 years ago

I have a Sysmobts+network setup on my desktop (gsm+gprs), and a Sierra Wireless modem.

I power on the modem correct, and register to the bts successfully:

mdbus2 -s org.ofono /sierra_1 org.ofono.Modem.SetProperty Powered true
mdbus2 -s org.ofono /sierra_1 org.ofono.Modem.SetProperty Online true
sleep 3
mdbus2 -s org.ofono /sierra_1 org.ofono.NetworkRegistration.Scan
mdbus2 -s org.ofono /sierra_1 org.ofono.NetworkRegistration.Register
sleep 5
mdbus2 -s org.ofono /sierra_1 org.ofono.NetworkRegistration.Getproperties

After that, I check that the GPRS side is powered, attached and roaming is allowed (Powered=true, Attached=true, RoamingAllowed=true):

mdbus2 -s org.ofono /sierra_1 org.ofono.ConnectionManager.GetProperties
({'Attached': <true>, 'Bearer': <'none'>, 'RoamingAllowed': <true>, 'Powered': <true>, 'Suspended': <false>},)

Then I get the GPRS contexts:

mdbus2 -s org.ofono /sierra_1 org.ofono.ConnectionManager.GetContexts
([('/sierra_1/context1', {'Name': <'Internet'>, 'Active': <false>, 'Type': <'internet'>, 'Protocol': <'ip'>, 'AccessPointName': <''>, 'Username': <''>, 'Password': <''>, 'AuthenticationMethod': <'chap'>, 'Settings': <@a{sv} {}>, 'IPv6.Settings': <@a{sv} {}>})],)

To manage the context, you use the path retrieve in GetContexts: /sierra_1/context1
To Active the context, I then use the following, which fails. While failing the modem is advertised to the kernel as a new device:

mdbus2 -s org.ofono /sierra_3/context1 org.ofono.ConnectionContext.SetProperty Active true
[ERR]: GDBus.Error:org.ofono.Error.Failed: Operation failed

This is what dmesg shows up while calling the failing Active method (usb disconnects + re-connects as new device):

[27027.512675] usb 4-1.2: USB disconnect, device number 8
[27027.513972] qcserial ttyUSB1: Qualcomm USB modem converter now disconnected from ttyUSB1
[27027.514017] qcserial 4-1.2:1.0: device disconnected
[27027.514457] qcserial ttyUSB2: Qualcomm USB modem converter now disconnected from ttyUSB2
[27027.514495] qcserial 4-1.2:1.2: device disconnected
[27027.514881] qcserial ttyUSB3: Qualcomm USB modem converter now disconnected from ttyUSB3
[27027.514919] qcserial 4-1.2:1.3: device disconnected
[27027.515140] qmi_wwan 4-1.2:1.8 wwp0s29u1u2i8: unregister 'qmi_wwan' usb-0000:00:1d.0-1.2, WWAN/QMI device
[27027.541988] qmi_wwan 4-1.2:1.10 wwp0s29u1u2i10: unregister 'qmi_wwan' usb-0000:00:1d.0-1.2, WWAN/QMI device
[27038.726981] usb 4-1.2: new high-speed USB device number 9 using ehci-pci
[27038.827876] usb 4-1.2: config 1 has an invalid interface number: 8 but max is 5
[27038.827881] usb 4-1.2: config 1 has an invalid interface number: 10 but max is 5
[27038.827884] usb 4-1.2: config 1 has an invalid interface number: 11 but max is 5
[27038.827887] usb 4-1.2: config 1 has no interface number 1
[27038.827889] usb 4-1.2: config 1 has no interface number 4
[27038.827891] usb 4-1.2: config 1 has no interface number 5
[27038.830329] qcserial 4-1.2:1.0: Qualcomm USB modem converter detected
[27038.830655] usb 4-1.2: Qualcomm USB modem converter now attached to ttyUSB1
[27038.831138] qcserial 4-1.2:1.2: Qualcomm USB modem converter detected
[27038.831285] usb 4-1.2: Qualcomm USB modem converter now attached to ttyUSB2
[27038.831698] qcserial 4-1.2:1.3: Qualcomm USB modem converter detected
[27038.831863] usb 4-1.2: Qualcomm USB modem converter now attached to ttyUSB3
[27038.832544] qmi_wwan 4-1.2:1.8: cdc-wdm0: USB WDM device
[27038.832960] qmi_wwan 4-1.2:1.8 wwan0: register 'qmi_wwan' at usb-0000:00:1d.0-1.2, WWAN/QMI device, 5a:83:ee:4d:06:f3
[27038.836286] qmi_wwan 4-1.2:1.10: cdc-wdm3: USB WDM device
[27038.836774] qmi_wwan 4-1.2:1.10 wwan1: register 'qmi_wwan' at usb-0000:00:1d.0-1.2, WWAN/QMI device, 5a:83:ee:4d:06:f3

This is what I get in ofonod -d -n while calling that method (basically udev telling ofono that the device is no longer available and that a new one is available):

ofonod[15404]: drivers/qmimodem/gprs-context.c:qmi_activate_primary() cid 1

ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.0/ttyUSB1/tty/ttyUSB1
ofonod[15404]: plugins/udevng.c:destroy_modem() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: src/modem.c:ofono_modem_remove() 0x1f98850
ofonod[15404]: src/modem.c:modem_unregister() 0x1f98850
ofonod[15404]: src/modem.c:modem_change_state() old state: 3, new state: 0
ofonod[15404]: src/modem.c:flush_atoms()
ofonod[15404]: src/gprs.c:gprs_context_unregister() 0x1f700d0, 0x1f6fdc0
ofonod[15404]: src/gprs.c:gprs_context_remove() atom: 0x1f70140
ofonod[15404]: drivers/qmimodem/gprs-context.c:qmi_gprs_context_remove()
ofonod[15404]: plugins/bluez5.c:bt_unregister_profile() Bluetooth: Unregistering profile /bluetooth/profi
le/dun_gw
ofonod[15404]: src/gprs.c:gprs_unregister() 0x1f6fdc0
ofonod[15404]: src/network.c:__ofono_netreg_remove_status_watch() 0x1f95b00
ofonod[15404]: src/gprs.c:gprs_remove() atom: 0x1f6fe70
ofonod[15404]: drivers/qmimodem/gprs.c:qmi_gprs_remove()
ofonod[15404]: src/ussd.c:ussd_remove() atom: 0x1f98bb0
ofonod[15404]: drivers/qmimodem/ussd.c:qmi_ussd_remove()
ofonod[15404]: src/sim.c:ofono_sim_remove_spn_watch() 0x1f98580
ofonod[15404]: src/network.c:netreg_remove() atom: 0x1f981b0
ofonod[15404]: drivers/qmimodem/network-registration.c:qmi_netreg_remove()
ofonod[15404]: plugins/push-notification.c:push_notification_cleanup() 0x1f6dbb0
ofonod[15404]: plugins/smart-messaging.c:smart_messaging_cleanup() 0x1f98950
ofonod[15404]: src/sms.c:sms_remove() atom: 0x1f1a2c0
ofonod[15404]: drivers/qmimodem/sms.c:qmi_sms_remove()
ofonod[15404]: src/radio-settings.c:radio_settings_remove() atom: 0x1f739f0
ofonod[15404]: drivers/qmimodem/radio-settings.c:qmi_radio_settings_remove()
ofonod[15404]: src/phonebook.c:phonebook_remove() atom: 0x1f739c0
ofonod[15404]: src/stk.c:stk_remove() atom: 0x1f73950
ofonod[15404]: src/location-reporting.c:location_reporting_remove() atom: 0x1f421d0
ofonod[15404]: drivers/qmimodem/location-reporting.c:qmi_location_reporting_remove()
ofonod[15404]: src/voicecall.c:voicecall_remove() atom: 0x1f6bc30
ofonod[15404]: drivers/qmimodem/voicecall.c:qmi_voicecall_remove()
ofonod[15404]: plugins/bluez5.c:bt_unregister_profile() Bluetooth: Unregistering profile /bluetooth/profi
le/hfp_ag
ofonod[15404]: src/sim.c:sim_remove() atom: 0x1f6d860
ofonod[15404]: drivers/qmimodem/sim.c:qmi_sim_remove()
ofonod[15404]: src/modem.c:devinfo_remove() atom: 0x1f6ed80
ofonod[15404]: drivers/qmimodem/devinfo.c:qmi_devinfo_remove()
ofonod[15404]: plugins/gobi.c:gobi_disable() 0x1f98850
ofonod[15404]: src/modem.c:get_modem_property() modem 0x1f98850 property AlwaysOnline
ofonod[15404]: plugins/gobi.c:gobi_remove() 0x1f98850
ofonod[15404]: src/modem.c:unregister_property() property 0x1f1e110
ofonod[15404]: src/modem.c:unregister_property() property 0x1f951e0
ofonod[15404]: src/modem.c:unregister_property() property 0x1f6db40
ofonod[15404]: src/modem.c:unregister_property() property 0x1f6ee50
ofonod[15404]: src/modem.c:unregister_property() property 0x1f6eb50
ofonod[15404]: src/modem.c:emit_modem_removed() 0x1f98850
ofonod[15404]: src/modem.c:call_modemwatches() 0x1f98850 added:0
ofonod[15404]: plugins/dun_gw_bluez5.c:modem_watch() modem: 0x1f98850, added: 0
ofonod[15404]: plugins/hfp_ag_bluez5.c:modem_watch() modem: 0x1f98850, added: 0
ofonod[15404]: plugins/smart-messaging.c:modem_watch() modem: 0x1f98850, added: 0
ofonod[15404]: plugins/push-notification.c:modem_watch() modem: 0x1f98850, added: 0
ofonod[15404]: plugins/udevng.c:destroy_modem() /dev/ttyUSB1
ofonod[15404]: plugins/udevng.c:destroy_modem() /dev/ttyUSB2
ofonod[15404]: plugins/udevng.c:destroy_modem() /dev/ttyUSB3
ofonod[15404]: plugins/udevng.c:destroy_modem() wwp0s29u1u2i8
ofonod[15404]: plugins/udevng.c:destroy_modem() /dev/cdc-wdm0
ofonod[15404]: plugins/udevng.c:destroy_modem() wwp0s29u1u2i10
ofonod[15404]: plugins/udevng.c:destroy_modem() /dev/cdc-wdm3
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.3/ttyUSB3/tty/ttyUSB3
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.0
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.2/ttyUSB2/tty/ttyUSB2
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.2
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.3
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.8/net/wwp0s29u1u2i8
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.8/usbmisc/cdc-wdm0
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.8
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.10/net/wwp0s29u1u2i10
ofonod[15404]: plugins/bluez5.c:unregister_profile_cb()
ofonod[15404]: plugins/bluez5.c:unregister_profile_cb()
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.10/usbmisc/cdc-wdm3
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.11
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2
:1.10
ofonod[15404]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:check_usb_device() usb [8087:0024]
ofonod[15404]: plugins/udevng.c:check_usb_device() qcserial [1199:68c0]
ofonod[15404]: plugins/udevng.c:check_usb_device() qcserial [1199:68c0]
ofonod[15404]: plugins/udevng.c:check_usb_device() qcserial [1199:68c0]
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.
3/ttyUSB3/tty/ttyUSB3
ofonod[15404]: plugins/udevng.c:add_device() /dev/ttyUSB3 (sierra) 255/0/0 [03] ==> (null) (null)
ofonod[15404]: plugins/udevng.c:check_usb_device() qcserial [1199:68c0]
ofonod[15404]: plugins/udevng.c:check_usb_device() qcserial [1199:68c0]
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.
0/ttyUSB1/tty/ttyUSB1
ofonod[15404]: plugins/udevng.c:add_device() /dev/ttyUSB1 (sierra) 255/255/255 [00] ==> (null) (null)
ofonod[15404]: plugins/udevng.c:check_usb_device() usb [1199:68c0]
ofonod[15404]: plugins/udevng.c:check_usb_device() qmi_wwan [1199:68c0]
ofonod[15404]: plugins/udevng.c:check_usb_device() qcserial [1199:68c0]
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.
2/ttyUSB2/tty/ttyUSB2
ofonod[15404]: plugins/udevng.c:add_device() /dev/ttyUSB2 (sierra) 255/0/0 [02] ==> (null) (null)
ofonod[15404]: plugins/udevng.c:check_usb_device() qmi_wwan [1199:68c0]
ofonod[15404]: plugins/udevng.c:check_usb_device() qmi_wwan [1199:68c0]
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.
10/usbmisc/cdc-wdm3
ofonod[15404]: plugins/udevng.c:add_device() /dev/cdc-wdm3 (sierra) 255/255/255 [0a] ==> (null) (null)
ofonod[15404]: plugins/udevng.c:check_usb_device() qmi_wwan [1199:68c0]
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.
8/usbmisc/cdc-wdm0
ofonod[15404]: plugins/udevng.c:add_device() /dev/cdc-wdm0 (sierra) 255/255/255 [08] ==> (null) (null)
ofonod[15404]: plugins/udevng.c:check_usb_device() qmi_wwan [1199:68c0]
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.10/net/wwp0s29u1u2i10
ofonod[15404]: plugins/udevng.c:add_device() wwp0s29u1u2i10 (sierra) 255/255/255 [0a] ==> (null) (null)
ofonod[15404]: plugins/udevng.c:check_usb_device() qmi_wwan [1199:68c0]
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:add_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.8/net/wwp0s29u1u2i8
ofonod[15404]: plugins/udevng.c:add_device() wwp0s29u1u2i8 (sierra) 255/255/255 [08] ==> (null) (null)
ofonod[15404]: plugins/udevng.c:check_modem_list()
ofonod[15404]: plugins/udevng.c:create_modem() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:create_modem() driver=sierra
ofonod[15404]: src/modem.c:ofono_modem_create() name: (null), type: sierra
ofonod[15404]: plugins/udevng.c:setup_sierra() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[15404]: plugins/udevng.c:setup_sierra() /dev/ttyUSB1 255/255/255 00 (null) tty
ofonod[15404]: plugins/udevng.c:setup_sierra() /dev/ttyUSB2 255/0/0 02 (null) tty
ofonod[15404]: plugins/udevng.c:setup_sierra() /dev/ttyUSB3 255/0/0 03 (null) tty
ofonod[15404]: plugins/udevng.c:setup_sierra() wwp0s29u1u2i8 255/255/255 08 (null) net
ofonod[15404]: plugins/udevng.c:setup_sierra() /dev/cdc-wdm0 255/255/255 08 (null) usbmisc
ofonod[15404]: plugins/udevng.c:setup_sierra() wwp0s29u1u2i10 255/255/255 0a (null) net
ofonod[15404]: plugins/udevng.c:setup_sierra() /dev/cdc-wdm3 255/255/255 0a (null) usbmisc
ofonod[15404]: src/modem.c:ofono_modem_set_driver() type: gobi
ofonod[15404]: plugins/udevng.c:setup_sierra() modem=(null) app=(null) net=wwp0s29u1u2i10 diag=(null) qmi=/dev/cdc-wdm3
ofonod[15404]: src/modem.c:set_modem_property() modem 0x1f73800 property Device
ofonod[15404]: src/modem.c:set_modem_property() modem 0x1f73800 property Modem
ofonod[15404]: src/modem.c:set_modem_property() modem 0x1f73800 property App
ofonod[15404]: src/modem.c:set_modem_property() modem 0x1f73800 property Diag
ofonod[15404]: src/modem.c:set_modem_property() modem 0x1f73800 property NetworkInterface
ofonod[15404]: src/modem.c:ofono_modem_register() 0x1f73800
ofonod[15404]: plugins/gobi.c:gobi_probe() 0x1f73800
ofonod[15404]: src/modem.c:emit_modem_added() 0x1f73800
ofonod[15404]: src/modem.c:call_modemwatches() 0x1f73800 added:1
ofonod[15404]: plugins/dun_gw_bluez5.c:modem_watch() modem: 0x1f73800, added: 1
ofonod[15404]: plugins/hfp_ag_bluez5.c:modem_watch() modem: 0x1f73800, added: 1
ofonod[15404]: plugins/smart-messaging.c:modem_watch() modem: 0x1f73800, added: 1
ofonod[15404]: plugins/push-notification.c:modem_watch() modem: 0x1f73800, added: 1

Actions #4

Updated by neels over 6 years ago

  • Priority changed from Normal to Urgent
Actions #5

Updated by neels over 6 years ago

I remember someone has found a weird situation trying to use 3G data services with a UMTS stick. Might be completely unrelated, but worth a look: http://lists.osmocom.org/pipermail/openbsc/2017-April/010506.html

Actions #6

Updated by neels over 6 years ago

  • Related to Feature #2202: osmo-gsm-tester: add GPRS data services added
Actions #7

Updated by lynxis over 6 years ago

with a public operator using an EC20 it works for me. I guess it's a firmware problems within the Sierra modems. I've have to look with QMI traces.

pespin: better try a gobi2000 or an ec20

Actions #8

Updated by pespin over 6 years ago

For reference, mdbus2 crashes when trying to SetProperty on $MODEM/contex1. I had to use busctl, and the syntax is a bit more cumbersome:

pespin ~/dev/git/ofono $ busctl --system call org.ofono /gobi_0/context1 org.ofono.ConnectionContext SetProperty sv "AccessPointName" s "apnbla" 
pespin ~/dev/git/ofono $ busctl --system call org.ofono /gobi_0/context1 org.ofono.ConnectionContext SetProperty sv "Username" s "apnuser" 

Actions #9

Updated by pespin over 6 years ago

Activating the context works with gobi, and I can successfully reach internet. Ofono only creates the network device, but doesn't configure it. It is responsibility of the user to set up the network as desired. Information required can be gathered using the following:

$ mdbus2 -s org.ofono /gobi_0 org.ofono.ConnectionManager.GetProperties
({'Attached': <false>, 'RoamingAllowed': <true>, 'Powered': <true>},)
$ mdbus2 -s org.ofono /gobi_0 org.ofono.ConnectionManager.SetProperty RoamingAllowed true
()
$ mdbus2 -s org.ofono /gobi_0 org.ofono.ConnectionManager.GetContexts
([('/gobi_0/context1', {'Name': <'Internet'>, 'Active': <false>, 'Type': <'internet'>, 'Protocol': <'ip'>, 'AccessPointName': <'apnbla'>, 'Username': <'apnuser'>, 'Password': <''>, 'AuthenticationMethod': <'chap'>, 'Settings': <@a{sv} {}>, 'IPv6.Settings': <@a{sv} {}>})],)
$ mdbus2 -s org.ofono /gobi_0/context1 org.ofono.ConnectionContext.GetProperties
({'Name': <'Internet'>, 'Active': <false>, 'Type': <'internet'>, 'Protocol': <'ip'>, 'AccessPointName': <'apnbla'>, 'Username': <'apnuser'>, 'Password': <''>, 'AuthenticationMethod': <'chap'>, 'Settings': <@a{sv} {}>, 'IPv6.Settings': <@a{sv} {}>},)
$ mdbus2 -s org.ofono /gobi_0/context1 org.ofono.ConnectionContext.SetProperty Active true
$ mdbus2 -s org.ofono /gobi_0/context1 org.ofono.ConnectionContext.GetProperties
({'Name': <'Internet'>, 'Active': <true>, 'Type': <'internet'>, 'Protocol': <'ip'>, 'AccessPointName': <'apnbla'>, 'Username': <'apnuser'>, 'Password': <''>, 'AuthenticationMethod': <'chap'>, 'Settings': <{'Interface': <'wwp0s29u1u2'>, 'Method': <'static'>, 'Address': <'10.23.42.4'>, 'Netmask': <'255.255.255.252'>, 'Gateway': <'10.23.42.5'>, 'DomainNameServers': <['8.8.8.4', '8.8.8.4']>}>, 'IPv6.Settings': <@a{sv} {}>},)

So, in this case user needs to set up ip 10.23.42.4 for device wwp0s29u1u2, and set up routing manually to work with it.

The main problem here is how to do the routing correctly. The routing path in my case is the following:

PC:wwp0s29u1u2 --> modem ---> Um:BTS:Gb ---> enp0s25:SGSN:tun0(lo) --> tun0(lo):GGSN:enp14s0u1 --> Internet

Which means packets sent to the modem (wwp0s29u1u2) must and will have IP addr 10.23.42.4. Once the packet gets out in GGSN, it will still have that IP and will try to send it again to wwp0s29u1u2 instead of enp14s0u1. I still need to check if I can play with iif and oof and ip rule to make it work.

I first tried moving the modem interface to its own net namespace with specific route to use modem as default route. This way I can run commands inside the netns which route traffic through the modem and as GGSN runs in the default namespace with different routing, everything works nice. Here's the script:

#!/bin/bash
set -x
MODEM_IFACE=wwp0s29u1u2 #known from ofono API
MODEM_IP=10.23.42.3 #known from ofono API
MODEM_NETMASK=24 #known from ofono API
GGSN_TUN_IP=10.23.42.1 #known from osmo-gsm-tester API
NS=myns # random ns

run_ns() {
        ip netns exec $NS $@
}

ip netns add $NS
ip link set dev $MODEM_IFACE netns $NS

run_ns ip link set $MODEM_IFACE up
run_ns ip addr add $MODEM_IP/$MODEM_NETMASK dev $MODEM_IFACE
run_ns ip route add default via $GGSN_TUN_IP dev $MODEM_IFACE
run_ns ip route get 8.8.8.8
run_ns ping -c 10 8.8.8.8
run_ns wget -O wget -O - http://google.com

However, as soon as we move the modem device to another namespace that the one ofono is running in (ip link set dev $MODEM_IFACE netns $NS), then udev notified ofono that the interface is gone and then ofono considers the modem is gone, and the modem cannot be reached anymore through ofono API:

ofonod[1981]: plugins/udevng.c:remove_device() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2/4-1.2:1.0/net/wwp0s29u1u2
ofonod[1981]: plugins/udevng.c:destroy_modem() /sys/devices/pci0000:00/0000:00:1d.0/usb4/4-1/4-1.2
ofonod[1981]: src/modem.c:ofono_modem_remove() 0x55a39d14ebc0
ofonod[1981]: src/modem.c:modem_unregister() 0x55a39d14ebc0
ofonod[1981]: src/modem.c:modem_change_state() old state: 3, new state: 0
ofonod[1981]: src/modem.c:flush_atoms()
ofonod[1981]: src/gprs.c:gprs_context_unregister() 0x55a39d160db0, 0x55a39d161000
ofonod[1981]: src/gprs.c:gprs_context_remove() atom: 0x55a39d149800
ofonod[1981]: drivers/qmimodem/gprs-context.c:qmi_gprs_context_remove()
ofonod[1981]: plugins/bluez5.c:bt_unregister_profile() Bluetooth: Unregistering profile /bluetooth/profile/dun_gw
ofonod[1981]: src/gprs.c:gprs_unregister() 0x55a39d161000
ofonod[1981]: src/network.c:__ofono_netreg_remove_status_watch() 0x55a39d152340
ofonod[1981]: src/gprs.c:gprs_remove() atom: 0x55a39d1610b0
ofonod[1981]: drivers/qmimodem/gprs.c:qmi_gprs_remove()
ofonod[1981]: src/sim.c:ofono_sim_remove_spn_watch() 0x55a39d161900
ofonod[1981]: src/network.c:netreg_remove() atom: 0x55a39d14abe0
ofonod[1981]: drivers/qmimodem/network-registration.c:qmi_netreg_remove()
ofonod[1981]: plugins/push-notification.c:push_notification_cleanup() 0x55a39d13bc60
ofonod[1981]: plugins/smart-messaging.c:smart_messaging_cleanup() 0x55a39d13bc00
ofonod[1981]: src/sms.c:sms_remove() atom: 0x55a39d14a060
ofonod[1981]: drivers/qmimodem/sms.c:qmi_sms_remove()
ofonod[1981]: src/radio-settings.c:radio_settings_remove() atom: 0x55a39d1645a0
ofonod[1981]: drivers/qmimodem/radio-settings.c:qmi_radio_settings_remove()
ofonod[1981]: src/stk.c:stk_remove() atom: 0x55a39d164570
ofonod[1981]: src/location-reporting.c:location_reporting_remove() atom: 0x55a39d1614e0
ofonod[1981]: drivers/qmimodem/location-reporting.c:qmi_location_reporting_remove()
ofonod[1981]: src/sim.c:sim_remove() atom: 0x55a39d161ab0
ofonod[1981]: drivers/qmimodem/sim-legacy.c:qmi_sim_remove()
ofonod[1981]: src/modem.c:devinfo_remove() atom: 0x55a39d125800
ofonod[1981]: drivers/qmimodem/devinfo.c:qmi_devinfo_remove()
ofonod[1981]: plugins/gobi.c:gobi_disable() 0x55a39d14ebc0
ofonod[1981]: src/modem.c:get_modem_property() modem 0x55a39d14ebc0 property AlwaysOnline
ofonod[1981]: plugins/gobi.c:gobi_remove() 0x55a39d14ebc0
ofonod[1981]: src/modem.c:unregister_property() property 0x55a39d126b30
ofonod[1981]: src/modem.c:unregister_property() property 0x55a39d143160
ofonod[1981]: src/modem.c:unregister_property() property 0x55a39d14eda0
ofonod[1981]: src/modem.c:unregister_property() property 0x55a39d14ed10
ofonod[1981]: src/modem.c:emit_modem_removed() 0x55a39d14ebc0
ofonod[1981]: src/modem.c:call_modemwatches() 0x55a39d14ebc0 added:0
ofonod[1981]: plugins/dun_gw_bluez5.c:modem_watch() modem: 0x55a39d14ebc0, added: 0
ofonod[1981]: plugins/hfp_ag_bluez5.c:modem_watch() modem: 0x55a39d14ebc0, added: 0
ofonod[1981]: plugins/smart-messaging.c:modem_watch() modem: 0x55a39d14ebc0, added: 0
ofonod[1981]: plugins/push-notification.c:modem_watch() modem: 0x55a39d14ebc0, added: 0
ofonod[1981]: plugins/udevng.c:destroy_modem() /dev/cdc-wdm0
ofonod[1981]: plugins/udevng.c:destroy_modem() wwp0s29u1u2
ofonod[1981]: plugins/udevng.c:destroy_modem() /dev/ttyUSB1
ofonod[1981]: plugins/udevng.c:destroy_modem() /dev/ttyUSB2
ofonod[1981]: plugins/udevng.c:destroy_modem() /dev/ttyUSB3
ofonod[1981]: plugins/bluez5.c:unregister_profile_cb()

Which adds a new constraint: Ofono must run in the same netnamespace as the devices it created. Which also means that all modems must run in the same net namespace.

Actions #10

Updated by pespin over 6 years ago

It seems ofono cannot run in a netns due to issues with libudev when trying to find the device.

I opened a bug report in systemd to track the issue: https://github.com/systemd/systemd/issues/6713

summary: systemd-udev (running in default netns) tracks state in /run/udev/data/ files. When the iface is moved to the netns, they remove a file associated with that iface in that directory. Then, ofono runs inside the netns and uses libgudev (->libudev) to find the net device, and althrough /sys/* stuff is correct, libudev fails because it also uses its own (/run/udev/data/) file which is not there.

As a result, modem is not detected when ofono runs inside a netns and the modem interface is modem inside that netns too.

Actions #11

Updated by pespin over 6 years ago

For now it seems the best idea is to have:
- osmo-gsm-tester process + ofono process + modem interfaces in default netns
- Move at least OpenGGSn process created from osmo-gsm-tester into its own temporary netns.
- Have a "Server" object class inside osmo-gsm-tester which will handle different server services (eg http server), and that will be spawned in the same temporary netns (non-default one).
- For each modem interface available, allocate an extra IP for the server and assign it to the server network interface, eg: 5 modem network devices --> 5 IPS: 1.1.1.1, 1.1.1.2, 1.1.1.3, 1.1.1.4, 1.1.1.5
- When ofono provides us with PDP context information (ie. IP to set for the modem net device + gw), set a route rule on the default netns to match one of the IPs of the server with the modem interface, eg:

ip route add 1.1.1.1 via modem1_gateway device modem1_iface src modem1_ip
ip route add 1.1.1.2 via modem2_gateway device modem2_iface src modem2_ip
ip route add 1.1.1.3 via modem3_gateway device modem3_iface src modem3_ip
... where modemX_* is provided by ofono API.

this way:
ping 1.1.1.1 --> traffic goes through modem1_iface and modem1_ip is set as src IP by the kernel.
ping 1.1.1.2 --> traffic goes through modem2_iface and modem2_ip is set as src IP by the kernel.
ping 1.1.1.3 --> traffic goes through modem3_iface and modem3_ip is set as src IP by the kernel.
...

Then, when packets get out of the GGSN, as it is on a different netns, those routes are not there, which means other routing can apply. In essence, we want to route all traffic 1.1.1.X to the server running in the same namespace.

Actions #12

Updated by pespin over 6 years ago

Speaking with Harald it seems to be possible to run stuff into a new net namespace without need to be root by using user namespaces with unishare. This are the required steps:

$ echo "1" > /proc/sys/kernel/unprivileged_userns_clone
$ unshare -n -U -r "/bin/bash"

If required, persistent namespace with a name (similar to what ip netns does) can be created using the value for -n parameter:

       -n, --net[=file]
              Unshare the network namespace.  If file is specified, then a persistent namespace is created by a bind mount.

Actions #13

Updated by lynxis over 6 years ago

lynxis' connect script:

#!/bin/sh

MODEM=$(mdbus2 -s -i org.ofono |grep gobi |head -n1)
echo "$MODEM powering" 
mdbus2 -s -i org.ofono "$MODEM" org.ofono.Modem.SetProperty Powered true
echo "$MODEM online" 
mdbus2 -s -i org.ofono "$MODEM" org.ofono.Modem.SetProperty Online true

while mdbus2 -s -i org.ofono "$MODEM" org.ofono.ConnectionManager.GetProperties | grep "'Attached': <false>" ; do
    echo " waiting ..." 
    sleep 1
done
mdbus2 -s -i org.ofono "$MODEM" org.ofono.ConnectionManager.GetProperties
echo "$MODEM activate context" 
mdbus2 -s -i org.ofono "$MODEM/context1" org.ofono.ConnectionContext.SetProperty Active true
echo dhcpd wwan0
if ! pgrep "dhcpd wwan0" ; then
    sudo dhcpcd wwan0
fi

Actions #14

Updated by laforge over 6 years ago

  • Priority changed from Urgent to High
Actions #15

Updated by pespin over 6 years ago

I did dome more testing regarding set up of net namespace for osmo-ggsn as non-root user:

  • It seems we cannot create persistent namespaces without root permission (ie. --net=/tmp/foo), because it internally calls mount() which requires root access. In any case, we don't need persistent ones.
  • It seems the sysfs /proc/sys/kernel/unprivileged_userns_clone is a kernel patch specific for debian. My archlinux doesn't support unshare correctly.
  • Using $ echo "1" > /proc/sys/kernel/unprivileged_userns_clone && unshare -n -U -r "/bin/bash" works fine, process is started as root inside its namespace.
  • The file (descriptor) to be used to attach to the netwowrk namespace created by unshare is /proc/PID/ns/net, where PID is the PID of the process created by unshare "pidof /bin/bash)"
  • I found it's not possible to attach to another namespace without having root permissions, even if it was created as "user namespace" (see -r -U in unshare). This means we need to use some permission scalation technique (ie. sudo) to set up the interfaces in the newly created namespace (eg, setting IPs, routing etc. with "ip" tool).
  • In any case, we need to create a virtual eth pair in the root netns, set them up and move one of the pair into the created netns. To do this, we need root access in any case, for which permission scalation techniques will be required.
Actions #16

Updated by msuraev about 6 years ago

I briefly looked into similar issue as a way to speed up OsmoPCU gerrit tests. Seems like http://docs.pyroute2.org/netns.html or https://firejail.wordpress.com/ could be useful but I have not looked deeply yet.

Actions #17

Updated by laforge over 5 years ago

  • Priority changed from High to Urgent

"in progress" but no updates since 8 months?

Actions #18

Updated by pespin over 5 years ago

  • Assignee changed from pespin to lynxis

Discussed about it with lynxis and he'll write down some code example or description about it.

Actions #19

Updated by lynxis over 5 years ago

  • Assignee changed from lynxis to pespin
Actions #20

Updated by lynxis over 5 years ago

With the patch, you can give interface into a lxc container

Actions #21

Updated by pespin over 5 years ago

We did some tests together with lynxis today. Outcome of discussions:

  • We use the ofono patch provided by lynxis above, which allows us to move the modem interfaces (created by udev/kernel when modems are plugged in) into a different non main netns.
  • Using UDEV rules, we rename each modem net iface to some specific pattern like: modem_wwan_${usbid}.
  • We Add a start script (or extend current one) to ofono.service systemd service file which creates a netns for each modem net iface with the same name. Interfaces names can only be found in ofono dbus by using org.ofono.ConnectionManager.GetContexts, which is only available after powering it on and setting it to online, and furthermore the "'Settings': <{'Interface': <'wwan1'>," part we look for is only shown after actvating the pdp ctx. As a result, list of modem net ifaces needs to be hardcoded or do it for each iface following a specific pattern (see point above): for iface in $(ip l | grep modem_wwan_*; do ip netns create netns ogt_$iface; done
  • Similarly, we do the same for stop systemd script which will move back ifaces to main netns and then remove the previously created netns. for netns in $(ip netns | grep ogt_modem_wwan_*); do ip netns delete $netns; done
  • osmo-gsm-tester: We need to extend Process with a subclass to handle creating/managing/destroying processes under another netns. For that, we'll require some scripts + /etc/sudoers.d/ modifiactions to allow running ip netns with some limitations (like paths, commands, etc.).
  • osmo-gsm-tester: During test, after activating the pdp ctx, we retrieve the Interface name through context.GetProperties, and we need to run dhcpd on the interface through "ip netns ogt_$iface exec dhcpd $iface". Then our iface will have the Ip addr allocated to us by the GGSN.
  • Try to ping the IP addr of the GGSN (the external one) by "ip netns ogt_$iface exec ping IP_ADDR" and parse result.
  • We need to do the tests with ec20, then once that works, test with SierraW too.
  • If we need to access the internet, we need to figure out a way to add MASQUERADE in iptables (using root), and also enable FORWARD (can be done once at startup time through system conf).

Next steps: Run an iperf server in main netns (by writing a python class? we need to allocate an IP addr to it from the pool), and then iperf client in the modem netns.

lynxis: Think of a way to upstream the patch? By enabling it under a "ALLOW_NETNS_MOVE" env var or similar?

Actions #22

Updated by pespin over 5 years ago

Side note: it seems DHCP requests are only answered by modem AFTER activating a pdp ctx.

Actions #23

Updated by pespin over 5 years ago

  • % Done changed from 0 to 60
Tests with different modems we have available:
  • EC20: Works fine with my local branch of osmo-gsm-tester, I can set up data plane automatically and ping the GGSN address fine
  • SierraW: DHCP requests are not replied. From previous tests, I think IP addr and routing must be set manually for it. I tried following [1] to check data plane config in the modem, but qmicli failed to get data config.
  • gobi2000: Setup and ping works fine, but when tests finishes and we shutdown the modem (Powered=off), osmo-gsm-tester hangs there forever. In ofono logs it can be seen that somehow the modem crashed and restarted, so a new modem object is registered in ofono and the one being used disappeared, probably without the power off being answered and thus without closing the Powered off. We should test again once we move to newer ofono and report the bug upstream, since clients shouldn't hang forever if modem crashes.
TODO:
  • Submit patches for osmo-ci ansible setup (osmo-gsm-tester_netns_exec.sh) and related sudoers.d file.
  • Add some class to handle an iperf server with an allocated IP and an iperf client?
  • Update doc with new dependency: udhcpc, iproute2, sudo

[1] http://www.embeddedpi.com/documentation/3g-4g-modems/raspberry-pi-sierra-wireless-mc7304-modem-qmi-interface-setup

Actions #24

Updated by pespin over 5 years ago

  • % Done changed from 60 to 80

I submitted a bunch of patches that add support to setup the data plane, and allows implementing the ping scenario.
I also invested time in adding a new test which runs iperf3 test to be able to test throughput.

I also submitted patches to osmo-ci to setup the machines, and installed everything required in RnD and Prod setup.

remote: New Changes:
remote:   https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11473 utils: Add osmo-gsm-tester_setcap_net_*.sh scripts
remote:   https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11474 pcap_recorder: Add support to run in netns
remote:   https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11475 resources.conf: Add extra IPaddr to pool
remote:   https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11476 Introduce iperf3 testing infrastructure
remote:
remote:
remote: Updated Changes:
remote:   https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11460 utils: Introduce show_usb_device.py [WIP]
remote:   https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11461 utils: Introduce modem-netns-setup.py [WIP]
remote:   https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11462 Add support to test gprs IPv4 data plane [WIP]

TODO:
- ofono: call "modem-netns-setup.py stop" before and "modem-netns-setup.py start" after ofono is started in we patched systemd service we maintain in our branch.
- Add support to test egprs.

Actions #25

Updated by pespin over 5 years ago

lynxis , the Prod setup doesn't have an ofono with the required patch to avoid dropping modems when the iface is removed. Can you please update ofono there with correct version?

Actions #26

Updated by laforge over 5 years ago

On Fri, Oct 26, 2018 at 05:07:55PM +0000, pespin [REDMINE] wrote:

lynxis , the Prod setup doesn't have an ofono with the required patch to avoid dropping modems when the iface is removed. Can you please update ofono there with correct version?

Actually, I think the best method here would be if we'd build the "correct version" in OBS,
and then install it from the feed using the ansible playbook?

Actions #27

Updated by lynxis over 5 years ago

laforge wrote:

On Fri, Oct 26, 2018 at 05:07:55PM +0000, pespin [REDMINE] wrote:

lynxis , the Prod setup doesn't have an ofono with the required patch to avoid dropping modems when the iface is removed. Can you please update ofono there with correct version?

Actually, I think the best method here would be if we'd build the "correct version" in OBS,
and then install it from the feed using the ansible playbook?

At the moment we're not building ofono in OBS, but yes we can do it that way.

Actions #28

Updated by pespin over 5 years ago

  • Assignee changed from pespin to lynxis

Submitted patches to add egprs support and enable it in tests:
remote: https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11497 Add support to enable EGPRS
remote: https://gerrit.osmocom.org/#/c/osmo-gsm-tester/+/11498 default-suites.conf: Enable testing egprs

Assigning the ticket to lynxis so he works on updating ofono and creating ofono packages.

Actions #29

Updated by pespin almost 5 years ago

osmo-gsm-tester is running gprs tests quite stable now. Ofono was updated. Leaving the ticket to lynxis for him to create debian packages (and ell dependency) for our ofono.git fork.

Actions #30

Updated by lynxis almost 5 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 80 to 100
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)