diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-03-21 22:09:03 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-03-21 22:09:03 -0700 |
commit | 63acbad39a2b9c3e6c31a2aa98e4976adc27a433 (patch) | |
tree | ec878947b704fce562408fbd009bb1ca503a6103 /drivers/swmodem | |
parent | 9abf49fa2b6067e79462729b3088050f1dfd6439 (diff) | |
download | ofono-63acbad39a2b9c3e6c31a2aa98e4976adc27a433.tar.gz |
swmodem: Add support for IPv6 and IPv4v6 contexts
Diffstat (limited to 'drivers/swmodem')
-rw-r--r-- | drivers/swmodem/gprs-context.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/swmodem/gprs-context.c b/drivers/swmodem/gprs-context.c index d9b494de..16695973 100644 --- a/drivers/swmodem/gprs-context.c +++ b/drivers/swmodem/gprs-context.c @@ -151,8 +151,8 @@ static void sw_gprs_activate_primary(struct ofono_gprs_context *gc, { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); struct cb_data *cbd = cb_data_new(cb, data); - char buf[64]; - int len; + char buf[OFONO_GPRS_MAX_APN_LENGTH + 128]; + int len = 0; DBG("cid %u", ctx->cid); @@ -160,11 +160,24 @@ static void sw_gprs_activate_primary(struct ofono_gprs_context *gc, cbd->user = gc; - 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, ",\"%s\"", - ctx->apn); + snprintf(buf + len, sizeof(buf) - len - 3, + ",\"%s\"", ctx->apn); if (g_at_chat_send(gcd->chat, buf, none_prefix, at_cgdcont_cb, cbd, g_free) > 0) |