diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-08-13 13:16:40 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-08-13 13:16:40 +0400 |
commit | e278acfec8bf86ce442acf7d753dd3992e6d87a8 (patch) | |
tree | be5d3f58cd8f883b573ec1e586b3afe0fbdc089c /drivers | |
parent | 1dee68d4f684d7bf155ad9271ab154f4b7418702 (diff) | |
parent | 761bd9abb9c738f0396c7441551189d11f336591 (diff) | |
download | accel-ppp-e278acfec8bf86ce442acf7d753dd3992e6d87a8.tar.gz accel-ppp-e278acfec8bf86ce442acf7d753dd3992e6d87a8.zip |
Merge branch 'master' of ssh://accel-ppp.git.sourceforge.net/gitroot/accel-ppp/accel-ppp
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ipoe/ipoe.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/ipoe/ipoe.c b/drivers/ipoe/ipoe.c index 97a37b21..54cb2176 100644 --- a/drivers/ipoe/ipoe.c +++ b/drivers/ipoe/ipoe.c @@ -345,6 +345,7 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) unsigned char *arp_ptr; __be32 tip;*/ int noff; + unsigned char *cb_ptr; if (!ses->peer_addr) goto drop; @@ -402,6 +403,14 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) pskb_pull(skb, ETH_HLEN); skb_reset_network_header(skb); + cb_ptr = skb->cb + sizeof(skb->cb) - 2; + *(__u16 *)cb_ptr = IPOE_MAGIC; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) + skb->skb_iif = dev->ifindex; +#else + skb->iif = dev->ifindex; +#endif + ip_local_out(skb); return NETDEV_TX_OK; @@ -435,8 +444,14 @@ static netdev_tx_t ipoe_xmit(struct sk_buff *skb, struct net_device *dev) }*/ if (ses->link_dev) { + cb_ptr = skb->cb + sizeof(skb->cb) - 2; + *(__u16 *)cb_ptr = IPOE_MAGIC; skb->dev = ses->link_dev; - //skb->skb_iif = dev->ifindex; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) + skb->skb_iif = dev->ifindex; +#else + skb->iif = dev->ifindex; +#endif dev_queue_xmit(skb); return NETDEV_TX_OK; @@ -721,7 +736,7 @@ static unsigned int ipt_in_hook(unsigned int hook, struct sk_buff *skb, const st cb_ptr = skb1->cb + sizeof(skb1->cb) - 2; *(__u16 *)cb_ptr = IPOE_MAGIC; - skb1->tc_verd = SET_TC_NCLS(0); + //skb1->tc_verd = SET_TC_NCLS(0); netif_rx(skb1); @@ -739,7 +754,7 @@ out: static unsigned int ipt_out_hook(unsigned int hook, struct sk_buff *skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *skb)) { - int noff; + int noff, iif; struct iphdr *iph; struct ipoe_session *ses; unsigned char *cb_ptr; @@ -767,8 +782,19 @@ static unsigned int ipt_out_hook(unsigned int hook, struct sk_buff *skb, const s ses = ipoe_lookup(iph->daddr); if (!ses) return NF_ACCEPT; + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32) + iif = skb->skb_iif; +#else + iif = skb->iif; +#endif + + if (iif == ses->dev->ifindex) { + atomic_dec(&ses->refs); + return NF_ACCEPT; + } - skb->dev = ses->dev; + skb->dev = ses->dev; atomic_dec(&ses->refs); return NF_ACCEPT; |