Compare commits

...

6 Commits

Author SHA1 Message Date
Slava Monich
cefc03e5ed Merge branch 'pcscf' into 'master'
Expose P-CSCF address(es) over D-Bus

See merge request mer-core/ofono!285
2021-06-03 21:29:06 +00:00
Slava Monich
85d99536ee Merge branch 'mtu' into 'master'
Don't limit MTU for non-MMS contexts

See merge request mer-core/ofono!284
2021-06-03 21:28:08 +00:00
Slava Monich
ea36baa4c1 [ril] Don't limit MTU for non-MMS contexts
Larger MTU means better throughput, and the original problem for which
this workaround was implemented was specific to MMS. There's no reason
to limit MTU for other data connections.
2021-06-03 19:49:38 +03:00
Slava Monich
b95a089c00 [ril] Provide P-CSCF address to the core. JB#48905
Also optimized reporting of DNS addresses by not setting empty lists.
If nothing else, that slightly reduces the amount of D-Bus traffic.
2021-06-03 19:36:52 +03:00
Slava Monich
c8dbf5494b [ofono] Expose P-CSCF address(es) via D-Bus. JB#48905 2021-06-03 19:01:01 +03:00
Slava Monich
cfb75f473d [sim] Fixed AID comparison. JB#54048
It worked only because aid was the first field in the struct.
2021-06-03 04:24:46 +03:00
5 changed files with 118 additions and 18 deletions

View File

@@ -278,6 +278,13 @@ Properties boolean Active [readwrite]
via this proxy. All other values are left
out in this case.
array{string} ProxyCSCF [readonly, optional]
Holds the list of P-CSCF (SIP proxy) for this
context. Only used by IMS connections.
This is a Sailfish OS specific extension.
dict IPv6.Settings [readonly, optional]
Holds all the IPv6 network settings
@@ -304,6 +311,13 @@ Properties boolean Active [readwrite]
Holds the gateway IP for this connection.
array{string} ProxyCSCF [readonly, optional]
Holds the list of P-CSCF (SIP proxy) for this
context. Only used by IMS connections.
This is a Sailfish OS specific extension.
string MessageProxy [readwrite, MMS only]
Holds the MMS Proxy setting.

View File

