All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ppp: implement Max-Failure counter
@ 2010-04-03  5:27 Kristen Carlson Accardi
  2010-04-03  5:35 ` Kristen Carlson Accardi
  2010-04-05 14:46 ` Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: Kristen Carlson Accardi @ 2010-04-03  5:27 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2216 bytes --]

put a cap on the number of Configure-Nak packets we send.
---
 gatchat/ppp_cp.c |   22 ++++++++++++++++++++++
 gatchat/ppp_cp.h |    1 +
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index cf2f5fa..5e854da 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -238,6 +238,15 @@ static void copy_option(gpointer data, gpointer user_data)
 	*location += option->length;
 }
 
+static void reject_option(gpointer data, gpointer user_data)
+{
+	struct ppp_option *option = data;
+	struct pppcp_data *pppcp = user_data;
+
+	pppcp->rejected_options =
+		g_list_append(pppcp->rejected_options, option);
+}
+
 static void print_option(gpointer data, gpointer user_data)
 {
 	struct ppp_option *option = data;
@@ -315,6 +324,8 @@ static void pppcp_send_configure_ack(struct pppcp_data *data,
 
 	pppcp_trace(data);
 
+	data->failure_counter = 0;
+
 	g_list_foreach(data->acceptable_options, print_option, data);
 
 	/* subtract for header. */
@@ -347,6 +358,16 @@ static void pppcp_send_configure_nak(struct pppcp_data *data,
 	guint8 olength;
 	guint8 *odata;
 
+	/*
+	 * if we have exceeded our Max-Failure counter, we need
+	 * to convert all packets to Configure-Reject
+	 */
+	if (data->failure_counter >= data->max_failure) {
+		g_list_foreach(data->unacceptable_options, reject_option, data);
+		g_list_free(data->unacceptable_options);
+		data->unacceptable_options = NULL;
+	}
+
 	/* if we have any rejected options, send a config-reject */
 	if (g_list_length(data->rejected_options)) {
 		pppcp_trace(data);
@@ -395,6 +416,7 @@ static void pppcp_send_configure_nak(struct pppcp_data *data,
 				ntohs(packet->length));
 
 		pppcp_packet_free(packet);
+		data->failure_counter++;
 	}
 }
 
diff --git a/gatchat/ppp_cp.h b/gatchat/ppp_cp.h
index 5b5d589..ee7ac8d 100644
--- a/gatchat/ppp_cp.h
+++ b/gatchat/ppp_cp.h
@@ -111,6 +111,7 @@ struct pppcp_data {
 	struct pppcp_timer_data config_timer_data;
 	struct pppcp_timer_data terminate_timer_data;
 	guint max_failure;
+	guint failure_counter;
 	guint32 magic_number;
 	GList *config_options;
 	GList *acceptable_options;
-- 
1.6.6.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ppp: implement Max-Failure counter
  2010-04-03  5:27 [PATCH] ppp: implement Max-Failure counter Kristen Carlson Accardi
@ 2010-04-03  5:35 ` Kristen Carlson Accardi
  2010-04-05 14:46 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Kristen Carlson Accardi @ 2010-04-03  5:35 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 365 bytes --]

On Fri,  2 Apr 2010 22:27:00 -0700
Kristen Carlson Accardi <kristen@linux.intel.com> wrote:

> put a cap on the number of Configure-Nak packets we send.

Denis - did you have a modem that just went off into a flurry of
sending Configure-Naks?  If so, would you mind testing this patch
on it to see if this helps it accept defeat more gracefully?

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ppp: implement Max-Failure counter
  2010-04-03  5:27 [PATCH] ppp: implement Max-Failure counter Kristen Carlson Accardi
  2010-04-03  5:35 ` Kristen Carlson Accardi
@ 2010-04-05 14:46 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2010-04-05 14:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

Hi Kristen,

> put a cap on the number of Configure-Nak packets we send.
> ---
>  gatchat/ppp_cp.c |   22 ++++++++++++++++++++++
>  gatchat/ppp_cp.h |    1 +
>  2 files changed, 23 insertions(+), 0 deletions(-)

This patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-05 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-03  5:27 [PATCH] ppp: implement Max-Failure counter Kristen Carlson Accardi
2010-04-03  5:35 ` Kristen Carlson Accardi
2010-04-05 14:46 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.