Comment 5 for bug 1362068

Revision history for this message
Jussi Kangas (jkangas) wrote :

Sorry I wrote down wrong line number. It should have been 1231.

Fix proposal can be found from https://github.com/jkangas/ofono-1/commit/d0cc0d4723f550bd0fefbadd64a220b938af6695

When you set the property using for example test case set-context-property you call method context interface method SetProperty, which is mapped to method pri_set_property in gprs.c GDBusMethodTable context_methods.

I added some additional traces as following to my proposed fix:

 DBG("JUSSI LOGS: ctx->type is %d.", ctx->type)

 if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
  ctx->type == OFONO_GPRS_CONTEXT_TYPE_WAP ||
  ctx->type == OFONO_GPRS_CONTEXT_TYPE_IMS) {

  DBG("JUSSI LOGS: Calling invalid args.")

  return __ofono_error_invalid_args(msg);
 }

Now, my context listing gives this value for context 2

    [ /ril_0/context2 ]
        IPv6.Settings = { }
        Password =
        Active = 0
        Type = wap
        Settings = { }
        Username =
        Protocol = ip
        AccessPointName = mms
        Name = PALLO

If I run this:

set-context-property 1 MessageCenter KOEPALLO

I get response "Invalid arguments in method call" as expected

and traces show

JUSSI LOGS: ctx->type is 3.
JUSSI LOGS: Calling invalid args.

Next if I change the type to mms and try to set the MessageCenter like this

set-context-property 1 Type mms
set-context-property 1 MessageCenter KOEPALLO

I get no error from the scripts and extra logs are just

JUSSI LOGS: ctx->type is 2.

Now, if I add same extra traces to original 7f3955122af8b0349fb7d3f2db8abd754459d146 fix like this:

 DBG("JUSSI LOGS: ctx->type is %d.", ctx->type);

 if (ctx->type != OFONO_GPRS_CONTEXT_TYPE_MMS ||
  ctx->type != OFONO_GPRS_CONTEXT_TYPE_INTERNET) {

  DBG("JUSSI LOGS: Calling invalid args.");

  return __ofono_error_invalid_args(msg);
 }

And do the same steps, I get

JUSSI LOGS: ctx->type is 3.
JUSSI LOGS: Calling invalid args

to first attempt and later one to the second.

JUSSI LOGS: ctx->type is 2.
JUSSI LOGS: Calling invalid args.

I think this proves the issue.