machine-readable --query-ip-configuration [patch] (2nd attempt)

Aleksander Morgado aleksander at
Fri Mar 24 09:07:53 UTC 2017


On Thu, Mar 23, 2017 at 11:47 PM, Daniel Barlow <dan at> wrote:
> I recently added an EM7455 to my Thinkpad X1 and in the goal of making it
> work have been learning a *little* more than I expected to have to about
> MBIM (and for that matter about IPv6-only connectivity)
> Because my current distribution doesn't seem to want to let me run
> ModemManager without NetworkManager I wanted to make everything work using
> the supplied mbim-network script, and it seems that the biggest missing bit
> there is actually configuring the interface/gateway/dns servers etc after
> the connection is made.  Because I don't much like writing machine parsers
> for potentially brittle intended-for-humans output, I took the liberty of
> writing a small patch to optionally turn the output of
> --query-ip-configuration into awk-friendly tab separated lines.  So for
> example I can run
> $ mbimcli  -p -d /dev/cdc-wdm0 --query-ip-configuration --machine-readable
> IPv4    fields  none
> IPv6    fields  address, gateway, dns, mtu
> IPv6    address 2a01:4c8:1b:eb13:2dbf:b045:8a94:88fa/64
> IPv6    gateway 2a01:4c8:1b:eb13:40dc:ba5f:4d43:d4c
> IPv6    dns     2a01:4c8:f000:1::1
> IPv6    dns     2a01:4c8:f000:1::2
> IPv6    mtu     1500
> Would there be any interest in merging this or something like it?  I see
> some previous discussion about extending mbim-network to configure the wwan
> interface
> (
> and it seems to me like having an easy-to-parse output format for the
> necessary config data would be an important part of that work.
> I can't see any contribution guidelines in the project repo so I hope that
> attaching a diff as MIME is acceptable.  I've also posted it as a gist at

Doing something like this for all mbimcli, qmicli and mmcli has been
in my TODO list for a long time, especially since I worked on making
ModemManager work in OpenWRT; where mmcli output parsing is a bit

But I didn't think of tab-separated outputs, more maybe something like this:

ipv6.dns1= 2a01:4c8:f000:1::2

i.e. "field=value". I've seen other attempts to do this using e.g.
JSON formatted output, but I never liked that for integration of CLIs
in shell scripts.

One of the things that I do consider is that this should be a global
option for all commands, not just for IP settings.

And also, there has to be a way of querying which would be the
possible output fields that a command may generate, so that when
you're developing based on the CLI outputs, you can know in advance
which fields you may receive as output without needing to look at the
source code. Something like:

$ mbimcli --query-ip-configuration --machine-readable-help

  Fields that may be generated in "Query IP Configuration":

Maybe mbimcli is the best candidate to start adding support for this,
as I think it's the simplest of the CLIs for now.


More information about the libmbim-devel mailing list