initial bearer apn

Peter Naulls peter at chocky.org
Thu Mar 16 17:11:10 UTC 2023


On 3/16/23 11:53, Juan A. Rubio wrote:

> Thanks Peter.
> 
> What mechanism did you use to set the initial bearer? I'm using a
> Network Manager connection profile in which I'm setting the APN (e.g.
> myapn), not Telstra.internet
> 
> [gsm]
> apn=myapn
> password=""
> username=""
> 
> Do you use mmcli or MM DBus API instead of Network Manager?

mmcli where possible.  My of my handling is in OpenWrt's ash; I never
quite got to grips with DBus.

Here's the section of script where we set the APN; I think logic is clear
enough.  I think it likely that there's a better way, but in our testing
this is reliable.

I'm sure Alex has more commentary here.


      config_apn=$(uci get network.wwan.apn 2>/dev/null || true)

       initial_bearer_apn=$(mmcli -m $modem_num 2>/dev/null | grep "initial 
bearer apn")

       # Might be blank if not ready yet
       if [ -n "${initial_bearer_apn}" ] ; then
         curr_apn_value=$(echo ${initial_bearer_apn} | sed 's#.*: ##' || true)

         if [ "${config_apn}" == "${curr_apn_value}" ] ; then
           message_out "Initial bearer APN correctly set to '${config_apn}'"
           apn_check_done=true

         else
           message_out "Initial bearer APN set to '${curr_apn_value}' vs 
configured value '${config_apn}' - setting initial bearer"

           mmcli -m $modem_num --enable || true
           mmcli -m $modem_num 
--3gpp-set-initial-eps-bearer-settings="apn=${config_apn},ip-type=ipv4v6" || true
         fi
       fi



More information about the ModemManager-devel mailing list