Explictly pass SheepVars by af_packet_priv.

This commit is contained in:
Ricky Zhang 2016-08-13 07:33:35 -04:00
parent 212b8237b6
commit 27cb1ef84a
No known key found for this signature in database
GPG Key ID: 681AFAEF6CDEDB4C

View File

@ -610,6 +610,9 @@ static int sheep_net_ioctl(struct inode *inode, struct file *f, unsigned int cod
v->pt.type = htons(ETH_P_ALL); v->pt.type = htons(ETH_P_ALL);
v->pt.dev = v->ether; v->pt.dev = v->ether;
v->pt.func = sheep_net_receiver; v->pt.func = sheep_net_receiver;
#ifdef LINUX_26
v->pt.af_packet_priv = v;
#endif
dev_add_pack(&v->pt); dev_add_pack(&v->pt);
#ifndef LINUX_24 #ifndef LINUX_24
dev_unlock_list(); dev_unlock_list();
@ -715,7 +718,11 @@ static int sheep_net_receiver(struct sk_buff *skb, struct net_device *dev, struc
static int sheep_net_receiver(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) static int sheep_net_receiver(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
#endif #endif
{ {
#ifdef LINUX_26
struct SheepVars *v = (struct SheepVars *)pt->af_packet_priv;
#else
struct SheepVars *v = (struct SheepVars *)pt; struct SheepVars *v = (struct SheepVars *)pt;
#endif
struct sk_buff *skb2; struct sk_buff *skb2;
int fake; int fake;
int multicast; int multicast;