linux没有可用的缓冲区空间,linux – 连接时“没有可用的缓冲区空间”

在3.6之前的内核中,您可能已经被ENOBUFS用于常规IPv4 / v6流量,

当net.ipv4.route.max_size或net.ipv6.route.max_size

limit was depleated,accordingly时.

从内核3.6,routing cache was removed和net.ipv4.route.max_size开始,它失去了对dst条目数量的影响.所以,通常情况下,这将不再可能.

但是,在使用IPSec时,您仍然可以像我一样遇到此错误.在创建了一定数量的IPSec隧道之后,我无法ping远程主机:

# ping 10.100.0.1

connect: No buffer space available

从iputils ping创建测试文件描述符,并在其上使用connect()来绑定dst ip.当它发生时,内核创建给定AF的dst缓存条目,

在我的情况下,xfrm4 dst缓存条目限制已经耗尽.此限制由sysctl设置控制:

xfrm4_gc_thresh - INTEGER

The threshold at which we will start garbage collecting for IPv4

destination cache entries. At twice this value the system will

refuse new allocations.

我使用内核3.10.59遇到了这个问题,默认限制非常低 – 1024.

从内核3.10.83开始,此限制增加到32768,并且将是much harder to hit.

所以,我发了:

# sysctl net.ipv4.xfrm4_gc_thresh=32768

它为我做了一件事.

使用IPSec的内核中的近似路径:

ip4_datagram_connect() -> ip_route_connect() -> ip_route_output_flow() ->

xfrm_lookup() -> xfrm_resolve_and_create_bundle() ->

... -> xfrm_alloc_dst() -> dst_alloc() with xfrm4_dst_ops,where gc is set.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值