diff options
-rw-r--r-- | gatchat/ppp_cp.c | 8 | ||||
-rw-r--r-- | gatchat/ppp_cp.h | 2 | ||||
-rw-r--r-- | gatchat/ppp_ipcp.c | 10 | ||||
-rw-r--r-- | gatchat/ppp_lcp.c | 2 |
4 files changed, 17 insertions, 5 deletions
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c index 647e241e..f6220d2c 100644 --- a/gatchat/ppp_cp.c +++ b/gatchat/ppp_cp.c @@ -997,7 +997,7 @@ void pppcp_set_local_options(struct pppcp_data *pppcp, } struct pppcp_data *pppcp_new(GAtPPP *ppp, const struct pppcp_proto *proto, - gboolean dormant) + gboolean dormant, guint max_failure) { struct pppcp_data *data; @@ -1016,7 +1016,11 @@ struct pppcp_data *pppcp_new(GAtPPP *ppp, const struct pppcp_proto *proto, data->terminate_timer_data.max_counter = MAX_TERMINATE; data->config_timer_data.data = data; data->terminate_timer_data.data = data; - data->max_failure = MAX_FAILURE; + + if (max_failure) + data->max_failure = max_failure; + else + data->max_failure = MAX_FAILURE; data->ppp = ppp; data->driver = proto; diff --git a/gatchat/ppp_cp.h b/gatchat/ppp_cp.h index 56a20e04..edcc996d 100644 --- a/gatchat/ppp_cp.h +++ b/gatchat/ppp_cp.h @@ -104,7 +104,7 @@ guint8 ppp_option_iter_get_length(struct ppp_option_iter *iter); const guint8 *ppp_option_iter_get_data(struct ppp_option_iter *iter); struct pppcp_data *pppcp_new(GAtPPP *ppp, const struct pppcp_proto *proto, - gboolean dormant); + gboolean dormant, guint max_failure); void pppcp_free(struct pppcp_data *data); void pppcp_set_data(struct pppcp_data *pppcp, gpointer data); 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); diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c index 3cfab5c7..5838ebda 100644 --- a/gatchat/ppp_lcp.c +++ b/gatchat/ppp_lcp.c @@ -313,7 +313,7 @@ struct pppcp_data *lcp_new(GAtPPP *ppp, gboolean is_server) if (!lcp) return NULL; - pppcp = pppcp_new(ppp, &lcp_proto, is_server); + pppcp = pppcp_new(ppp, &lcp_proto, is_server, 0); if (!pppcp) { g_free(lcp); return NULL; |