broadband-bearer-qmi: log both IPv4 and IPv6 settings for V4V6 connections
Old code only printed one or the other; but if we have dual-stack connectivity, print everything we can read.
This commit is contained in:
@@ -55,11 +55,12 @@ typedef enum {
|
||||
CONNECT_STEP_WDS_CLIENT_IPV4,
|
||||
CONNECT_STEP_IP_FAMILY_IPV4,
|
||||
CONNECT_STEP_START_NETWORK_IPV4,
|
||||
CONNECT_STEP_GET_CURRENT_SETTINGS_IPV4,
|
||||
CONNECT_STEP_IPV6,
|
||||
CONNECT_STEP_WDS_CLIENT_IPV6,
|
||||
CONNECT_STEP_IP_FAMILY_IPV6,
|
||||
CONNECT_STEP_START_NETWORK_IPV6,
|
||||
CONNECT_STEP_GET_CURRENT_SETTINGS,
|
||||
CONNECT_STEP_GET_CURRENT_SETTINGS_IPV6,
|
||||
CONNECT_STEP_LAST
|
||||
} ConnectStep;
|
||||
|
||||
@@ -302,7 +303,6 @@ get_current_settings_ready (QmiClientWds *client,
|
||||
QmiMessageWdsGetCurrentSettingsOutput *output;
|
||||
|
||||
g_assert (ctx->running_ipv4 || ctx->running_ipv6);
|
||||
g_assert (!(ctx->running_ipv4 && ctx->running_ipv6));
|
||||
|
||||
output = qmi_client_wds_get_current_settings_finish (client, res, &error);
|
||||
if (!output ||
|
||||
@@ -317,12 +317,12 @@ get_current_settings_ready (QmiClientWds *client,
|
||||
GArray *array;
|
||||
guint8 prefix;
|
||||
|
||||
if (ctx->running_ipv4) {
|
||||
/* If the message has an IPv4 address, print IPv4 settings */
|
||||
if (qmi_message_wds_get_current_settings_output_get_ipv4_address (output, &addr, &error)) {
|
||||
mm_dbg ("QMI IPv4 Settings:");
|
||||
|
||||
/* IPv4 address */
|
||||
success = qmi_message_wds_get_current_settings_output_get_ipv4_address (output, &addr, &error);
|
||||
print_address4 (success, "Address", addr, error);
|
||||
print_address4 (TRUE, "Address", addr, error);
|
||||
g_clear_error (&error);
|
||||
|
||||
/* IPv4 gateway address */
|
||||
@@ -344,12 +344,14 @@ get_current_settings_ready (QmiClientWds *client,
|
||||
success = qmi_message_wds_get_current_settings_output_get_secondary_ipv4_dns_address (output, &addr, &error);
|
||||
print_address4 (success, " DNS #2", addr, error);
|
||||
g_clear_error (&error);
|
||||
} else {
|
||||
}
|
||||
|
||||
/* If the message has an IPv6 address, print IPv6 settings */
|
||||
if (qmi_message_wds_get_current_settings_output_get_ipv6_address (output, &array, &prefix, &error)) {
|
||||
mm_dbg ("QMI IPv6 Settings:");
|
||||
|
||||
/* IPv6 address */
|
||||
success = qmi_message_wds_get_current_settings_output_get_ipv6_address (output, &array, &prefix, &error);
|
||||
print_address6 (success, "Address", array, prefix, error);
|
||||
print_address6 (TRUE, "Address", array, prefix, error);
|
||||
g_clear_error (&error);
|
||||
|
||||
/* IPv6 gateway address */
|
||||
@@ -400,16 +402,13 @@ get_current_settings_ready (QmiClientWds *client,
|
||||
connect_context_step (ctx);
|
||||
}
|
||||
|
||||
static QmiMessageWdsGetCurrentSettingsInput *
|
||||
build_get_current_settings_input (ConnectContext *ctx)
|
||||
static void
|
||||
get_current_settings (ConnectContext *ctx, QmiClientWds *client)
|
||||
{
|
||||
QmiMessageWdsGetCurrentSettingsInput *input;
|
||||
QmiWdsGetCurrentSettingsRequestedSettings requested = QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_NONE;
|
||||
QmiWdsGetCurrentSettingsRequestedSettings requested;
|
||||
|
||||
g_assert (ctx->running_ipv4 || ctx->running_ipv6);
|
||||
g_assert (!(ctx->running_ipv4 && ctx->running_ipv6));
|
||||
|
||||
input = qmi_message_wds_get_current_settings_input_new ();
|
||||
|
||||
requested = QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_DNS_ADDRESS |
|
||||
QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_GRANTED_QOS |
|
||||
@@ -419,8 +418,15 @@ build_get_current_settings_input (ConnectContext *ctx)
|
||||
QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_DOMAIN_NAME_LIST |
|
||||
QMI_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS_IP_FAMILY;
|
||||
|
||||
input = qmi_message_wds_get_current_settings_input_new ();
|
||||
qmi_message_wds_get_current_settings_input_set_requested_settings (input, requested, NULL);
|
||||
return input;
|
||||
qmi_client_wds_get_current_settings (client,
|
||||
input,
|
||||
10,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)get_current_settings_ready,
|
||||
ctx);
|
||||
qmi_message_wds_get_current_settings_input_unref (input);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -613,10 +619,21 @@ connect_context_step (ConnectContext *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
case CONNECT_STEP_GET_CURRENT_SETTINGS_IPV4: {
|
||||
/* Retrieve and print IP configuration */
|
||||
if (ctx->packet_data_handle_ipv4) {
|
||||
mm_dbg ("Getting IPv4 configuration...");
|
||||
get_current_settings (ctx, ctx->client_ipv4);
|
||||
return;
|
||||
}
|
||||
/* Fall through */
|
||||
ctx->step++;
|
||||
}
|
||||
|
||||
case CONNECT_STEP_IPV6:
|
||||
/* If no IPv6 setup needed, jump to last */
|
||||
if (!ctx->ipv6) {
|
||||
ctx->step = CONNECT_STEP_GET_CURRENT_SETTINGS;
|
||||
ctx->step = CONNECT_STEP_LAST;
|
||||
connect_context_step (ctx);
|
||||
return;
|
||||
}
|
||||
@@ -691,32 +708,16 @@ connect_context_step (ConnectContext *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
case CONNECT_STEP_GET_CURRENT_SETTINGS:
|
||||
/* If one of IPv4 or IPv6 succeeds, get IP configuration */
|
||||
if (ctx->packet_data_handle_ipv4 || ctx->packet_data_handle_ipv6) {
|
||||
QmiMessageWdsGetCurrentSettingsInput *input;
|
||||
QmiClientWds *client;
|
||||
|
||||
if (ctx->running_ipv4)
|
||||
client = ctx->client_ipv4;
|
||||
else if (ctx->running_ipv6)
|
||||
client = ctx->client_ipv6;
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
mm_dbg ("Getting IP configuration...");
|
||||
input = build_get_current_settings_input (ctx);
|
||||
qmi_client_wds_get_current_settings (client,
|
||||
input,
|
||||
45,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)get_current_settings_ready,
|
||||
ctx);
|
||||
qmi_message_wds_get_current_settings_input_unref (input);
|
||||
case CONNECT_STEP_GET_CURRENT_SETTINGS_IPV6: {
|
||||
/* Retrieve and print IP configuration */
|
||||
if (ctx->packet_data_handle_ipv6) {
|
||||
mm_dbg ("Getting IPv6 configuration...");
|
||||
get_current_settings (ctx, ctx->client_ipv6);
|
||||
return;
|
||||
}
|
||||
/* Just fall down */
|
||||
/* Fall through */
|
||||
ctx->step++;
|
||||
}
|
||||
|
||||
case CONNECT_STEP_LAST:
|
||||
/* If one of IPv4 or IPv6 succeeds, we're connected */
|
||||
|
Reference in New Issue
Block a user