bugfix for ISDN code

Kai Germaschewski (kai@thphy.uni-duesseldorf.de)
Tue, 24 Aug 1999 10:53:39 +0200 (CEST)


Hi!

The following patch fixes 2 small bugs in the ISDN syncppp code:

--- isdn_ppp.c.orig Mon Aug 9 21:04:39 1999
+++ isdn_ppp.c Tue Aug 24 10:52:27 1999
@@ -1352,7 +1352,7 @@
{
struct sk_buff *skb_old = skb;
int pkt_len;
- skb = dev_alloc_skb(skb_old->len + 40);
+ skb = dev_alloc_skb(skb_old->len + 128);

if (!skb) {
printk(KERN_WARNING "%s: Memory squeeze, dropping packet.\n", dev->name);
@@ -1361,7 +1361,7 @@
return;
}
skb->dev = dev;
- skb_put(skb, skb_old->len + 40);
+ skb_put(skb, skb_old->len + 128);
memcpy(skb->data, skb_old->data, skb_old->len);
skb->mac.raw = skb->data;
pkt_len = slhc_uncompress(ippp_table[net_dev->local->ppp_slot]->slcomp,
@@ -1413,16 +1413,22 @@
static unsigned char *isdn_ppp_skb_push(struct sk_buff **skb_p,int len)
{
struct sk_buff *skb = *skb_p;
-
+
if(skb_headroom(skb) < len) {
- printk(KERN_ERR "isdn_ppp_skb_push:under %d %d\n",skb_headroom(skb),len);
+ struct sk_buff *nskb = skb_realloc_headroom(skb, len);
+
+ if (!nskb) {
+ printk(KERN_INFO "isdn_ppp_skb_push: can't realloc headroom!\n");
+ dev_kfree_skb(skb);
+ return NULL;
+ }
dev_kfree_skb(skb);
- return NULL;
+ *skb_p = nskb;
+ return skb_push(nskb, len);
}
return skb_push(skb,len);
}
-
-
+
/*
* send ppp frame .. we expect a PIDCOMPressable proto --
* (here: currently always PPP_IP,PPP_VJC_COMP,PPP_VJC_UNCOMP)

Description:

For VJ header compression, sometimes more than 40 bytes is needed. 128
bytes is what is used in drivers/net/ppp.c as well.

The isdn_ppp_skb_push function discarded packets without sufficient
headroom, no it reallocs headroom instead, which makes more sense.

So the "isdn_ppp_skb_push: under %d %d" bug, which some people saw when
using MPPP, is fixed.

There remains one question: What has changed lately, which might cause
packets without sufficient headroom being delivered from the network-layer
to the device driver? This could affect performance on e.g. ethernet cards
as well, I suppose.

The patch is against 2.2.11 but should apply to recent 2.3.x as well.

cu,
Kai

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/