diff options
author | Zhenhua Zhang <zhenhua.zhang@intel.com> | 2010-07-09 16:53:51 +0800 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-09 09:53:24 -0300 |
commit | a72e092d191274b8c395a39c3900090ae4e16533 (patch) | |
tree | 9b267201d962b705f024263c23efa5457d726efd /gatchat/ppp_ipcp.c | |
parent | 465a4f5ef53949439d0c711b92bc23ed763e21a6 (diff) | |
download | ofono-a72e092d191274b8c395a39c3900090ae4e16533.tar.bz2 |
ppp: Add MAX_IPCP_FAILURE to avoid timeout quickly
We use IPCP NAK response to stall the progress of acquiring the client
IP address from DHCP server. So we need to increase the max failure of
NAKs in IPCP handshaking.
Diffstat (limited to 'gatchat/ppp_ipcp.c')
-rw-r--r-- | gatchat/ppp_ipcp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gatchat/ppp_ipcp.c b/gatchat/ppp_ipcp.c index d64bdedd..3aa9eece 100644 --- a/gatchat/ppp_ipcp.c +++ b/gatchat/ppp_ipcp.c @@ -63,6 +63,8 @@ enum ipcp_option_types { #define REQ_OPTION_NBNS1 0x08 #define REQ_OPTION_NBNS2 0x10 +#define MAX_IPCP_FAILURE 100 + struct ipcp_data { guint8 options[MAX_CONFIG_OPTION_SIZE]; guint16 options_len; @@ -472,7 +474,13 @@ struct pppcp_data *ipcp_new(GAtPPP *ppp, gboolean is_server, guint32 ip) if (!ipcp) return NULL; - pppcp = pppcp_new(ppp, &ipcp_proto, FALSE); + /* + * Some 3G modems use repeated IPCP NAKs as the way of stalling + * util sending us the client IP address. So we increase the + * default number of NAKs we accept before start treating them + * as rejects. + */ + pppcp = pppcp_new(ppp, &ipcp_proto, FALSE, MAX_IPCP_FAILURE); if (!pppcp) { g_printerr("Failed to allocate PPPCP struct\n"); g_free(ipcp); |