linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 1/4] ppp: adds new error for decompressors to signal that packet must be dropped
@ 2013-05-21 18:18 Jorge Boncompte [DTI2]
  2013-05-21 18:18 ` [RFC PATCH v2 2/4] ppp_mppe: check coherency counter for out-of-order sequencing Jorge Boncompte [DTI2]
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jorge Boncompte [DTI2] @ 2013-05-21 18:18 UTC (permalink / raw)
  To: netdev, linux-ppp; +Cc: Jorge Boncompte [DTI2]

From: "Jorge Boncompte [DTI2]" <jorge@dti2.net>

Currently decompressors can't signal the generic PPP layer to silently
drop a packet without notifying the PPP daemon or the other party.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
---
 drivers/net/ppp/ppp_generic.c |   12 ++++++++++++
 include/linux/ppp-comp.h      |    6 ++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 72ff14b..7d26825 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1729,6 +1729,10 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
 	    (ppp->rstate & (SC_DC_FERROR | SC_DC_ERROR)) = 0)
 		skb = ppp_decompress_frame(ppp, skb);
 
+	/* Packet dropped */
+	if (skb = NULL)
+		goto err;
+
 	if (ppp->flags & SC_MUST_COMP && ppp->rstate & SC_DC_FERROR)
 		goto err;
 
@@ -1888,6 +1892,13 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
 		len = ppp->rcomp->decompress(ppp->rc_state, skb->data - 2,
 				skb->len + 2, ns->data, obuff_size);
 		if (len < 0) {
+			/* Drop the packet and continue */
+			if (len = DECOMP_DROPERROR) {
+				kfree_skb(ns);
+				kfree_skb(skb);
+				skb = NULL;
+				goto out;
+			}
 			/* Pass the compressed frame to pppd as an
 			   error indication. */
 			if (len = DECOMP_FATALERROR)
@@ -1909,6 +1920,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
 					   skb->len + 2);
 	}
 
+out:
 	return skb;
 
  err:
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index 4ea1d37..12a8ce8 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -89,8 +89,9 @@ struct compressor {
 /*
  * The return value from decompress routine is the length of the
  * decompressed packet if successful, otherwise DECOMP_ERROR
- * or DECOMP_FATALERROR if an error occurred.
- * 
+ * or DECOMP_FATALERROR if an error occurred but don't want the
+ * PPP generic layer to drop the packet.
+ *
  * We need to make this distinction so that we can disable certain
  * useful functionality, namely sending a CCP reset-request as a result
  * of an error detected after decompression.  This is to avoid infringing
@@ -100,6 +101,7 @@ struct compressor {
 
 #define DECOMP_ERROR		-1	/* error detected before decomp. */
 #define DECOMP_FATALERROR	-2	/* error detected after decomp. */
+#define DECOMP_DROPERROR	-3	/* error detected, drop packet. */
 
 extern int ppp_register_compressor(struct compressor *);
 extern void ppp_unregister_compressor(struct compressor *);
-- 
1.7.10.4



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

end of thread, other threads:[~2013-05-21 18:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-21 18:18 [RFC PATCH v2 1/4] ppp: adds new error for decompressors to signal that packet must be dropped Jorge Boncompte [DTI2]
2013-05-21 18:18 ` [RFC PATCH v2 2/4] ppp_mppe: check coherency counter for out-of-order sequencing Jorge Boncompte [DTI2]
2013-05-21 18:36   ` Eric Dumazet
2013-05-21 18:40   ` Sergei Shtylyov
2013-05-21 18:18 ` [RFC PATCH v2 3/4] ppp_mppe: cleanup kernel log messages Jorge Boncompte [DTI2]
2013-05-21 18:40   ` Joe Perches
2013-05-21 18:18 ` [RFC PATCH v2 4/4] ppp_mppe: style cleanup Jorge Boncompte [DTI2]

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).