Date: 1995/12/06
+>:
+>::
+>::I have recently compiled version 1.3.35 on my Linux
+>:: box. When running under 1.2.12 all network function work fine. Under
+>:: 1.3.35 I can not even ping 127.0.0.1 (localhost). The route command
+>:: always returns 'SIOCADDRT: Invalid argument'. I double checked and
+>:: re-compiled insuring that I enable Networking support and TCP/IP
+>:: support although I did not enable gatewaying, multicasting, firewalling,
+>:: accounting, or tunneling (don't ever remember enable such in 1.2.xx
+>:: kernels). Do I need to any of these in order to get my networking/route working
+>:: again.
+>
+>: Please type "ifconfig" to check local-loop and
+>: ethernet cards.
+>:
+>: ---- Chiang.
+>
+>"ifconfig" returns exactly the same thing under kernel 1.2.x and
+>1.3.x. It shows valid I.P. addresses for both the localhost
+>(127.0.0.1) and the ethernet cards. Running route under 1.2.x returns
+>valid routes and under 1.3.x returns no routes. Trying to add a route
+>(as is done on boot up or manually) is when the SIOCADDRT error is
+>returned.
+>
I had exact same problem, and after tracing it down I am surprized that not
everybody does :-(
The problem is in /sbin/route being old (almost 2 years old :-)
and issuing ioctl of SIOCADDRTOLD, to which 1.2.x kernels replied with
Warning: obsolete routing request made.
and the 1.3.x (x == 35 for Richard, x == 42 for me) kernels reply -EINVAL.
To verify that this is indeed your problem, execute:
strace -o /tmp/trace.out /sbin/route add -net 127.0.0.0
and look for 'ioctl' call in /tmp/trace.out.
The line probably looks like this:
ioctl(4, 0x8940, 0xbffffab0) = -1 (Invalid argument)
where 0x8940 == SIOCADDRTOLD.
I tried to find newer /sbin/route on sunsite or tsx-11, but didn't find one.
There is tsx-11.mit.edu:/pub/linux/sources/system/route.c, that wouldn't
even compile (at least not with libc-5.2.18).
Here is a patch that makes it to compile and add the route:
(compile with 'cc -o route route.c')
*** route.c.old Mon Feb 14 00:00:00 1994
--- route.c Sat Dec 23 23:55:43 1995
***************
*** 28,45 ****
#include <unistd.h>
#include <ctype.h>
/* Pathnames of the PROCfs files used by NET. */
#define _PATH_PROCNET_ROUTE "/proc/net/route"
- #ifdef SIOCADDRTOLD
#define mask_in_addr(x) (((struct sockaddr_in *)&((x).rt_genmask))->sin_addr.s_addr)
#define full_mask(x) (x)
- #else
- #define mask_in_addr(x) ((x).rt_genmask)
- #define full_mask(x) (((struct sockaddr_in *)&(x))->sin_addr.s_addr)
- #endif
char * getsock(char *bufp, struct sockaddr * sap)
{
--- 28,42 ----
#include <unistd.h>
#include <ctype.h>
+ #include <net/if_route.h>
+
/* Pathnames of the PROCfs files used by NET. */
#define _PATH_PROCNET_ROUTE "/proc/net/route"
#define mask_in_addr(x) (((struct sockaddr_in *)&((x).rt_genmask))->sin_addr.s_addr)
#define full_mask(x) (x)
char * getsock(char *bufp, struct sockaddr * sap)
{