From: Kristen Carlson Accardi <kristen@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 5/5] ppp: handle Config-Reject
Date: Fri, 26 Mar 2010 18:34:30 -0700 [thread overview]
Message-ID: <1269653670-31352-6-git-send-email-kristen@linux.intel.com> (raw)
In-Reply-To: <1269653670-31352-1-git-send-email-kristen@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2187 bytes --]
if our peer sends us a Config-Reject packet, we must delete that
config item and not request that it be negotiated when we send our
next Config-Request.
---
gatchat/ppp_cp.c | 49 ++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index d7d70b7..ac1a37d 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -1363,22 +1363,49 @@ static guint8 pppcp_process_configure_nak(struct pppcp_data *data,
static guint8 pppcp_process_configure_reject(struct pppcp_data *data,
struct pppcp_packet *packet)
{
+ guint len;
+ GList *list;
+ struct ppp_option *rejected_option;
+ guint i = 0;
+
+ len = ntohs(packet->length) - CP_HEADER_SZ;
+
/*
* make sure identifier matches that of last sent configure
* request
*/
- if (packet->identifier == data->config_identifier) {
- /*
- * check to see which options were rejected
- * Rejected options must be a subset of requested
- * options.
- *
- * when a new configure-request is sent, we may
- * not request any of these options be negotiated
- */
- return RCN;
+ if (packet->identifier != data->config_identifier)
+ return 0;
+
+ /*
+ * check to see which options were rejected
+ * Rejected options must be a subset of requested
+ * options.
+ *
+ * when a new configure-request is sent, we may
+ * not request any of these options be negotiated
+ */
+ while (i < len) {
+ rejected_option = extract_ppp_option(&packet->data[i]);
+ if (rejected_option == NULL)
+ break;
+
+ /* skip ahead to the next option */
+ i += rejected_option->length;
+
+ /* find this option in our config options list */
+ list = g_list_find_custom(data->config_options,
+ GUINT_TO_POINTER((guint) rejected_option->type),
+ is_option);
+ if (list) {
+ /* delete this config option */
+ g_free(list->data);
+ data->config_options =
+ g_list_delete_link(data->config_options, list);
+ }
+ g_free(rejected_option);
}
- return 0;
+ return RCN;
}
static guint8 pppcp_process_terminate_request(struct pppcp_data *data,
--
1.6.6.1
next prev parent reply other threads:[~2010-03-27 1:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-27 1:34 [PATCH 0/5] ppp: error path fixes Kristen Carlson Accardi
2010-03-27 1:34 ` [PATCH 1/5] ppp: fix segfault in pppcp_send_code_reject() Kristen Carlson Accardi
2010-03-27 1:34 ` [PATCH 2/5] ppp: comment fix Kristen Carlson Accardi
2010-03-27 1:34 ` [PATCH 3/5] ppp: send Protocol-Reject Kristen Carlson Accardi
2010-03-27 1:34 ` [PATCH 4/5] ppp: use common code to get options from pppcp packet data Kristen Carlson Accardi
2010-03-27 1:34 ` Kristen Carlson Accardi [this message]
2010-03-27 2:29 ` [PATCH 0/5] ppp: error path fixes Marcel Holtmann
2010-03-27 4:39 ` Kristen Carlson Accardi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1269653670-31352-6-git-send-email-kristen@linux.intel.com \
--to=kristen@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox