[ds6-devel] Re: is_double_binding_sane

Mauro Tortonesi mauro@deepspace6.net
Sun Dec 29 21:19:48 2002


On Sun, 29 Dec 2002, Chris Leishman wrote:

>
> On Sunday, December 29, 2002, at 08:17 PM, Mauro Tortonesi wrote:
> <snip>
> > yes, is_ipv6_enabled is not very useful. but IMVHO it's better to
> > reorder
> > the addrinfo list returned by getaddrinfo only when it is really
> > needed,
> > as we don't know if this breaks the inner working of freeaddrinfo in
> > some
> > platform (it shouldn't, however). what do you think about it?
>
> I've thought about it, and I don't think it'll be a problem.  It is
> theoretically possible that getaddrinfo could be implemented in a way
> that isn't compatible with this, but it would be pretty crazy.

i agree. i added the test for robustness and portability. we can cut it if
you want, but i still think that we should develop (and use) a good runtime
test for double binding.

> We can avoid making assumptions about the inner workings of getaddrinfo
> by changing the way we use the results - instead of changing the order
> we loop through multiple times, first for ipv6 then for the rest.

good idea!

> But I didn't think it was worth it for now.

i don't know. it would be a pretty nice thing to do if double binding does
not work...

> >> And "is_double_bind_sane" is a little dangerous IMHO, since it
> >> attempts
> >> a bind to 1025 - assuming it will be free, which isn't necessarily
> >> true.
> >>
> >> Perhaps you need to explain all the logic behind it a bit more?
> >
> > ooops, i forgot to increment port. it should be fixed now. however, the
> > implementation is still buggy because in some cases it fails to detect
> > if there is a program bound to the specified port.
> >
> > perhaps i should borrow some code from netstat to find the first
> > unbounded
> > port on the system. what do you think?
> >
> > in all cases, IMHO we need a function to detect at runtime if the
> > system
> > supports double binding.
>
> I _really_ don't like the way this test works....though I am stuck to
> think of a better way to do it.  I think this might be one of those
> rare situations where a autoconf compile time test would be better -
> since platforms aren't likely to change the way they do it....

you're wrong here. think of a standard linux 2.4 system. it does not
support correctly double binding. so, when a user installs nc6 on his
system, nc6 autoconf macros detect that the system doesn't support double
binding.

what if the user upgrades his system with the USAGI-patched linux
kernel the system now? the system supports double binding but nc6 can't
detect this because the check was made at build time.

so, IMHO we need a runtime mechanism to detect if the system supports
double binding.

> At the very least, I think this check should ONLY be done if we detect
> a situation in which double binding might have occurred - NOT all the
> time regardless.

good idea.

> Thoughts?  I might do some more research into this and see if there are
> other options.

i hope you will find a good solution for this problem...

-- 
Aequam memento rebus in arduis servare mentem...

Mauro Tortonesi			mauro@deepspace6.net
				mauro@ferrara.linux.it
Deep Space 6 - IPv6 on Linux	http://www.deepspace6.net
Ferrara Linux Users Group	http://www.ferrara.linux.it


More information about the ds6-devel mailing list