[PATCH] mbimcli: add support for Basic Connect session IDs

Ward, David - 0665 - MITLL david.ward at ll.mit.edu
Sun Sep 6 19:00:01 PDT 2015


Hi Dan,

This introduced two bugs:

On 08/17/2015 01:19 PM, Dan Williams wrote:
> @@ -147,17 +148,17 @@ static GOptionEntry entries[] = {
>         "Detach from the packet service",
>         NULL
>       },
> -    { "query-connection-state", 0, 0, G_OPTION_ARG_NONE, &query_connect_flag,
> -      "Query connection state",
> -      NULL
> +    { "query-connection-state", 0, 0, G_OPTION_ARG_NONE, &query_connect_str,
> +      "Query connection state (SessionID is optional, defaults to 0)",
> +      "[SessionID]"
>       },
This is still using G_OPTION_ARG_NONE, so it doesn't accept the session 
ID as an argument. Without one, it is writing TRUE (as a gboolean) to 
query_connect_str, and later causing an immediate segfault in 
connect_session_id_parse(). It would be simple to change this to 
G_OPTION_ARG_STRING, except for the next issue:

>       { "connect", 0, 0, G_OPTION_ARG_STRING, &set_connect_activate_str,
> -      "Connect (Authentication, Username and Password are optional)",
> -      "[(APN),(PAP|CHAP|MSCHAPV2),(Username),(Password)]"
> +      "Connect (allowed keys: session-id, apn, auth (PAP|CHAP|MSCHAPV2), username, password)",
> +      "[\"key=value,...\"]"
>       },
> -    { "disconnect", 0, 0, G_OPTION_ARG_NONE, &set_connect_deactivate_flag,
> -      "Disconnect",
> -      NULL
> +    { "disconnect", 0, 0, G_OPTION_ARG_STRING, &set_connect_deactivate_str,
> +      "Disconnect (SessionID is optional, defaults to 0)",
> +      "[SessionID]"
>       },
The argument isn't actually optional here or above (this only works if 
you pass '--disconnect='). For it to be optional (without the '=') you 
would have to use G_OPTION_ARG_CALLBACK and G_OPTION_FLAG_OPTIONAL_ARG, 
and write a callback to parse the argument.

David



More information about the libmbim-devel mailing list