Can I limit the number of tcp connections ?

Rob Landley rob at landley.net
Tue Apr 13 18:26:20 UTC 2010


On Tuesday 13 April 2010 06:15:35 Mark Jackson wrote:
> Is there any way to limit the # tcp connections under Busybox ?
>
> I've tried ...
>
> echo 8 > /proc/sys/net/core/somaxconn
>
> ... but I can still open 10 ssh sessions, as well as a web server.
>
> I know I could run iptables, but I was looking for a much lower level
> solution (with a smaller resource footprint).
>
> Any clues ?

This is really a kernel question rather than a busybox question, but looking 
at the kernel source, somaxconn is the default number of queued connections a 
listening socket will accept.

From net/socket.c:

                somaxconn = sock_net(sock->sk)->core.sysctl_somaxconn;
                if ((unsigned)backlog > somaxconn)
                        backlog = somaxconn;

You need to ask kernel guys about this.  Maybe linux-embedded at vger.kernel.org?

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds


More information about the busybox mailing list