* [PATCH] gprs-context: fix don't use default ipv4 netmask
@ 2016-04-21 3:03 Nishanth V
2016-04-21 17:23 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Nishanth V @ 2016-04-21 3:03 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2675 bytes --]
---
drivers/rilmodem/gprs-context.c | 3 ++-
drivers/rilmodem/rilutil.c | 51 ++++++++++++++++-------------------------
2 files changed, 22 insertions(+), 32 deletions(-)
diff --git a/drivers/rilmodem/gprs-context.c b/drivers/rilmodem/gprs-context.c
index 2bc6445..1e5f6ed 100644
--- a/drivers/rilmodem/gprs-context.c
+++ b/drivers/rilmodem/gprs-context.c
@@ -304,7 +304,8 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
goto error_free;
}
- ofono_gprs_context_set_ipv4_netmask(gc, netmask);
+ if (netmask)
+ ofono_gprs_context_set_ipv4_netmask(gc, netmask);
ofono_gprs_context_set_ipv4_address(gc, split_ip_addr[0], TRUE);
}
diff --git a/drivers/rilmodem/rilutil.c b/drivers/rilmodem/rilutil.c
index dc9c3cc..44e5a9c 100644
--- a/drivers/rilmodem/rilutil.c
+++ b/drivers/rilmodem/rilutil.c
@@ -52,39 +52,28 @@ void decode_ril_error(struct ofono_error *error, const char *final)
gchar *ril_util_get_netmask(const gchar *address)
{
- char *result;
-
- if (g_str_has_suffix(address, "/30")) {
- result = PREFIX_30_NETMASK;
- } else if (g_str_has_suffix(address, "/29")) {
- result = PREFIX_29_NETMASK;
- } else if (g_str_has_suffix(address, "/28")) {
- result = PREFIX_28_NETMASK;
- } else if (g_str_has_suffix(address, "/27")) {
- result = PREFIX_27_NETMASK;
- } else if (g_str_has_suffix(address, "/26")) {
- result = PREFIX_26_NETMASK;
- } else if (g_str_has_suffix(address, "/25")) {
- result = PREFIX_25_NETMASK;
- } else if (g_str_has_suffix(address, "/24")) {
- result = PREFIX_24_NETMASK;
- } else {
- /*
- * This handles the case where the
- * Samsung RILD returns an address without
- * a prefix, however it explicitly sets a
- * /24 netmask ( which isn't returned as
- * an attribute of the DATA_CALL.
- *
- * TODO/OEM: this might need to be quirked
- * for specific devices.
- */
- result = PREFIX_24_NETMASK;
- }
+ if (g_str_has_suffix(address, "/30"))
+ return PREFIX_30_NETMASK;
+
+ if (g_str_has_suffix(address, "/29"))
+ return PREFIX_29_NETMASK;
+
+ if (g_str_has_suffix(address, "/28"))
+ return PREFIX_28_NETMASK;
+
+ if (g_str_has_suffix(address, "/27"))
+ return PREFIX_27_NETMASK;
+
+ if (g_str_has_suffix(address, "/26"))
+ return PREFIX_26_NETMASK;
+
+ if (g_str_has_suffix(address, "/25"))
+ return PREFIX_25_NETMASK;
- DBG("address: %s netmask: %s", address, result);
+ if (g_str_has_suffix(address, "/24"))
+ return PREFIX_24_NETMASK;
- return result;
+ return NULL;
}
void ril_util_build_deactivate_data_call(GRil *gril, struct parcel *rilp,
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gprs-context: fix don't use default ipv4 netmask
2016-04-21 3:03 [PATCH] gprs-context: fix don't use default ipv4 netmask Nishanth V
@ 2016-04-21 17:23 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2016-04-21 17:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 294 bytes --]
Hi Nishanth,
On 04/20/2016 10:03 PM, Nishanth V wrote:
> ---
> drivers/rilmodem/gprs-context.c | 3 ++-
> drivers/rilmodem/rilutil.c | 51 ++++++++++++++++-------------------------
> 2 files changed, 22 insertions(+), 32 deletions(-)
Applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-21 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-21 3:03 [PATCH] gprs-context: fix don't use default ipv4 netmask Nishanth V
2016-04-21 17:23 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.