Solved: SIOCADDRT errors when running route under 1.3.3x

Solved: SIOCADDRT errors when running route under 1.3.3x

Post by Anna Pluzhnik » Mon, 25 Dec 1995 04:00:00




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)
  {

 
 
 

1. SIOCADDRT errors when running route under 1.3.3x kernels

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.
Thanks in advance.

2. Apache 1.3.26 & Php 4.2.2

3. Help: SIOCADDRT error running /etc/route in NET-2

4. Choice of OS on boot?

5. i4b/isic with AVM FritzCard PCMCIA 2.0

6. docs for SVR4 form(3x), menu(3x), and panel(3x)

7. Intel 28595TX pcmcia Net based chip

8. kerneld and 1.3.3x?

9. 1.3.3X and ELF modules

10. 1.3.3x weirdness - /proc/cpuinfo

11. ext2 trouble in 1.3.3x kernels

12. Volume problem with xmcd 1.3 / PAS16 SCSI / NEC CDR-500 (3x) cdrom