1 diff -uBbr vpnclient.orig/interceptor.c vpnclient/interceptor.c
2 --- vpnclient.orig/interceptor.c 2009-10-07 20:22:56.000000000 +0200
3 +++ vpnclient/interceptor.c 2009-10-07 20:28:48.000000000 +0200
5 .notifier_call = handle_netdev_event,
8 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
9 +static const struct net_device_ops vpn_netdev_ops = {
10 + .ndo_start_xmit = interceptor_tx,
11 + .ndo_get_stats = interceptor_stats,
12 + .ndo_do_ioctl = interceptor_ioctl,
16 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
20 interceptor_init(struct net_device *dev)
24 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
25 + dev->netdev_ops = &vpn_netdev_ops;
27 dev->hard_start_xmit = interceptor_tx;
28 dev->get_stats = interceptor_stats;
29 dev->do_ioctl = interceptor_ioctl;
32 dev->mtu = ETH_DATA_LEN-MTU_REDUCTION;
33 kernel_memcpy(dev->dev_addr, interceptor_eth_addr,ETH_ALEN);
35 Bindings[i].original_mtu = dev->mtu;
37 /*replace the original send function with our send function */
38 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
39 + Bindings[i].InjectSend = dev->netdev_ops->ndo_start_xmit;
40 + dev->netdev_ops->ndo_start_xmit = replacement_dev_xmit;
42 Bindings[i].InjectSend = dev->hard_start_xmit;
43 dev->hard_start_xmit = replacement_dev_xmit;
46 /*copy in the ip packet handler function and packet type struct */
47 Bindings[i].InjectReceive = original_ip_handler.orig_handler_func;
52 + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
53 + dev->netdev_ops->ndo_start_xmit = b->InjectSend;
55 dev->hard_start_xmit = b->InjectSend;
57 kernel_memset(b, 0, sizeof(BINDING));