diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-04-13 13:34:12 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-04-13 13:34:12 -0500 |
commit | dbbaa3c416db7c404bdf167c7984fe0777367438 (patch) | |
tree | 73958ba2cf4cb8654164668ec86c50fda50c3411 | |
parent | 8c1677713fa24b34d2ad93743b0bb7fe0a430bb7 (diff) | |
download | ofono-dbbaa3c416db7c404bdf167c7984fe0777367438.tar.bz2 |
ppp: Reset the options whenever the layer is down
So we can re-negotiate the options if the layer is opened again.
-rw-r--r-- | gatchat/ppp_ipcp.c | 25 | ||||
-rw-r--r-- | gatchat/ppp_lcp.c | 18 |
2 files changed, 32 insertions, 11 deletions
diff --git a/gatchat/ppp_ipcp.c b/gatchat/ppp_ipcp.c index 26092ded..74e7778f 100644 --- a/gatchat/ppp_ipcp.c +++ b/gatchat/ppp_ipcp.c @@ -101,6 +101,20 @@ static void ipcp_generate_config_options(struct ipcp_data *ipcp) ipcp->options_len = len; } +static void ipcp_reset_config_options(struct ipcp_data *ipcp) +{ + ipcp->req_options = REQ_OPTION_IPADDR | REQ_OPTION_DNS1 | + REQ_OPTION_DNS2 | REQ_OPTION_NBNS1 | + REQ_OPTION_NBNS2; + ipcp->ipaddr = 0; + ipcp->dns1 = 0; + ipcp->dns2 = 0; + ipcp->nbns1 = 0; + ipcp->nbns2 = 0; + + ipcp_generate_config_options(ipcp); +} + static void ipcp_up(struct pppcp_data *pppcp) { struct ipcp_data *ipcp = pppcp_get_data(pppcp); @@ -129,6 +143,10 @@ static void ipcp_up(struct pppcp_data *pppcp) static void ipcp_down(struct pppcp_data *pppcp) { + struct ipcp_data *ipcp = pppcp_get_data(pppcp); + + ipcp_reset_config_options(ipcp); + pppcp_set_local_options(pppcp, ipcp->options, ipcp->options_len); } /* @@ -307,12 +325,7 @@ struct pppcp_data *ipcp_new(GAtPPP *ppp) } pppcp_set_data(pppcp, ipcp); - - ipcp->req_options = REQ_OPTION_IPADDR | REQ_OPTION_DNS1 | - REQ_OPTION_DNS2 | REQ_OPTION_NBNS1 | - REQ_OPTION_NBNS2; - - ipcp_generate_config_options(ipcp); + ipcp_reset_config_options(ipcp); pppcp_set_local_options(pppcp, ipcp->options, ipcp->options_len); return pppcp; diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c index 304a72c2..e945fea8 100644 --- a/gatchat/ppp_lcp.c +++ b/gatchat/ppp_lcp.c @@ -90,6 +90,14 @@ static void lcp_generate_config_options(struct lcp_data *lcp) lcp->options_len = len; } +static void lcp_reset_config_options(struct lcp_data *lcp) +{ + lcp->req_options = REQ_OPTION_ACCM; + lcp->accm = 0; + + lcp_generate_config_options(lcp); +} + /* * signal the Up event to the NCP */ @@ -103,7 +111,10 @@ static void lcp_up(struct pppcp_data *pppcp) */ static void lcp_down(struct pppcp_data *pppcp) { - /* XXX should implement a way to signal NCP */ + struct lcp_data *lcp = pppcp_get_data(pppcp); + + lcp_reset_local_options(lcp); + pppcp_set_local_options(pppcp, lcp->options, lcp->options_len); } /* @@ -255,10 +266,7 @@ struct pppcp_data *lcp_new(GAtPPP *ppp) pppcp_set_data(pppcp, lcp); - lcp->req_options = REQ_OPTION_ACCM; - lcp->accm = 0; - - lcp_generate_config_options(lcp); + lcp_reset_local_options(lcp); pppcp_set_local_options(pppcp, lcp->options, lcp->options_len); return pppcp; |