Page 1 of 1

wlan/eth unfreeze patch for 2.6.31 or higher

PostPosted: Sat Apr 02, 2011 9:13 pm
by arunkai
If you are seeing a crash with following messages printed to /var/log/messages:

Code: Select all
BUG: unable to handle kernel paging request at ffffffffa0015270
...
Pid: 12206, comm: cvpnd Tainted: P           O 2.6.38-2-amd64 #1 Dell Inc. Latitude E6410/0667CC
RIP: 0010:[<ffffffffa043c8ed>]  [<ffffffffa043c8ed>] add_netdev+0x7e/0xcc [cisco_ipsec]
......
Call Trace:
[<ffffffffa043cc44>] ? interceptor_ioctl+0x189/0x28c [cisco_ipsec]
[<ffffffff81273753>] ? dev_ifsioc+0x11/0x292
[<ffffffff81274ddc>] ? dev_ioctl+0x59c/0x63a
[<ffffffff810dcf0c>] ? ptep_clear_flush+0x29/0x35
[<ffffffff810d8789>] ? page_add_new_anon_rmap+0x6d/0x8e
[<ffffffff810d175d>] ? do_wp_page+0x671/0x689
[<ffffffff812609c1>] ? __sock_recvmsg_nosec+0x29/0x69
[<ffffffff81263e97>] ? compat_sock_ioctl+0xa3d/0xb66
[<ffffffff8112efd3>] ? compat_sys_ioctl+0x1bb/0xfb0
[<ffffffff8126260f>] ? sock_alloc_file+0xae/0x10c
[<ffffffff810f60a7>] ? fd_install+0x27/0x4e
[<ffffffff81262691>] ? sock_map_fd+0x24/0x2d
[<ffffffff810321b0>] ? sysenter_dispatch+0x7/0x2e


then one could try following patch :

Code: Select all
--- vpnclient.org/linuxcniapi.h 2008-06-23 22:29:12.000000000 +0530
+++ vpnclient/linuxcniapi.h     2011-04-02 14:32:38.343532108 +0530
@@ -38,6 +38,10 @@

     inject_status send_stat;
     inject_status recv_stat;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+    struct net_device_ops const *netdev_opsp;
+    struct net_device_ops netdev_ops;
+#endif
} BINDING, *PBINDING;

