mirror of git://git.sysmocom.de/ofono
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.
This commit is contained in:
parent
465a4f5ef5
commit
a72e092d19
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue