From ea7edbbf9e3de5f3cd1c4c0ed335a0f5504f0edc Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Mon, 27 Aug 2012 15:16:50 +0200 Subject: [PATCH] bearer-qmi: only specify IP family preference TLV if one explicitly requested --- src/mm-bearer-qmi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index 3b3ed894..7e63e81c 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -82,6 +82,7 @@ typedef struct { gchar *user; gchar *password; gchar *apn; + gboolean no_ip_family_preference; gboolean ipv4; gboolean running_ipv4; @@ -234,10 +235,15 @@ build_start_network_input (ConnectContext *ctx) if (ctx->password) qmi_message_wds_start_network_input_set_password (input, ctx->password, NULL); - qmi_message_wds_start_network_input_set_ip_family_preference ( - input, - (ctx->running_ipv6 ? QMI_WDS_IP_FAMILY_IPV6 : QMI_WDS_IP_FAMILY_IPV4), - NULL); + /* Only add the IP family preference TLV if explicitly requested a given + * family. This TLV may be newer than the Start Network command itself, so + * we'll just allow the case where none is specified */ + if (!ctx->no_ip_family_preference) { + qmi_message_wds_start_network_input_set_ip_family_preference ( + input, + (ctx->running_ipv6 ? QMI_WDS_IP_FAMILY_IPV6 : QMI_WDS_IP_FAMILY_IPV4), + NULL); + } return input; } @@ -583,6 +589,7 @@ connect (MMBearer *self, case MM_BEARER_IP_FAMILY_UNKNOWN: default: mm_dbg ("No specific IP family requested, defaulting to IPv4"); + ctx->no_ip_family_preference = TRUE; ctx->ipv4 = TRUE; ctx->ipv6 = FALSE; break;