From 5c5eff0b5bdcc9281f9f0cc97e623e5b45b3897e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 10 Feb 2012 11:45:34 +0100 Subject: [PATCH] ifxmodem: Add support for IPv6 and dual mode contexts --- drivers/ifxmodem/gprs-context.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c index 6902f174..f66e1a1c 100644 --- a/drivers/ifxmodem/gprs-context.c +++ b/drivers/ifxmodem/gprs-context.c @@ -320,11 +320,7 @@ static void ifx_gprs_activate_primary(struct ofono_gprs_context *gc, { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); char buf[OFONO_GPRS_MAX_APN_LENGTH + 128]; - int len; - - /* IPv6 support not implemented */ - if (ctx->proto != OFONO_GPRS_PROTO_IP) - goto error; + int len = 0; DBG("cid %u", ctx->cid); @@ -336,7 +332,20 @@ static void ifx_gprs_activate_primary(struct ofono_gprs_context *gc, gcd->state = STATE_ENABLING; - len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid); + switch (ctx->proto) { + case OFONO_GPRS_PROTO_IP: + len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", + ctx->cid); + break; + case OFONO_GPRS_PROTO_IPV6: + len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IPV6\"", + ctx->cid); + break; + case OFONO_GPRS_PROTO_IPV4V6: + len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IPV4V6\"", + ctx->cid); + break; + } if (ctx->apn) snprintf(buf + len, sizeof(buf) - len - 3, @@ -346,7 +355,6 @@ static void ifx_gprs_activate_primary(struct ofono_gprs_context *gc, setup_cb, gc, NULL) > 0) return; -error: CALLBACK_WITH_FAILURE(cb, data); }