@@ -1,7 +1,7 @@
/*
* oFono - Open Source Telephony - RIL-based devices
*
* Copyright (C) 2015-2019 Jolla Ltd.
* Copyright (C) 2015-2021 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -29,7 +29,7 @@
#define CTX_ID_NONE ((unsigned int)(-1))
#define MAX_MTU 1280
#define MAX_MMS_MTU 1280
struct ril_gprs_context_call {
struct ril_data_request *req;
@@ -108,8 +108,15 @@ static void ril_gprs_context_set_active_call(struct ril_gprs_context *gcd,
if (call) {
ril_data_call_free(gcd->active_call);
gcd->active_call = ril_data_call_dup(call);
if (!gcd->mtu_watch) {
gcd->mtu_watch = mtu_watch_new(MAX_MTU);
if (ofono_gprs_context_get_type(gcd->gc) ==
OFONO_GPRS_CONTEXT_TYPE_MMS) {
/*
* Some MMS providers have a problem with MTU
* greater than 1280. Let's be safe.
*/
if (!gcd->mtu_watch) {
gcd->mtu_watch = mtu_watch_new(MAX_MMS_MTU);
}
}
mtu_watch_set_ifname(gcd->mtu_watch, call->ifname);
ril_data_call_grab(gcd->data, call->cid, gcd);
@@ -247,34 +254,59 @@ static void ril_gprs_context_set_gateway(struct ofono_gprs_context *gc,
ofono_gprs_context_set_ipv6_gateway(gc, ipv6_gw);
}
static void ril_gprs_context_set_dns_servers(struct ofono_gprs_context *gc,
const struct ril_data_call *call)
typedef void (*ofono_gprs_context_list_setter_t)(struct ofono_gprs_context *gc,
const char **list);
static void ril_gprs_context_set_servers(struct ofono_gprs_context *gc,
char * const *list, ofono_gprs_context_list_setter_t set_ipv4,
ofono_gprs_context_list_setter_t set_ipv6)
{
int i;
char * const *list = call->dnses;
const char **ip_list = NULL, **ip_ptr = NULL;
const char **ipv6_list = NULL, **ipv6_ptr = NULL;
const int n = gutil_strv_length(list);
const char **ip_dns = g_new0(const char *, n+1);
const char **ipv6_dns = g_new0(const char *, n+1);
const char **ip_ptr = ip_dns;
const char **ipv6_ptr = ipv6_dns;
for (i = 0; i < n; i++) {
const char *addr = list[i];
switch (ril_gprs_context_address_family(addr)) {
case AF_INET:
if (!ip_ptr) {
ip_list = g_new0(const char *, n - i + 1);
ip_ptr = ip_list;
}
*ip_ptr++ = addr;
break;
case AF_INET6:
if (!ipv6_ptr) {
ipv6_list = g_new0(const char *, n - i + 1);
ipv6_ptr = ipv6_list;
}
*ipv6_ptr++ = addr;
break;
}
}
ofono_gprs_context_set_ipv4_dns_servers(gc, ip_dns);
ofono_gprs_context_set_ipv6_dns_servers(gc, ipv6_dns);
set_ipv4(gc, ip_list);
set_ipv6(gc, ipv6_list);
g_free(ip_dns);
g_free(ipv6_dns);
g_free(ip_list);
g_free(ipv6_list);
}
static void ril_gprs_context_set_dns_servers(struct ofono_gprs_context *gc,
const struct ril_data_call *call)
{
ril_gprs_context_set_servers(gc, call->dnses,
ofono_gprs_context_set_ipv4_dns_servers,
ofono_gprs_context_set_ipv6_dns_servers);
}
static void ril_gprs_context_set_proxy_cscf(struct ofono_gprs_context *gc,
const struct ril_data_call *call)
{
ril_gprs_context_set_servers(gc, call->pcscf,
ofono_gprs_context_set_ipv4_proxy_cscf,
ofono_gprs_context_set_ipv6_proxy_cscf);
}
/* Only compares the stuff that's important to us */
@@ -282,7 +314,8 @@ static void ril_gprs_context_set_dns_servers(struct ofono_gprs_context *gc,
#define DATA_CALL_ADDRESS_CHANGED (0x02)
#define DATA_CALL_GATEWAY_CHANGED (0x04)
#define DATA_CALL_DNS_CHANGED (0x08)
#define DATA_CALL_ALL_CHANGED (0x0f)
#define DATA_CALL_PCSCF_CHANGED (0x10)
#define DATA_CALL_ALL_CHANGED (0x1f)
static int ril_gprs_context_data_call_change(
const struct ril_data_call *c1,
const struct ril_data_call *c2)
@@ -308,6 +341,10 @@ static int ril_gprs_context_data_call_change(
changes |= DATA_CALL_DNS_CHANGED;
}
if (!gutil_strv_equal(c1->pcscf, c2->pcscf)) {
changes |= DATA_CALL_PCSCF_CHANGED;
}
return changes;
} else {
return DATA_CALL_ALL_CHANGED;
@@ -380,6 +417,11 @@ static void ril_gprs_context_call_list_changed(struct ril_data *data, void *arg)
ril_gprs_context_set_dns_servers(gc, call);
}
if (change & DATA_CALL_PCSCF_CHANGED) {
DBG("P-CSCF changed");
ril_gprs_context_set_proxy_cscf(gc, call);
}
ofono_gprs_context_signal_change(gc, gcd->active_ctx_cid);
ril_data_call_free(prev_call);
}
@@ -421,6 +463,7 @@ static void ril_gprs_context_activate_primary_cb(struct ril_data *data,
ril_gprs_context_set_address(gc, call);
ril_gprs_context_set_gateway(gc, call);
ril_gprs_context_set_dns_servers(gc, call);
ril_gprs_context_set_proxy_cscf(gc, call);
ril_error_init_ok(&error);
}

View File

