Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243559
b: refs/heads/master
c: 79b569f
h: refs/heads/master
i:
  243557: f050c90
  243555: 3a9f555
  243551: 640cefb
v: v3
  • Loading branch information
Daniel Lezcano authored and David S. Miller committed Mar 30, 2011
1 parent cb5303a commit a3452e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7a635ea989991d7f12d57a12f2ba7cb6d211e083
refs/heads/master: 79b569f0ec53a14c4d71e79d93a8676d9a0fda6d
24 changes: 22 additions & 2 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,27 @@ static inline void net_timestamp_check(struct sk_buff *skb)
__net_timestamp(skb);
}

static inline bool is_skb_forwardable(struct net_device *dev,
struct sk_buff *skb)
{
unsigned int len;

if (!(dev->flags & IFF_UP))
return false;

len = dev->mtu + dev->hard_header_len + VLAN_HLEN;
if (skb->len <= len)
return true;

/* if TSO is enabled, we don't care about the length as the packet
* could be forwarded without being segmented before
*/
if (skb_is_gso(skb))
return true;

return false;
}

/**
* dev_forward_skb - loopback an skb to another netif
*
Expand All @@ -1477,8 +1498,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
skb_orphan(skb);
nf_reset(skb);

if (unlikely(!(dev->flags & IFF_UP) ||
(skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
if (unlikely(!is_skb_forwardable(dev, skb))) {
atomic_long_inc(&dev->rx_dropped);
kfree_skb(skb);
return NET_RX_DROP;
Expand Down

0 comments on commit a3452e0

Please sign in to comment.