lkml.org 
[lkml]   [2010]   [Feb]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [net-next PATCH v4 3/3] net: reserve ports for applications using fixed port numbers
Date
On Tuesday 16 February 2010 11:37:04 you wrote:
> > BUILD_BUG_ON(sizeof(struct inet_skb_parm) > sizeof(dummy_skb->cb));
> >
> > + sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL);
> > + if (!sysctl_local_reserved_ports)
> > + goto out;
> > +
>
> I think we should also consider the ports in ip_local_port_range,
> since we can only reserve the ports in that range.
>

That is subject to changes at runtime, which means we will have to readjust
the bitmap at runtime which introduces the need for additional synchronization
operations which I would rather avoid.

> > + {
> > + .procname = "ip_local_reserved_ports",
> > + .data = NULL, /* initialized in sysctl_ipv4_init */
> > + .maxlen = 65536,
> > + .mode = 0644,
> > + .proc_handler = proc_dobitmap,
> > + },
>
> Isn't there an off-by-one here?
>
> In patch 2/3, you use 0 to set the fist bit, then how about 65535 which
> writes 65536th bit? This is beyond the range of port number.
>

This seems fine to me, 65535 is the value used by both the port checking
function and the proc read/write function. And it translates indeed to
65536th bit, but that is also bit 65535 if you start counting bits from 0
instead of 1. The usual computing/natural arithmetic confusion for the meaning
of first :)



\
 
 \ /
  Last update: 2010-02-16 12:13    [W:0.096 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site