Добрый день.
Имею железяку huawei 4G роутер (портативный) и желание поднять OPENVPN на ней.
Сам OPENVPN скомпилирован и работает - проблем нет.
С Tun.ko возникли проблемы. В ядре его (как обычно) нет. Пришлось компилировать.
Железяка
-------------------------
/system/bin/busybox uname -a
Linux localhost 3.4.5 armv7l #1 PREEMPT Tue Apr 10 14:53:30 CST 2018 armv7l GNU/Linux
echo `uname -m` `cat /proc/version`
Linux version 3.4.5 (wangxu@SIA1000027021) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #1 PREEMPT Tue Jun 21 18:53:30 CST 2016
-------------------------
Исходников ядра конечно же нет.
Были взяты Kernel linux-3.4.5 и 4.6.x-google_prerelease_toolchain (arm-linux-androideabi-4.6)
-------------------------
Компилировал ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- O=build KERNELRELEASE=3.4.5
На выходе получил Tun.ko, залил на железо.
-------------------------
#insmod /online/tun.ko
#lsmod | grep tun
tun 13831 0 - Live 0xbf044000
#dmesg
....
<6>[000447604ms] tun: Universal TUN/TAP device driver, 1.6
<6>[000447604ms] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
Вроде как все хорошо.
-------------------------
Добавил
#mkdir -p /dev/net
#/system/bin/busybox mknod /dev/net/tun c 10 200
#chmod 600 /dev/net/tunИтог
#ls /dev | grep tun
tun
#ls /dev/net | grep tun
tun
Далее начинаются непонятки. При любом чихе в сторону TUN
#openvpn --mktun --dev tap0
#cat /dev/net/tun
#openvpn --verb 8 --config /online/vps_client.ovpn
... без разницы, железка уходит в ребут.
Из очевидных логов только:
-----------------------------------
<6>[000447604ms] tun: Universal TUN/TAP device driver, 1.6
<6>[000447604ms] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
----Тут любое касание tun----
<1>[000450546ms] Unable to handle kernel NULL pointer dereference at virtual address 00000010
<1>[000450554ms] pgd = c127c000
<1>[000450558ms] [00000010] *pgd=00000000
<0>[000450561ms] Internal error: Oops: 805 [#1] PREEMPT ARM
<4>[000450566ms] Modules linked in: tun dhd(O) ctf(PO)
<4>[000450570ms] CPU: 0 Tainted: P O (3.4.5 #1)
<4>[000450576ms] PC is at tun_chr_open+0x34/0x88 [tun]
<4>[000450580ms] LR is at misc_open+0xac/0x1b0
<4>[000450584ms] pc : [<bf044564>] lr : [<c01cc0cc>] psr: 60000013
<4>[000450584ms] sp : c103be08 ip : 00000000 fp : b6f4dded
<4>[000450595ms] r10: 00000000 r9 : 00000000 r8 : bf046b08
<4>[000450601ms] r7 : c07f0ce0 r6 : c218aae0 r5 : c185c900 r4 : c185c900
<4>[000450607ms] r3 : 00000010 r2 : c103a008 r1 : c103be08 r0 : 00000000
<4>[000450613ms] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
<4>[000450620ms] Control: 18c53c7d Table: 55d7c059 DAC: 00000015
<4>[000450626ms]
<4>[000450626ms] LR: 0xc01cc04c:
<4>[000450630ms] c04c e1530007 e243800c 1a000004 ea000034 e598300c e1530007 e243800c 0a000030
<4>[000450638ms] c06c e513300c e1530004 1afffff8 e5983008 e3530000 0a00002a e5930000 ebfa4d01
<4>[000450646ms] c08c e3500000 0a000026 e5983008 e3530000 0a000023 e5954010 e5853010 e593202c
<4>[000450654ms] c0ac e3520000 01a06002 0a000014 e5858068 e1a00006 e593302c e1a01005 e12fff33
<4>[000450662ms] c0cc e2506000 0a00000d e5953010 e3530000 0a000001 e5930000 ebfa4d1c e3540000
<4>[000450670ms] c0ec 01a00004 0a000004 e5940000 ebfa4ce5 e3500000 11a00004 03a00000 e5850010
<4>[000450678ms] c10c e3540000 0a000001 e5940000 ebfa4d0f e59f00a0 e08f0000 eb0ed058 e1a00006
<4>[000450687ms] c12c e8bd81f0 e59f7090 e08f7007 e1a00007 eb0ed052 e59f1084 e1a03004 e3a0200a
<4>[000450695ms]
<4>[000450695ms] SP: 0xc103bd88:
<4>[000450699ms] bd88 c1891000 c1891028 c180bf00 c1b974a0 c103bdfc c180bf00 00000029 c01b485c
<4>[000450707ms] bda8 c3028000 bf044564 60000013 ffffffff c103bdf4 c0010c58 00000000 c103be08
<4>[000450715ms] bdc8 c103a008 00000010 c185c900 c185c900 c218aae0 c07f0ce0 bf046b08 00000000
<4>[000450723ms] bde8 00000000 b6f4dded 00000000 c103be08 c01cc0cc bf044564 60000013 ffffffff
<4>[000450731ms] be08 c08282c4 c01cc0cc c103a000 c218aae0 c185c900 c2d9e200 00000000 c00b9708
<4>[000450739ms] be28 c28c7850 c1d79e00 b6f4dded c185c900 c15e5600 c28c7850 c218aae0 c00b9650
<4>[000450747ms] be48 00000000 c00b3f84 c103bef8 00020000 c218aae0 00000024 00000000 00000000
<4>[000450755ms] be68 00000000 c00c2f8c 0000081f 00299a26 00000003 c18e9009 c085ea00 c218aae0
<4>[000450763ms]
<4>[000450763ms] R1: 0xc103bd88:
<4>[000450767ms] bd88 c1891000 c1891028 c180bf00 c1b974a0 c103bdfc c180bf00 00000029 c01b485c
<4>[000450775ms] bda8 c3028000 bf044564 60000013 ffffffff c103bdf4 c0010c58 00000000 c103be08
<4>[000450783ms] bdc8 c103a008 00000010 c185c900 c185c900 c218aae0 c07f0ce0 bf046b08 00000000
<4>[000450791ms] bde8 00000000 b6f4dded 00000000 c103be08 c01cc0cc bf044564 60000013 ffffffff
<4>[000450799ms] be08 c08282c4 c01cc0cc c103a000 c218aae0 c185c900 c2d9e200 00000000 c00b9708
<4>[000450808ms] be28 c28c7850 c1d79e00 b6f4dded c185c900 c15e5600 c28c7850 c218aae0 c00b9650
<4>[000450816ms] be48 00000000 c00b3f84 c103bef8 00020000 c218aae0 00000024 00000000 00000000
<4>[000450824ms] be68 00000000 c00c2f8c 0000081f 00299a26 00000003 c18e9009 c085ea00 c218aae0
<4>[000450832ms]
<4>[000450832ms] R2: 0xc1039f88:
<4>[000450836ms] 9f88 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000450844ms] 9fa8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000450852ms] 9fc8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000450860ms] 9fe8 00000000 00000000 00000000 00000000 00004510 00000001 00000000 00000002
<4>[000450868ms] a008 00000000 c1816000 c07eb880 00000000 00000015 c1816000 c103a000 c2fcd880
<4>[000450876ms] a028 c07b30a8 c000a5dc c084f27c c084f278 c103bb6c c103bae0 c0580cb8 00000000
<4>[000450884ms] a048 00000000 00000000 00000000 00000000 01000000 00000000 b6f2aef4 60847651
<4>[000450892ms] a068 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000450900ms]
<4>[000450900ms] R4: 0xc185c880:
<4>[000450904ms] c880 00000002 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000450912ms] c8a0 00000000 00000000 00000000 00000000 ffffffff ffffffff ffffffff ffffffff
<4>[000450920ms] c8c0 ffffffff ffffffff 00000000 00000000 00000000 c2224d00 c07ff2e0 c07ff31c
<4>[000450928ms] c8e0 c07b2f98 00000000 00000000 c185c8ec c185c8ec c185c8f4 c185c8f4 c1c13a80
<4>[000450937ms] c900 c1b97500 c28cdc70 c28c7850 c15e5600 bf0465d0 00000001 00020000 0000001d
<4>[000450945ms] c920 00000000 00000000 00000000 00000000 00000000 00000000 00000000 c1b97b00
<4>[000450953ms] c940 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000450961ms] c960 00000000 00000000 bf046b08 c185c96c c185c96c c185c974 c185c974 c218aba0
<4>[000450969ms]
<4>[000450969ms] R5: 0xc185c880:
<4>[000450973ms] c880 00000002 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000450981ms] c8a0 00000000 00000000 00000000 00000000 ffffffff ffffffff ffffffff ffffffff
<4>[000450989ms] c8c0 ffffffff ffffffff 00000000 00000000 00000000 c2224d00 c07ff2e0 c07ff31c
<4>[000450997ms] c8e0 c07b2f98 00000000 00000000 c185c8ec c185c8ec c185c8f4 c185c8f4 c1c13a80
<4>[000451005ms] c900 c1b97500 c28cdc70 c28c7850 c15e5600 bf0465d0 00000001 00020000 0000001d
<4>[000451013ms] c920 00000000 00000000 00000000 00000000 00000000 00000000 00000000 c1b97b00
<4>[000451021ms] c940 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000451029ms] c960 00000000 00000000 bf046b08 c185c96c c185c96c c185c974 c185c974 c218aba0
<4>[000451037ms]
<4>[000451037ms] R6: 0xc218aa60:
<4>[000451041ms] aa60 00010001 c218aa64 c218aa64 00000001 c218aa70 c218aa70 00000000 00000000
<4>[000451049ms] aa80 c0587d90 000200da c07aaef0 c218aa8c c218aa8c 00000000 c218aa98 c218aa98
<4>[000451058ms] aaa0 00000000 5bfcef58 00000000 00000000 00000000 00000000 c218aac0 aeaaabab
<4>[000451066ms] aac0 00200000 00000000 00000000 c218aacc c218aacc c218aad4 c218aad4 00000000
<4>[000451074ms] aae0 000521ff 00000000 00000000 00000000 00000000 00000000 c0587b40 c28cdc00
<4>[000451082ms] ab00 c218aba0 00000f14 00000001 00a000c8 5bfcefc2 07270657 5bfcefc2 07270657
<4>[000451090ms] ab20 5bfcf002 1c9c2ed1 00000000 00000000 00000000 00000000 00000000 00000000
<4>[000451098ms] ab40 00000007 00000001 c218ab48 c218ab48 00000000 00000000 00000000 c218ab5c
<4>[000451106ms]
<4>[000451106ms] R7: 0xc07f0c60:
<4>[000451110ms] 0c60 00000001 00000072 00000000 00000af7 00000000 00000000 00000000 c07b6758
<4>[000451118ms] 0c80 c0862294 c068aed8 c07f0c50 00000001 00000012 00000000 00000deb 00000000
<4>[000451126ms] 0ca0 00000000 00000000 c07b6758 c0862214 c068aecc c07f0c50 00000000 00000002
<4>[000451134ms] 0cc0 00000000 00031cb0 00000000 00000000 00000000 00000000 c07f0cd8 c07f0cd8
<4>[000451142ms] 0ce0 bf046b14 c08060ac 00000001 c07f0cec c07f0cec c07f0cf4 c07f0cf4 000000b7
<4>[000451150ms] 0d00 c068afb4 c082832c 00000000 00000000 00000000 00000000 c068afc0 00000000
<4>[000451158ms] 0d20 c068afd4 00000124 c01cca18 00000000 c068afc8 000001a4 c01cc994 c01cc884
<4>[000451166ms] 0d40 c068bbc8 00000001 c07f1068 c2d9c600 c2d9e2c0 c07f3c8c c2d9ac4c c07f1070
<0>[000451174ms] Process sh (pid: 804, stack limit = 0xc103a2e8)
<0>[000451180ms] Stack: (0xc103be08 to 0xc103c000)
<0>[000451184ms] be00: c08282c4 c01cc0cc c103a000 c218aae0 c185c900 c2d9e200
<0>[000451192ms] be20: 00000000 c00b9708 c28c7850 c1d79e00 b6f4dded c185c900 c15e5600 c28c7850
<0>[000451200ms] be40: c218aae0 c00b9650 00000000 c00b3f84 c103bef8 00020000 c218aae0 00000024
<0>[000451208ms] be60: 00000000 00000000 00000000 c00c2f8c 0000081f 00299a26 00000003 c18e9009
<0>[000451216ms] be80: c085ea00 c218aae0 c103bef8 c103bf78 00000000 c103a000 c103beb8 c103a000
<0>[000451225ms] bea0: 00000000 c00c351c c103beb4 00000002 c189136c 00000000 c28c7850 c15e5600
<0>[000451233ms] bec0: 00200200 c003e71c c1891000 00000001 c103bf78 c18e9000 ffffff9c ffffff9c
<0>[000451241ms] bee0: c103a000 00000000 b6f4dded c00c38e0 00000041 b6f629b4 c28c7850 c15e5600
<0>[000451249ms] bf00: 00299a26 00000003 c18e9009 00000000 c2901080 c218aae0 00000101 00000004
<0>[000451257ms] bf20: 00000000 00000000 c01b1e0c 00000000 00000000 00000000 c234bf00 c234bf08
<0>[000451265ms] bf40: 00000000 c103a000 00020000 00020000 00000000 00000000 00000000 c18e9000
<0>[000451273ms] bf60: 00020000 00000003 00000001 c00b4d6c 0000000a c00111e8 00020000 00000000
<0>[000451281ms] bf80: 00000024 00000100 00000000 00000000 b6f60fec 00000000 00000005 c00111e8
<0>[000451289ms] bfa0: 00000000 c0011040 00000000 b6f60fec b6f60fec 00020000 00000000 00000000
<0>[000451297ms] bfc0: 00000000 b6f60fec 00000000 00000005 b6f619b0 b6f60898 b6f57b68 b6f4dded
<0>[000451305ms] bfe0: b6f4e83d bed888c8 b6ee9121 b6edc35c 60000010 b6f60fec ffff0004 ffffffff
<4>[000451313ms] [<bf044564>] (tun_chr_open+0x34/0x88 [tun]) from [<c01cc0cc>] (misc_open+0xac/0x1b0)
<4>[000451322ms] [<c01cc0cc>] (misc_open+0xac/0x1b0) from [<c00b9708>] (chrdev_open+0xb8/0x19c)
<4>[000451330ms] [<c00b9708>] (chrdev_open+0xb8/0x19c) from [<c00b3f84>] (__dentry_open.isra.14+0x1b8/0x2a0)
<4>[000451339ms] [<c00b3f84>] (__dentry_open.isra.14+0x1b8/0x2a0) from [<c00c2f8c>] (do_last.isra.34+0x31c/0x6d0)
<4>[000451349ms] [<c00c2f8c>] (do_last.isra.34+0x31c/0x6d0) from [<c00c351c>] (path_openat+0xb8/0x390)
<4>[000451358ms] [<c00c351c>] (path_openat+0xb8/0x390) from [<c00c38e0>] (do_filp_open+0x2c/0x80)
<4>[000451366ms] [<c00c38e0>] (do_filp_open+0x2c/0x80) from [<c00b4d6c>] (do_sys_open+0xe4/0x180)
<4>[000451374ms] [<c00b4d6c>] (do_sys_open+0xe4/0x180) from [<c0011040>] (ret_fast_syscall+0x0/0x30)
<0>[000451383ms] Code: 0a000014 e1a0100d e3a00000 e3c12d7f (e5830000)
<4>[000451392ms] ---[ end trace 610457ad83bc2421 ]---
<4>[000451397ms] [dump]: <system_error> [0xe1b2d3]
--------------------------------
Буду признателен за любой пинок (кроме мата и оскорблений) в сторону места, где зарыта собака.
PS С линкусом работал крайне мало, с компиляцией ядра практически не работал. Так что прошу сильно не бить ногами по почкам, печени и другим жизненно важным внутренним органам.
Спасибо.