@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2015-2021 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -128,6 +129,8 @@ void ofono_gprs_context_set_ipv4_gateway(struct ofono_gprs_context *gc,
const char *gateway);
void ofono_gprs_context_set_ipv4_dns_servers(struct ofono_gprs_context *gc,
const char **dns);
void ofono_gprs_context_set_ipv4_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf); /* Since mer/1.23+git30 */
void ofono_gprs_context_set_ipv6_address(struct ofono_gprs_context *gc,
const char *address);
@@ -137,6 +140,8 @@ void ofono_gprs_context_set_ipv6_gateway(struct ofono_gprs_context *gc,
const char *gateway);
void ofono_gprs_context_set_ipv6_dns_servers(struct ofono_gprs_context *gc,
const char **dns);
void ofono_gprs_context_set_ipv6_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf); /* Since mer/1.23+git30 */
void ofono_gprs_context_signal_change(struct ofono_gprs_context *gc,
unsigned int cid);

View File

@@ -3,7 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2015-2020 Jolla Ltd.
* Copyright (C) 2015-2021 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -97,6 +97,7 @@ struct ipv4_settings {
char *netmask;
char *gateway;
char **dns;
char **pcscf;
char *proxy;
};
@@ -105,6 +106,7 @@ struct ipv6_settings {
unsigned char prefix_len;
char *gateway;
char **dns;
char **pcscf;
};
struct context_settings {
@@ -410,6 +412,7 @@ static void context_settings_free(struct context_settings *settings)
g_free(settings->ipv4->netmask);
g_free(settings->ipv4->gateway);
g_strfreev(settings->ipv4->dns);
g_strfreev(settings->ipv4->pcscf);
g_free(settings->ipv4->proxy);
g_free(settings->ipv4);
@@ -420,6 +423,7 @@ static void context_settings_free(struct context_settings *settings)
g_free(settings->ipv6->ip);
g_free(settings->ipv6->gateway);
g_strfreev(settings->ipv6->dns);
g_strfreev(settings->ipv6->pcscf);
g_free(settings->ipv6);
settings->ipv6 = NULL;
@@ -484,6 +488,11 @@ static void context_settings_append_ipv4(struct context_settings *settings,
DBUS_TYPE_STRING,
&settings->ipv4->dns);
if (settings->ipv4->pcscf)
ofono_dbus_dict_append_array(&array, "ProxyCSCF",
DBUS_TYPE_STRING,
&settings->ipv4->pcscf);
done:
dbus_message_iter_close_container(&variant, &array);
@@ -549,6 +558,11 @@ static void context_settings_append_ipv6(struct context_settings *settings,
DBUS_TYPE_STRING,
&settings->ipv6->dns);
if (settings->ipv6->pcscf)
ofono_dbus_dict_append_array(&array, "ProxyCSCF",
DBUS_TYPE_STRING,
&settings->ipv6->pcscf);
done:
dbus_message_iter_close_container(&variant, &array);
@@ -3417,6 +3431,18 @@ void ofono_gprs_context_set_ipv4_dns_servers(struct ofono_gprs_context *gc,
settings->ipv4->dns = g_strdupv((char **) dns);
}
void ofono_gprs_context_set_ipv4_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf)
{
struct context_settings *settings = gc->settings;
if (settings->ipv4 == NULL)
return;
g_strfreev(settings->ipv4->pcscf);
settings->ipv4->pcscf = g_strdupv((char **) pcscf);
}
void ofono_gprs_context_set_ipv6_address(struct ofono_gprs_context *gc,
const char *address)
{
@@ -3464,6 +3490,18 @@ void ofono_gprs_context_set_ipv6_dns_servers(struct ofono_gprs_context *gc,
settings->ipv6->dns = g_strdupv((char **) dns);
}
void ofono_gprs_context_set_ipv6_proxy_cscf(struct ofono_gprs_context *gc,
const char **pcscf)
{
struct context_settings *settings = gc->settings;
if (settings->ipv6 == NULL)
return;
g_strfreev(settings->ipv6->pcscf);
settings->ipv6->pcscf = g_strdupv((char **) pcscf);
}
void ofono_gprs_context_signal_change(struct ofono_gprs_context *gc,
unsigned int cid)
{

View File

@@ -3823,7 +3823,7 @@ struct ofono_sim_aid_session *__ofono_sim_get_session_by_aid(
struct ofono_sim_aid_session *session = iter->data;
if (session->record->aid.len == aid->len &&
!memcmp(session->record->aid.aid, aid, aid->len))
!memcmp(session->record->aid.aid, aid->aid, aid->len))
return session;
iter = g_slist_next(iter);