/********************************************************************************/
--- vpnclient.org/interceptor.c 2011-04-02 14:39:10.095483881 +0530
+++ vpnclient/interceptor.c     2011-04-02 14:43:41.239483769 +0530
@@ -121,7 +121,7 @@
};

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
-static const struct net_device_ops vpn_netdev_ops = {
+static struct net_device_ops vpn_netdev_ops = {
  .ndo_start_xmit = interceptor_tx,
  .ndo_get_stats = interceptor_stats,
  .ndo_do_ioctl = interceptor_ioctl,
@@ -280,8 +280,12 @@

     /*replace the original send function with our send function */
     #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+
     Bindings[i].InjectSend = dev->netdev_ops->ndo_start_xmit;
-    dev->netdev_ops->ndo_start_xmit = replacement_dev_xmit;
+    Bindings[i].netdev_opsp = dev->netdev_ops;
+    Bindings[i].netdev_ops  = *dev->netdev_ops;
+    Bindings[i].netdev_ops.ndo_start_xmit = replacement_dev_xmit;
+    dev->netdev_ops = &Bindings[i].netdev_ops;
     #else
     Bindings[i].InjectSend = dev->hard_start_xmit;
     dev->hard_start_xmit = replacement_dev_xmit;
@@ -308,7 +312,7 @@
     {
         rc = 0;
         #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
-        dev->netdev_ops->ndo_start_xmit = b->InjectSend;
+       dev->netdev_ops = b->netdev_opsp;
         #else
         dev->hard_start_xmit = b->InjectSend;
         #endif



This patch needs to be applied after the patches mentioned in http://www.lamnk.com/blog/vpn/how-to-in ... la-64-bit/ is applied. i.e. after you have got the cisco vpn source to compilable on your system.

I have tested this only on 2.6.38 on amd64

Re: wlan/eth unfreeze patch for 2.6.31 or higher

PostPosted: Sun Apr 17, 2011 11:30 pm
by eph
Hi,

I'm having the same problem as you however I can't apply the patch, looks like you are using different code to patch. I'm using vpnclient-linux-x86_64-4.8.02.0030-k9.tar.gz with fixes.patch applied (from L.A.M.N.K page).

When I try to patch I got:
Code: Select all
patching file linuxcniapi.h
patch: **** malformed patch at line 11: } BINDING, *PBINDING;


After looking at the patch it seems that you have different source than me. Which source did you use?

Cheers,
Tom

Re: wlan/eth unfreeze patch for 2.6.31 or higher

PostPosted: Mon Apr 18, 2011 11:26 pm
by eph
Hi all,

With help from arunkai here is the working patch for 2.6.38. Just get vpnclient-linux-x86_64-4.8.02.0030-k9.tar.gz, then patch with fixes.patch (from LAMNK page) and then patch with following patch:

Code: Select all
--- interceptor.c       2011-04-19 08:43:48.457508642 +1200
+++ interceptor.c-2.6.38        2011-04-19 08:48:52.180456816 +1200
@@ -257,10 +257,6 @@
     int rc = -1;
     int i = 0;

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
-    struct net_device_ops * tmp_ops;
-#endif
-
     if (!supported_device(dev))
     {
         goto exit_gracefully;
@@ -288,8 +284,10 @@
     /*replace the original send function with our send function */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
     Bindings[i].InjectSend = dev->netdev_ops->ndo_start_xmit;
-    tmp_ops = (struct net_device_ops *) dev->netdev_ops;
-    tmp_ops->ndo_start_xmit = replacement_dev_xmit;
+    Bindings[i].netdev_opsp = dev->netdev_ops;
+    Bindings[i].netdev_ops  = *dev->netdev_ops;
+    Bindings[i].netdev_ops.ndo_start_xmit = replacement_dev_xmit;
+    dev->netdev_ops = &Bindings[i].netdev_ops;
#else
     Bindings[i].InjectSend = dev->hard_start_xmit;
     dev->hard_start_xmit = replacement_dev_xmit;
@@ -309,18 +307,13 @@
     int rc = -1;
     BINDING *b;

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
-    struct net_device_ops * tmp_ops;
-#endif
-
     b = getbindingbydev(dev);

     if (b)
     {
         rc = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
-        tmp_ops = (struct net_device_ops *) dev->netdev_ops;
-        tmp_ops->ndo_start_xmit = b->InjectSend;
+        dev->netdev_ops = b->netdev_opsp;
#else
         dev->hard_start_xmit = b->InjectSend;
#endif
--- linuxcniapi.h       2008-06-24 04:59:12.000000000 +1200
+++ linuxcniapi.h-2.6.38        2011-04-19 08:47:57.059993669 +1200
@@ -38,6 +38,10 @@

     inject_status send_stat;
     inject_status recv_stat;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+    struct net_device_ops const *netdev_opsp;
+    struct net_device_ops netdev_ops;
+#endif
} BINDING, *PBINDING;

/********************************************************************************/


Tested on 2.6.38-2-amd64

Hope it helps and thanks a lot arunkai!!

Re: wlan/eth unfreeze patch for 2.6.31 or higher

PostPosted: Thu Apr 28, 2011 1:03 am
by milkywayfarer
Guys, GREAT thanks! This helped me.

I had issue with client on Ubuntu 10.10 x64 (with 2.6.35-28-generic).

However, I spent a lot of time to apply second patch in this thread. I received error message: "malformed patch at line nnn". The reason of problem with patch was pretty simple: I used "SELECT ALL" option to copy patch and then paste it in the .patch file. This was wrong action, because it seems, that javascript which helps to do it -- trimmers each line, and this is critical change from .patch file syntax point of view.

I've attached correct version of patch file to my post. Hope this would be useful for someone else.

UPD: I've forgotten to note, that it is required to apply my patch with option "--ignore-whitespace" (because some white-spaces are still on wrong places):
Code: Select all
patch < ../onemore.patch --ignore-whitespace

Re: wlan/eth unfreeze patch for 2.6.31 or higher

PostPosted: Sat May 07, 2011 4:29 pm
by luanloa
Hi:

I've tried the previus patches but still got system hanged.

I found an unique patch that works fine for me with kernel 2.6.38-8-generic-pae (Ubuntu distro) here:
http://fseitz.de/blog/index.php?/catego ... VPN-Client

the patch is at: http://fseitz.de/download/vpnclient.patch-2.6.38, I've attached to this post.

Hope this help someone.

Regards
Luis.

Re: wlan/eth unfreeze patch for 2.6.31 or higher

PostPosted: Sun May 08, 2011 4:47 pm
by gmlopez
Great post! Thank you very much luanloa! Even I haven't tried the patch mentioned previously in this thread the patch referred by lunloa worked perfectly for me and incredibly almost at the same time I was looking for a solution :-).

Some things worth to mention:

I applied it (patch referred by lunloa) on Kubuntu 11.04 with kernel version 2.6.38 and a clean Cisco vpnclient-linux-x86_64-4.8.02.0030 without any other and previous patch.

Thank you all! Even vpnc works as an alternative, it still has some problems and disconnects frequently within an aleatory time related to an old and kind of unresolved problem "connection terminated by dead peer detection".

I hope this to help lot of people too!