Skip to contentSkip to conversation

Multilink and ppp_input_error().

PATCH Matthew N. Dodd 2 participants 2 messages Nov 9, 2004 PPP protocol drivers and compressors

lore
Share & tools
lore
#0 lore raw

Has anyone else noticed that drivers/net/ppp_generic.c:ppp_input_error() is effectively a NOP? pppd/main.c:get_input() treats a zero length packet as a hangup indication but if you trace out the call to ppp_do_recv() in ppp_input_error() the zero length frame is never sent to the file descriptor. Further, calling an input function for the PPP device isn't useful as the intent is to deliver the error to a specific PPP channel.

I'm using the attached patch.

Comments?

--
Matthew N. Dodd <[email protected]>
Software Engineer, Patton Electronics
7622 Rickenbacker Dr., Gaithersburg, MD 20879
(301) 975-1000x184

Index: ppp_generic.c
===================================================================
RCS file: /home/cvs/linux/drivers/net/ppp_generic.c,v retrieving revision 1.23.2.6

ppp_generic.c +8 -1
diff -u -u -1 -5 -r1.23.2.6 ppp_generic.c
@@ -1361,31 +1361,38 @@
 void
 ppp_input_error(struct ppp_channel *chan, int code)
 {
 	struct channel *pch = chan->ppp;
 	struct sk_buff *skb;
 
 	if (pch == 0)
 		return;
 
 	read_lock_bh(&pch->upl);
 	if (pch->ppp != 0) {
 		skb = alloc_skb(0, GFP_ATOMIC);
 		if (skb != 0) {
 			skb->len = 0;		/* probably unnecessary */
 			skb->cb[0] = code;
-			ppp_do_recv(pch->ppp, skb, pch);
+
+			/* Queue to channel. */
+			skb_queue_tail(&pch->file.rq, skb);
+			/* drop old frames if queue too long */
+			while (pch->file.rq.qlen > PPP_MAX_RQLEN
+				&& (skb = skb_dequeue(&pch->file.rq)) != 0)
+				kfree_skb(skb);
+			wake_up_interruptible(&pch->file.rwait);
 		}
 	}
 	read_unlock_bh(&pch->upl);
 }
 
 /*
  * We come in here to process a received frame.
  * The receive side of the ppp unit is locked.
  */
 static void
 ppp_receive_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
 {
 	if (skb->len >= 2) {
 #ifdef CONFIG_PPP_MULTILINK
 		/* XXX do channel-level decompression here */
#1 lore raw
Quoted 2 lines · Matthew N. Dodd

Has anyone else noticed that drivers/net/ppp_generic.c:ppp_input_error() is effectively a NOP? pppd/main.c:get_input() treats a zero length

No it isn't a NOP, ppp_receive_frame calls ppp_receive_error when it gets the 0-length skb, which resets the VJ decompression code (which is what really needs to know about receive errors).

Quoted 9 lines

packet as a hangup indication but if you trace out the call to ppp_do_recv() in ppp_input_error() the zero length frame is never sent to the file descriptor. Further, calling an input function for the PPP device isn't useful as the intent is to deliver the error to a specific PPP channel.

I'm using the attached patch.

Comments?

You really want your link to terminate every time you get an FCS error on a received packet?

Paul.