]> git.pld-linux.org Git - packages/cisco-vpnclient.git/blob - cisco-vpnclient-interceptor.patch
- export KBUILD_NOPEDANTIC=1 for x86_64
[packages/cisco-vpnclient.git] / cisco-vpnclient-interceptor.patch
1 http://ilapstech.blogspot.com/2009/09/cisco-vpn-client-on-karmic-koala.html
2
3   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c: In function ‘interceptor_init’:
4   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c:132: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
5   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c:133: error: ‘struct net_device’ has no member named ‘get_stats’
6   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c:134: error: ‘struct net_device’ has no member named ‘do_ioctl’
7   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c: In function ‘add_netdev’:
8   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c:271: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
9   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c:272: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
10   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c: In function ‘remove_netdev’:
11   /opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.c:294: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
12   make[2]: *** [/opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori/interceptor.o] Error 1
13   make[1]: *** [_module_/opt/Devel/CiscoVPNClient/4.8.02/vpnclient.ori] Error 2
14   make[1]: Leaving directory `/usr/src/linux-headers-2.6.31-9-generic'
15   make: *** [default] Error 2
16   Failed to make module "cisco_ipsec.ko".
17   
18   Oooops, so it's failed. I tried to find any solution on the Net but I
19   couldn't get any.  I looked at the source code and seemed that the Linux
20   kernel 2.6.31 replaced the old net_device structure with a new one and is
21   using that new structure for the net_device operations. This structure
22   called net_device_ops (const struct net_device_ops *netdev_ops).
23   
24   I think this new netdevice feature is available from the 2.6.29 kernel and
25   it was coexisted with the old method too.  I got some info about this on the
26   following link: http://cateee.net/lkddb/web-lkddb/COMPAT_NET_DEV_OPS.html
27   
28   Unfortunately, this option is disappeared from the 2.6.31 so there was no
29   option anymore to get the vpnclient to work with a COMPAT_NET_DEV_OPS=y
30   built 2.6.31 kernel.
31
32 --- vpnclient.ori/interceptor.c 2009-05-21 01:16:34.000000000 +1200
33 +++ vpnclient/interceptor.c     2009-09-06 22:02:39.000000000 +1200
34 @@ -116,6 +116,14 @@
35  };
36  #endif
37  
38 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
39 +static struct net_device_ops interceptor_netdev_ops = {
40 +    .ndo_start_xmit = interceptor_tx,
41 +    .ndo_do_ioctl   = interceptor_ioctl,
42 +    .ndo_get_stats  = interceptor_stats,
43 +};
44 +#endif
45 +
46  static struct notifier_block interceptor_notifier = {
47      .notifier_call = handle_netdev_event,
48  };
49 @@ -129,9 +137,13 @@
50  {
51      ether_setup(dev);
52  
53 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
54 +    dev->netdev_ops = &interceptor_netdev_ops;
55 +#else
56      dev->hard_start_xmit = interceptor_tx;
57      dev->get_stats = interceptor_stats;
58      dev->do_ioctl = interceptor_ioctl;
59 +#endif
60  
61      dev->mtu = ETH_DATA_LEN-MTU_REDUCTION;
62      kernel_memcpy(dev->dev_addr, interceptor_eth_addr,ETH_ALEN);
63 @@ -242,6 +254,9 @@
64  {
65      int rc = -1;
66      int i = 0;
67 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
68 +    struct net_device_ops * tmp_ops;
69 +#endif
70  
71      if (!supported_device(dev))
72      {
73 @@ -268,8 +283,14 @@
74      Bindings[i].original_mtu = dev->mtu;
75  
76      /*replace the original send function with our send function */
77 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
78 +    Bindings[i].InjectSend = dev->netdev_ops->ndo_start_xmit;
79 +    tmp_ops = (struct net_device_ops *) dev->netdev_ops;
80 +    tmp_ops->ndo_start_xmit = replacement_dev_xmit;
81 +#else
82      Bindings[i].InjectSend = dev->hard_start_xmit;
83      dev->hard_start_xmit = replacement_dev_xmit;
84 +#endif
85  
86      /*copy in the ip packet handler function and packet type struct */
87      Bindings[i].InjectReceive = original_ip_handler.orig_handler_func;
88 @@ -285,13 +306,21 @@
89  {
90      int rc = -1;
91      BINDING *b;
92 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
93 +    struct net_device_ops * tmp_ops;
94 +#endif
95  
96      b = getbindingbydev(dev);
97  
98      if (b)
99      {   
100          rc = 0;
101 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
102 +        tmp_ops = (struct net_device_ops *) dev->netdev_ops;
103 +        tmp_ops->ndo_start_xmit = b->InjectSend;
104 +#else
105          dev->hard_start_xmit = b->InjectSend;
106 +#endif
107          kernel_memset(b, 0, sizeof(BINDING));
108      }
109      else
This page took 0.059273 seconds and 3 git commands to generate.