Re: route & routed info

Thomas Narten (
Sat, 26 Sep 87 17:04:52 EST


Here is a 4.3 kernel problem that would give the symptoms you
describe. I don't take credit for finding the bug, but I did remember
to save it where I could find it! One way you can verify that this is
really your problem is to see if things work if you *don't* run
routed. Routed will time out routes for interfaces that aren't
working. An interface "doesn't work" if no routed packets are received
with a source address on the network. If UDP packets are being sent
with an incorrect source address, this will certainly confuse routed.


From: From: mouse@mcgill-vision.UUCP (der Mouse)
Newsgroups: comp.bugs.4bsd,comp.unix.wizards
Subject: 4.3bsd can mistake p-to-p interfaces
Message-ID: <717@mcgill-vision.UUCP>
Date: 29 Mar 87 09:26:28 GMT
Organization: McGill University, Montreal
Lines: 50
Posted: Sun Mar 29 04:26:28 1987

We are running mtXinu 4.3+NFS, and there is a bug in netinet/in_pcb.c.
I can't be certain, but I expect that this is present in 4.3 because it
is an obvious mistake once noticed; in fact earlier in the file there
is another opportunity for the same bug but someone noticed it. The
symptom is that packets being sent over UDP sockets, such as used by
routed(8), get stamped with the wrong "from" address. This is because
in_pcbsetaddr() is calling ifa_ifwithdstaddr() with the socket address
it is looking for, instead of a socket address with a zero port number.
Ifa_ifwithdstaddr is then comparing the entire 14 bytes of sockaddr
data to the data in the ifaddr entry, and of course the sockaddr in the
ifaddr entry has a zero port number. So the compare fails. The
earlier code I referred to is a similar call to ifa_ifwithaddr(); look
for yourself for the fix used. The fix I used is similar; here is the
original code:

                if (ia == 0) {
                        ia = (struct in_ifaddr *)
                            ifa_ifwithdstaddr((struct sockaddr *)sin);
                        if (ia == 0)
                                ia = in_iaonnetof(in_netof(sin->sin_addr));
                        if (ia == 0)
                                ia = in_ifaddr;
                        if (ia == 0)
                                return (EADDRNOTAVAIL);

and here is my fixed version (I know it isn't pretty, I didn't care
about esthetics when I fixed it):

                if (ia == 0) {
int oldport;
oldport = sin->sin_port;
sin->sin_port = 0; /* for ifa_ifwithdstaddr */
                        ia = (struct in_ifaddr *)
                            ifa_ifwithdstaddr((struct sockaddr *)sin);
                        if (ia == 0)
                                ia = in_iaonnetof(in_netof(sin->sin_addr));
sin->sin_port = oldport;
                        if (ia == 0)
                                ia = in_ifaddr;
                        if (ia == 0)
                                return (EADDRNOTAVAIL);

                                        der Mouse

Smart mailers: Smart mailers: mouse@mcgill-vision.uucp
USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!musocs!mcgill-vision!mouse
ARPAnet: think!mosart!mcgill-vision!

This archive was generated by hypermail 2.0b3 on Thu Mar 09 2000 - 14:39:16 GMT