Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258565
b: refs/heads/master
c: 559fafb
h: refs/heads/master
i:
  258563: da1a7c3
v: v3
  • Loading branch information
xeb@mail.ru authored and David S. Miller committed Jul 24, 2011
1 parent f1fcbfe commit 0d2bdc2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 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: b0fe4a31849063fcac0bdc93716ca92615e93f57
refs/heads/master: 559fafb94ad9e4cd8774f39241917c57396f9fc5
21 changes: 6 additions & 15 deletions trunk/net/ipv4/gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/kmod.h>
#include <linux/skbuff.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <net/protocol.h>
Expand Down Expand Up @@ -96,27 +97,17 @@ static int gre_rcv(struct sk_buff *skb)
static void gre_err(struct sk_buff *skb, u32 info)
{
const struct gre_protocol *proto;
u8 ver;

if (!pskb_may_pull(skb, 12))
goto drop;
const struct iphdr *iph = (const struct iphdr *)skb->data;
u8 ver = skb->data[(iph->ihl<<2) + 1]&0x7f;

ver = skb->data[1]&0x7f;
if (ver >= GREPROTO_MAX)
goto drop;
return;

rcu_read_lock();
proto = rcu_dereference(gre_proto[ver]);
if (!proto || !proto->err_handler)
goto drop_unlock;
proto->err_handler(skb, info);
rcu_read_unlock();
return;

drop_unlock:
if (proto && proto->err_handler)
proto->err_handler(skb, info);
rcu_read_unlock();
drop:
kfree_skb(skb);
}

static const struct net_protocol net_gre_protocol = {
Expand Down

0 comments on commit 0d2bdc2

Please sign in to comment.