From: urlichs@smurf.sub.org (Matthias Urlichs) Subject: Re: more RPC: portmap trouble Date: 15 Feb 1993 18:37:46 +0100
In comp.os.linux, article <1993Feb15.101727.23900@aixrs0.hrz.uni-essen.de>,
hank@Blimp (Hendrik G. Seliger) writes:
>
> So I'm trying out this rpc-stuff. Sounds good, and my clients all
> works nicely as they should. BUT then I try to boldly go where some
> men have gone before and write a server. Ha! Won't register! Same
> trouble as I got with nfsd, mountd, .... Nothing seems to be able to
> register its services. As far as I understood this (PLEASE correct me
> if I'm wrong) this registration business is done with the portmapper;
> so is that the point where the trouble lies in a ditch waiting to jump
> on me? Any suggestions will we warmly welcomed!
>
Assuming that the portmapper is running, your problem is that you configured
your loopback interface as 127.0.0.1 instead of your ethernet's IP address.
The Kernel IP code currently has an internal list of locally-known addresses
(which is IMHO wrong; the list needs to be device-specific so that outgoing
packets get the correct interface-specific source address).
When a packet gets sent, the kernel uses the first address from that list
(your Ethernet address) as source address. When the portmapper replies,
it uses this address to send its reply to.
Because the kernel doesn't check if the address is local, it sends the
packet out to the Ethernet driver, which doesn't know that it should
redirect local addresses to the loopback interface. The packet there-
fore gets lost on the Ethernet cable.
If you want to keep the loopback address at 127.0.0.1, apply this kernel fix,
which seems to work correctly at my site but has not been tested otherwise:
[ The my_real_ip_addr is necessary because otherwise broadcasts would be
redirected to the loopback interface, which is not the desired effect ]
A better fix would be to keep a device-specific list of local
IP addresses, but I considered that to be too much work ;-) since
Fred van Kempen is rewriting the networking code anyway.
*** /pub/systems/linux/sources/system/linux-0.99.5/net/tcp/ip.c Thu Feb 11 20:54:08 1993
--- net/tcp/ip.c Sun Feb 14 03:44:37 1993
***************
*** 221,226 ****
--- 221,241 ----
return (0);
}
+ /*
+ * Like my_ip_addr, but compares without checking for broadcasts.
+ */
+ int
+ my_real_ip_addr(unsigned long addr)
+ {
+ int i;
+ for (i = 0; i < MAX_IP_ADDRES; i++)
+ {
+ if (ip_addr[i] == 0) return (0);
+ if (addr == ip_addr[i]) return (1);
+ }
+ return (0);
+ }
+
/* these two routines will do routing. */
static void
strict_route(struct ip_header *iph, struct options *opt)
***************
*** 257,262 ****
--- 272,281 ----
struct rtable *rt;
/* look through the routing table for some
kind of match. */
+ #if 1
+ if(daddr != htonl(0x7f000001) && my_real_ip_addr(daddr))
+ daddr = htonl(0x7f000001);
+ #endif
for (rt=rt_base; rt != NULL; rt=rt->next)
{
/* see if we found one. */
--
SHARE:
n. Give in, endure humiliation.
--
Matthias Urlichs -- urlichs@smurf.sub.org -- urlichs@smurf.ira.uka.de /(o\
Humboldtstrasse 7 -- 7500 Karlsruhe 1 -- Germany -- +49-721-9612521 \o)/