bridge: add ETH_HLEN to packet_length
Subsystems (3)
PATCH 1/1 bridge: add ETH_HLEN to packet_length
In br_dev_queue_push_xmit, why is the check to drop mtu oversized packets not checking for enough room for the impending ETH_HLEN size skb_push? In some code currently under development, we are seeing skb_under_panic being called from the "skb_push(skb, ETH_HLEN)" in that code. It seems to me it would be better to drop those skbs than panic. Attached is a patch to do this.
Thanks,
Jon
net/bridge/br_forward.c +2 -1
@@ -29,7 +29,8 @@ static inline int should_deliver(const sstatic inline unsigned packet_length (const struct sk_buff *skb) { -return skb->len - (skb->protocol ==htons (ETH_P_8021Q ) ?VLAN_HLEN :0 ); +return skb->len -ETH_HLEN - + (skb->protocol ==htons (ETH_P_8021Q ) ?VLAN_HLEN :0 ); }int br_dev_queue_push_xmit (struct sk_buff *skb)
Quoted 16 lines · Jon Mason
In
br_dev_queue_push_xmit, why is the check to drop mtu oversized packets not checking for enough room for the impendingETH_HLENsizeskb_push? In some code currently under development, we are seeingskb_under_panicbeing called from the "skb_push(skb, ETH_HLEN)" in that code. It seems to me it would be better to drop those skbs than panic. Attached is a patch to do this.Thanks,
JonSigned-off-by Jon Mason <[email protected]>diff -r
b1d36669f98dnet/bridge/br_forward.c
net/bridge/br_forward.c static inline int should_deliver(const s · line 36
Quoted 9 lines
net/bridge/br_forward.c +2
-1@@ -29,7 +29,8 @@ static inline int should_deliver(const sstatic inline unsigned packet_length (const struct sk_buff *skb) { -return skb->len - (skb->protocol ==htons (ETH_P_8021Q ) ?VLAN_HLEN :0 ); +return skb->len -ETH_HLEN - + (skb->protocol ==htons (ETH_P_8021Q ) ?VLAN_HLEN :0 ); }
packet_length() is a wrong place to do that, mtu has nothing to do with skb headroom.
--Mika
Quoted 18 lines · Mika Penttil?
Quoted 17 lines · Jon Mason
In
br_dev_queue_push_xmit, why is the check to drop mtu oversized packets not checking for enough room for the impendingETH_HLENsizeskb_push? In some code currently under development, we are seeingskb_under_panicbeing called from the "skb_push(skb, ETH_HLEN)" in that code. It seems to me it would be better to drop those skbs than panic. Attached is a patch to do this.Thanks,
JonSigned-off-by Jon Mason <[email protected]>diff -r
b1d36669f98dnet/bridge/br_forward.cnet/bridge/br_forward.c +0
-0@@ -29,7 +29,8 @@ static inline int should_deliver(const s
Quoted 11 lines
net/bridge/br_forward.c static inline int should_deliver(const s · line 35
Quoted 9 lines
net/bridge/br_forward.c +2
-1static inline unsigned packet_length (const struct sk_buff *skb) { -return skb->len - (skb->protocol ==htons (ETH_P_8021Q ) ?VLAN_HLEN : 0); +return skb->len -ETH_HLEN - + (skb->protocol ==htons (ETH_P_8021Q ) ?VLAN_HLEN :0 ); }
packet_length()is a wrong place to do that, mtu has nothing to do with skb headroom.
Oops, you are 100% correct. So what would be the best way to handle this, as a panic is pretty nasty? Wouldn't it be better to check the packet to see if there is sufficient headroom, BUG, and then drop it (or allocate a new packet with sufficient headroom and proceed with the skb_push)?
Thanks,
Jon
Quoted 4 lines
--Mika
Quoted 9 lines · On Thu, 14 Sep 2006 13:27:54 -0500 Jon Mason <[email protected]> wrote:
In
br_dev_queue_push_xmit, why is the check to drop mtu oversized packets not checking for enough room for the impendingETH_HLENsizeskb_push? In some code currently under development, we are seeingskb_under_panicbeing called from the "skb_push(skb, ETH_HLEN)" in that code. It seems to me it would be better to drop those skbs than panic. Attached is a patch to do this.Thanks,
Jon
This is bridge code, it assumes that any device that claims to be a ethernet device has done the proper reservation. What device are you using?