当前位置: 技术问答>linux和unix
【在线急等】Linux网络内核相关的问题?
来源: 互联网 发布时间:2017-01-22
本文导语: 我一直在做Android L2TP/IPsec 这块的代码,之前跟综上层没发现啥问题,后来我跟了下内核部分, 内核是:Linux2.6.35.3 的。 每次都是到L2TP发送SCCRQ的部分就发不出去,然后我就跟内核,总是在查找安全路由的时候...
我一直在做Android L2TP/IPsec 这块的代码,之前跟综上层没发现啥问题,后来我跟了下内核部分,
内核是:Linux2.6.35.3 的。
每次都是到L2TP发送SCCRQ的部分就发不出去,然后我就跟内核,总是在查找安全路由的时候被分到一个黑洞路由,然后我就看了看代码,代码大概是下面这个样子的,每次net->xfrm.sysctl_larval_drop总是通过,然后就制做了一个黑洞路由。
if (route == NULL && num_xfrms > 0) {
/* The only case when xfrm_bundle_lookup() returns a
* bundle with null route, is when the template could
* not be resolved. It means policies are there, but
* bundle could not be created, since we don't yet
* have the xfrm_state's. We need to wait for KM to
* negotiate new SA's or bail out with error.*/
if (net->xfrm.sysctl_larval_drop) {
/* EREMOTE tells the caller to generate
* a one-shot blackhole route. */
dst_release(dst);
xfrm_pols_put(pols, drop_pols);
XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES);
return make_blackhole(net, family, dst_orig);
}
.....
}
后来我又看了下初始化net->xfrm.sysctl_larval_drop的地方,是在xfrm_sysctl.c中的__xfrm_sysctl_init函数。代码是下面这个样子
static void __net_init __xfrm_sysctl_init(struct net *net)
{
net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME;
net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE;
net->xfrm.sysctl_larval_drop = 1;//改的这里
net->xfrm.sysctl_acq_expires = 30;
}
后来我就把这个net->xfrm.sysctl_larval_drop这行改成了 等于0
static void __net_init __xfrm_sysctl_init(struct net *net)
{
net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME;
net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE;
net->xfrm.sysctl_larval_drop = 0;//改的这里
net->xfrm.sysctl_acq_expires = 30;
}
这时候重新编译了下内核,然后把生成的包烧进android的机子,这时ipsec确实正常通过了,可是在日志上却出现了下面这样的情况
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.544692] ------------[ cut here ]------------
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.544739] WARNING: at /home/b617/git/bbdev/hardware/intel/linux-2.6/include/linux/skbuff.h:474 xfrm_output_resume+0x2fc/0x351()
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.544765] Modules linked in: tiwlan_drv atomisp lm3554 mt9m114 mt9e013 videobuf_vmalloc videobuf_dma_contig videobuf_core bt_drv st_drv sdio [last unloaded: tiwlan_drv]
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.544914] Pid: 3329, comm: mtpd Tainted: G W 2.6.35.3+ #11
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.544932] Call Trace:
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.544977] [] warn_slowpath_common+0x4a/0xa6
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.545012] [] ? xfrm_output_resume+0x2fc/0x351
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.545050] [] warn_slowpath_null+0xf/0x13
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.545086] [] xfrm_output_resume+0x2fc/0x351
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.545125] [] xfrm_output+0x9f/0xaa
12-06 13:21:46.606 W/Kernel-Dmesg( 0): [ 4563.545162] [] xfrm4_output_finish+0x39/0x3c
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545195] [] xfrm4_output+0x55/0x5c
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545230] [] dst_output+0x12/0x15
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545263] [] ip_local_out+0x93/0x9a
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545298] [] ip_push_pending_frames+0x271/0x2e4
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545338] [] udp_push_pending_frames+0x27f/0x2e0
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545374] [] ? udp_sendmsg+0x440/0x53a
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545411] [] udp_sendmsg+0x45f/0x53a
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545453] [] ? rcu_read_lock+0x0/0x2b
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545490] [] ? rcu_read_lock+0x0/0x2b
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545530] [] ? get_parent_ip+0xb/0x31
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545567] [] inet_sendmsg+0x47/0x50
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545606] [] sock_sendmsg+0xc0/0xdb
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545648] [] ? __wake_up+0x32/0x3b
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545688] [] ? logger_aio_write+0x262/0x277
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545737] [] sys_sendto+0xc3/0xdf
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545785] [] ? fsnotify_modify+0x5d/0x68
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545833] [] sys_socketcall+0x16d/0x3c1
12-06 13:21:46.610 W/Kernel-Dmesg( 0): [ 4563.545874] [] ? vfs_writev+0x36/0x44
12-06 13:21:46.615 W/Kernel-Dmesg( 0): [ 4563.545916] [] syscall_call+0x7/0xb
12-06 13:21:46.615 W/Kernel-Dmesg( 0): [ 4563.545947] ---[ end trace 01e818355159b7b9 ]---
我不明白上面的日志信息是什么意思,还有我改的那行代码是什么意思?望高手指点(net->xfrm.sysctl_larval_drop)
|
没有人回答就自己google啊:
http://www.serverphorums.com/read.php?12,201874
http://www.serverphorums.com/read.php?12,201874