setting ConnectionContext MessageCenter or MessageProxy always returns "invalid parameters"

Bug #1362068 reported by Antti Kaijanmäki
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ofono (Ubuntu)
Fix Released
Critical
Tony Espy
ofono (Ubuntu RTM)
Fix Released
Critical
Tony Espy

Bug Description

just use d-feet or dbus-send and try to modify Messagecenter or MessageProxy property on a mms context. Each time I try this I get:

'g-io-error-quark: GDBus.Error:org.ofono.Error.InvalidArguments: Invalid arguments in method call (36)'

Tags: rtm14

Related branches

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

tested on desktop, with ofono 1.12.bzr6872+14.10.20140804-0ubuntu1

Tony Espy (awe)
Changed in ofono (Ubuntu):
assignee: nobody → Jussi Kangas (jkangas)
Revision history for this message
Tony Espy (awe) wrote :

@Antti

Can you please me a little more explicit on how you tested this on the desktop. Did you copy a gprs settings file from a phone onto the desktop?

How did you start ofono, did you use phonesim?

Can you attach the output of list-contexts *before* you tried to modify MessageCenter/MessageProxy?

Note, if the APNs in question do not already have MessageCenter and MessageProxy defined this might be the source of your problem.

FYI, I've asked Jussi Kangas to help you debug and as you're both in the timezone, feel free to ping him tomorrow.

Changed in ofono (Ubuntu):
status: New → Incomplete
assignee: Jussi Kangas (jkangas) → Antti Kaijanmäki (kaijanmaki)
Jussi Kangas (jkangas)
Changed in ofono (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Jussi Kangas (jkangas) wrote :

This seems to be caused by commit 7f3955122af8b0349fb7d3f2db8abd754459d146: src: allow MessageCenter/Proxy for TYPE_INTERNET. "Invalid arguments" is returned by change introduced in line 2921 in the commit.

I recommed changing the check as follows:

 if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
  ctx->type == OFONO_GPRS_CONTEXT_TYPE_WAP ||
  ctx->type == OFONO_GPRS_CONTEXT_TYPE_IMS)
  return __ofono_error_invalid_args(msg);

That seems to fix the problem.

Revision history for this message
Tony Espy (awe) wrote :

@Jussi

Please either include the git repository or more preferred an actual hyperlink to the commit on github, as it makes it easier for someone looking at the bug to view directly.

https://github.com/rilmodem/ofono/commit/7f3955122af8b0349fb7d3f2db8abd754459d146

I'm not sure I understand how the check in provision_context() could trigger an InvalidParameter return to a SetProperty DBus call? I checked and provision_context() is static and is only called by provision_contexts() which in turn is only called by the spn and gid1 callback functions. Am I missing something?

Looking at pri_set_property ( https://github.com/rilmodem/ofono/blob/master/src/gprs.c#L1122 ), if the property being set is MessageCenter or MessageProxy, invalid arg is returned if the context type isn't MMS or INTERNET, or if the DBus type isn't a string.

@Antti

FYI, as opposed to doing everything via dfeet or dbus-send, check ofono-scripts. There's such a script called 'set-context-property' which *should* handle this for you. That said, it might not have been patched, so please let us know if it doesn't work.

Also can you please include your full command-line for dbus-send?

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.

Revision history for this message
Tony Espy (awe) wrote :

Got it, it makes sense now.

The check says if the context is NOT MMS *OR* NOT INTERNET then return invalid args. Well if it's MMS then it's NOT INTERNET, and visa versa. Pretty dumb mistake.

Can you please go ahead an propose a pull request against rilmodem/ofono?

Revision history for this message
Jussi Kangas (jkangas) wrote :
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

need this for APN support among other things

tags: added: rtm14
Changed in ofono (Ubuntu):
importance: Undecided → Critical
Changed in ofono (Ubuntu):
assignee: Antti Kaijanmäki (kaijanmaki) → Tony Espy (awe)
Tony Espy (awe)
Changed in ofono (Ubuntu RTM):
status: New → Confirmed
importance: Undecided → Critical
assignee: nobody → Tony Espy (awe)
Changed in ofono (Ubuntu):
status: Confirmed → In Progress
Changed in ofono (Ubuntu RTM):
status: Confirmed → In Progress
Tony Espy (awe)
Changed in ofono (Ubuntu):
status: In Progress → Fix Committed
Changed in ofono (Ubuntu RTM):
status: In Progress → Fix Committed
Revision history for this message
Jussi Kangas (jkangas) wrote :

Tested with rtm silo 001 in Krillin r16 and utopic silo 18 in mako r221. Fix works.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ofono - 1.12.bzr6876+14.10.20140904-0ubuntu1

---------------
ofono (1.12.bzr6876+14.10.20140904-0ubuntu1) utopic; urgency=medium

  [ Jussi Kangas ]
  * src/gprs.c: Fix to allow MMS properties to be set (LP: #1362068)

  [ Tony Espy ]
  * rilmodem/sim.c: Fix EnterPIN logic (LP: #1363413)

  [ Ubuntu daily release ]
  * New rebuild forced
 -- Ubuntu daily release <email address hidden> Thu, 04 Sep 2014 22:31:59 +0000

Changed in ofono (Ubuntu):
status: Fix Committed → Fix Released
Tony Espy (awe)
Changed in ofono (Ubuntu RTM):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.