[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: (usagi-users 00308) Re: USAGI IPv6 patches



¡Hola!

> > What other platform does have the same semantics that mainstream linux?=20

> Well, look into itojun's review to get summary of all the flavors.

Yep, so the answer to my question is "none".

> Current diagnosis is that the only sane solution not breaking RFCs
> is IPV6_V6ONLY. This is way, which we are going to follow.

I'm just an application programmer, I want to be able to use IPv6 so
I need to change the programs I use. Porting some program to use IP
is not very much work. But i use a lot of programs, so i need to do
a lot of work. I'm enough decided to do that much work now, but I
want not to repeat it. Does somebody believes IPv6 is a cure-all
protocol, so we'll not need a new one sometime in the future? I don't.
So, while I'm motivated by the need to use IPv6 I want not to limit
me to just that. Now we have an AF independent API, that's what i
want to use.

I -as an application programmer- should not know if i'm using IPv4,
IPv6, IPv9, IPX++++, CLNP or DECnet Phase X.

I just should ask the kernel: "connect my to <server> using service
<service>" or "let me listen any requests for <service> without regard
to the protocol family".

The AF independent API should let us to do that and the way it's
designed it does. But, the linux approach is making this harder
than it should be.
 
> > (bind9 docs say "The only OS which seems to do this is linux.")
> What's about BIND... BIND need _not_ this feature at all.

It needs that if the admin wants to limit what addresses bind
should listen on.

> And this is exactly which is to be understood by BIND maintainers.
> Of course, it is their right to allocate miriads of useless sockets
> and to bind them left and right. One is enough yet.
 
One is enough if you're limiting yourself to IPv4 and IPv6, but
unless you want to change every program that uses networks next
time a protocol goes out (and i know, that's not something very
frequent, but it will happen sometime in the future) or want to
invent a way to map any PF address to an IPv6 address one is not
enough.

> > Linux bind semantics force us to ignore errors, 
> Please, explain. I do not understand this statement... What is to
> "ignore errors"?

Normal way to code AF independent servers is: (taken from itojun's
http://www.kame.net/newsletter/19980604/)

        struct addrinfo hints;
        struct addrinfo *res;
        struct addrinfo *saveres;
        char *myservice;
	int fd[MAX_PF];
	int nfd;

        memset(&hints, 0, sizeof(hints));
        /* set-up hints structure */
        hints.ai_family = PF_UNSPEC;
        hints.ai_flags = AI_PASSIVE;
        hints.ai_socktype = SOCK_STREAM;
        error = getaddrinfo(NULL, myservice, &hints, &res);
	saveres = res;
	nfd = 0;
        if (error)
                perror(gai_strerror(error));
        else {
                /*
                 * "res" has a chain of addrinfo structure filled with
                 * 0.0.0.0 (for IPv4), 0:0:0:0:0:0:0:0 (for IPv6) and alike,
                 * with port filled for "myservice".
                 */
                while (res) {
			if( (fd[nfd] = socket(res->ai_family, SOCK_STREAM, res->ai_protocol)) == -1)
				croak();
			if( bind(fd[nfd], res->ai_addr, res->ai_addrlen) == -1)
				croak();
			if( listen(fd[nfd], 10) == -1)
				croak();
			res = res->ai_next;
                }
		freeaddrinfo(saveres);
        }

	/* Do a poll or select loop for accepting connections */

Everywhere but in linux this binds to myservice for any protocol supported by
the kernel and croaks if somebody else is listening to the same service in
some protocol.

In linux it will ever croaks, so we have to ignore bind error or add a
complicated check (and i believe that adding this only for linux check
doesn't makes the program more portable, i like to make portable programs,
not programs that know every SO details so it can work everywhere)

> > my book. I believe it's better to change linux behaviour to match the
> > (IMHO more sane) one every other platform has instead of forcing usermode
> > programmers to do something that isn't a right thing.

> Seems, you still did not get the point. All the stacks except for
> openbsd, NT and linux happen to be simply buggy. That's all.

While I'm not fully convinced about that (and would like to read itojun
opinion) I prefer that buggy behaviour to the right one that linux has,
because the right one is right for IPv6 but very bad for AF independent
code. And I prefer the non RFC complaint, non buggy openbsd/MS behaviour
to the buggy one.

> The question is only in direction to move: to break RFC compliance
> moving to openbsd/NT, or to preserve RFC compliance remaining in the state
> of Linux (probably, but not necessaraily, with IPV6_V6ONLY).

> Doubts that the last is the best look strange for me, at least now.

If we want to live in an IPv6 world forever yes. If we want to be able to
adapt to new protocols without the pain we're having in the IPv4 -> IPv6
transition, maybe the doubt is not so strange.

> Alexey

Thanks for your patience,
					HoraPe
---
Horacio J. Peña
horape@compendium.com.ar
horape@uninet.edu
bofh@puntoar.net.ar
horape@hcdn.gov.ar



Reply to: