From efe1306ec21cfe3e1054fae735970e1881e7b0c5 Mon Sep 17 00:00:00 2001 From: Jonas Bonn Date: Thu, 14 Mar 2019 23:28:41 +0100 Subject: [PATCH] ublox: TOBY L4 supports only router mode The TOBY L4 supports only "router mode" where the modem presents a network interface that one can run a DHCP client against. Behind this interface, the modem takes care of routing packets via NAT by: i) selecting the relevant context based on destination IP ii) using the first activated context as the default route In order to have the connection manager, thus, do the right thing, the context only needs to report itself as being active and with the IP settings set to method "dhcp". There's no need for the connection manager to know details like what IP address the context was assigned. Tested with connman that does the right thing when it finds an active "dhcp" context. --- drivers/ubloxmodem/gprs-context.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/ubloxmodem/gprs-context.c b/drivers/ubloxmodem/gprs-context.c index bbf8627a..389868c1 100644 --- a/drivers/ubloxmodem/gprs-context.c +++ b/drivers/ubloxmodem/gprs-context.c @@ -240,6 +240,15 @@ static void ublox_gprs_read_settings(struct ofono_gprs_context *gc, DBG("cid %u", cid); + if (ublox_is_toby_l4(gcd->model)) { + /* Use DHCP */ + gcd->active_context = cid; + set_gprs_context_interface(gc); + ofono_gprs_context_set_ipv4_address(gc, NULL, 0); + CALLBACK_WITH_SUCCESS(cb, data); + return; + } + gcd->active_context = cid; gcd->cb = cb; gcd->cb_data = data;