ip_route_output() has different behavior for different modules on Montavista Linux.

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

 



[1.] One line summary of the problem:    
ip_route_output() has different behavior for different modules on Montavista
Linux.

[2.] Full description of the problem/report:
I have a 3rd party ipsec-stack which has route lookup problems on MontaVista
Linux CGE 3.1.
When I call ip_route_output(dst, 0, 0, 0) from the ipsec stack kernel module, it
reports error for destinations which are not in local subnet.
Note:
(a) This problem doesnt show up on Redhat 9.0 system with 2.4.26 kernel.
(b) If I set an interface with IP address on same subnet as the destination, route lookup
succeeds returning next hop as the destination ip address itself, but its not of any use.


In the screen dump below "my_route_lookup" are my test destinations where I wish to reach.
Actual code for this portion in section [6.]
<screen dump>
stack_route_lookup: route inquiry 0x711e030a
my_route_lookup: inquiry for 0x0a511767 failed
my_route_lookup: inquiry for 0x6717510a failed
my_route_lookup: inquiry for 0x0a031e66 succeeded nh : 0x0a031e66 ifnum  2

my_route_lookup: inquiry for 0x0a031e71 succeeded nh : 0x0a031e71 ifnum  2

stack_route_lookup: route to 0x711e030a through if 2 gw 0x711e030a
stack_route_lookup: route inquiry 0x700f510a
my_route_lookup: inquiry for 0x0a511767 failed
my_route_lookup: inquiry for 0x6717510a failed
my_route_lookup: inquiry for 0x0a031e66 succeeded nh : 0x0a031e66 ifnum  2

my_route_lookup: inquiry for 0x0a510f70 failed
stack_route_lookup: inquiry for 0x700f510a failed
</screen dump>
ifnum 2 corresponds to eth0 on my system.



If I do the same query from my test kernel module, it returns success for route
lookup.
Sample code for this portion in section [6.]
<screen dump>
root@n0s120:/azaire/mwsg/bin# insmod ./myrelay.o ; rmmod myrelay

Message from syslogd@10 at Sat Nov  5 02:13:43 2005 ...
10 kernel: inquiry for 0x0a511767 succeeded nh : 0x0a030103 ifnum  2

Message from syslogd@10 at Sat Nov  5 02:13:43 2005 ...
10 kernel: inquiry for 0x6717510a succeeded nh : 0x0a030103 ifnum  2

Message from syslogd@10 at Sat Nov  5 02:13:43 2005 ...
10 kernel: inquiry for 0x0a031e66 succeeded nh : 0x0a031e66 ifnum  2
</screen dump>


I tried to look on the web and see if there are some init params for the
ipsec-stack kernel module for this behavior but I didnt find any, which will
cause this behavior.  My RedHat 9.0 system has 2.4.26 kernel and it gets 
correct route lookup responses from the networking stack. 

Is there a flag in kernel module which might cause the routing stack to behave 
differently on Monta Vista for the particular module?
Please let me know if you need any more information for this issue.


Thanks in advance,
Santosh



[3.] Keywords (i.e., modules, networking, kernel):
ip_route_output()
Monta Vista Linux
Linux 2.4.20
kernel module

[4.] Kernel version (from /proc/version):
root@n0s120:~# cat /proc/version
Linux version 2.4.20_mvlcge31-atca717 (bldmgr@anamika) (gcc version 3.3.1 (MontaVista 3.3.1-3.0.10.0300532 2003-12-24)) #1 Thu Oct 27 11:20:56 PDT 2005
root@n0s120:~# 

[6.] A small shell script or example program which triggers the
     problem (if possible)

<actual code in stack>
int my_route_lookup (unsigned int daddr)
{
  struct rtable *rt;
  int rval;

  rval = ip_route_output(&rt, daddr, 0, 0, 0);
  if (rval < 0)
  {
    DEBUG (0, ("inquiry for 0x%08x failed", ntohl(daddr)));
  }
  else
  {
    DEBUG (0, ("inquiry for 0x%08x succeeded nh : 0x%08x ifnum  %d\n", 
              ntohl(daddr), ntohl(rt->rt_gateway), rt->u.dst.dev->ifindex));
  }

  return rval;
}
{
....
....
      /* Get the route information */
      my_route_lookup (htonl(0x0a511767));
      my_route_lookup (htonl(0x6717510a));
      my_route_lookup (htonl(0x0a031e66));
      my_route_lookup (daddr);
      rval = ip_route_output(&rt, daddr, 0, 0, 0);
      if (rval < 0)
        {
          DEBUG(0, ("## inquiry for 0x%08x failed", daddr));
          return;
        }
....
....
}
</actual code in stack>


<my sample code>
#ifndef __KERNEL__
#  define __KERNEL__
#endif

/* The Makefile takes care of adding -DMODULE */

#include <linux/module.h>

#include <linux/kernel.h>    /* printk() */
#include <linux/slab.h>    /* kmalloc() */
#include <linux/errno.h>     /* error codes */
#include <linux/netdevice.h> /* basic data structures */
#include <linux/init.h>      /* __init */
#include <linux/skbuff.h>
#include <linux/if_arp.h>    /* ARPHRD_ETHER */
#include <linux/if.h>         /* ip header */
#include <linux/in.h>         /* protocol header */
#include <net/arp.h>         /* neighbor stuff */
#include <net/ip.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include <linux/netfilter_ipv4.h>
#include <net/icmp.h>

#include <asm/uaccess.h>  /* memcpy and such */

MODULE_AUTHOR("Santosh Gupta");
MODULE_LICENSE("GPL");

int my_route_lookup (unsigned int daddr)
{
  struct rtable *rt;
  int rval;

        rval = ip_route_output(&rt, daddr, 0, 0, 0);
  if (rval < 0)
  {
    printk (KERN_INFO "inquiry for 0x%08x failed", ntohl(daddr));
  }
  else
  {
    printk (KERN_EMERG "inquiry for 0x%08x succeeded nh : 0x%08x ifnum  %d\n", 
              ntohl(daddr), ntohl(rt->rt_gateway), rt->u.dst.dev->ifindex);
  }

  return rval;
}

int init_module(void)
{
  my_route_lookup (htonl(0x0a511767));
  my_route_lookup (htonl(0x6717510a));
  my_route_lookup (htonl(0x0a031e66));

  return 0;
}

void cleanup_module(void)
{
}
</my sample code>

[7.] Environment
[7.1.] Software (add the output of the ver_linux script here)
root@n0s120:~# sh ./ver_linux 
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
 
Linux n0s120 2.4.20_mvlcge31-atca717 #1 Thu Oct 27 11:20:56 PDT 2005 i686 unknown
 
Gnu C                  command
util-linux             2.11h
mount                  2.11h
modutils               2.4.21
e2fsprogs              1.27
reiserfsprogs          3.6.3
PPP                    2.4.1
./ver_linux: ldd: command not found
awk: cmd. line:2: (FILENAME=- FNR=1) fatal: attempt to access field -1
./ver_linux: ldd: command not found
Procps                 2.0.14
Net-tools              1.60
Kbd                    command
Sh-utils               2.0.11
Modules Loaded         ipsecmodule pppot relay

[7.2.] Processor information (from /proc/cpuinfo):
root@n0s120:~# cat /proc/cpuinfo 
processor       : 0
cpu_package     : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 13
model name      : Intel(R) Pentium(R) M processor 1.80GHz
stepping        : 6
cpu MHz         : 1795.556
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
htpf_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr mce cx8 apic sep mtrr pge mca cmov pat clflush dts acpi mmx fxsr sse sse2 ss tm
bogomips        : 3578.26

[7.3.] Module information (from /proc/modules):
root@n0s120:~# cat /proc/modules 
ipsecmodule           558916   1
pppot                   5984   0 (unused)
relay                  11680   1

[7.7.] Other information that might be relevant to the problem
       (please look in /proc and include all information that you
       think to be relevant):

<screen dump>
root@n0s120:/proc/sys/net/ipv4#  cat ip_forward 
1
root@n0s120:/proc/sys/net/ipv4# cd conf/
root@n0s120:/proc/sys/net/ipv4/conf# cat `find . -name rp_filter`
0
1
1
0
1
0
root@n0s120:/proc/sys/net/ipv4/conf# cat `find . -name arp_filter`
0
0
0
0
0
1
root@n0s120:/proc/sys/net/ipv4/conf# ip rule list
0:      from all lookup local 
32764:  from 10.81.15.112 lookup rlm 
32765:  from all fwmark        3 lookup rlm 
32766:  from all lookup main 
32767:  from all lookup 253 
root@n0s120:/proc/sys/net/ipv4/conf# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.3.0.0        0.0.0.0         255.255.0.0     U     0      0        0 eth0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth1
172.16.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         10.3.1.3        0.0.0.0         UG    0      0        0 eth0
root@n0s120:/proc/sys/net/ipv4/conf# ip route show table rlm
default dev relay  scope link 
root@n0s120:/proc/sys/net/ipv4/conf# ifconfig -a
bond0     Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          BROADCAST MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

dummy0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          BROADCAST NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

eth0      Link encap:Ethernet  HWaddr 00:80:42:19:BB:C0  
          inet addr:172.17.0.120  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:214413 errors:0 dropped:0 overruns:0 frame:0
          TX packets:63428 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:51042268 (48.6 Mb)  TX bytes:20278713 (19.3 Mb)
          Interrupt:10 Base address:0x2000 Memory:fe800000-fe820000 

eth0:1    Link encap:Ethernet  HWaddr 00:80:42:19:BB:C0  
          inet addr:172.16.0.120  Bcast:172.16.255.255  Mask:255.255.0.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x2000 Memory:fe800000-fe820000 

eth0:18   Link encap:Ethernet  HWaddr 00:80:42:19:BB:C0  
          inet addr:10.3.30.122  Bcast:10.3.255.255  Mask:255.255.0.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:10 Base address:0x2000 Memory:fe800000-fe820000 

eth1      Link encap:Ethernet  HWaddr 00:80:42:19:BB:C1  
          inet addr:172.18.0.120  Bcast:172.18.255.255  Mask:255.255.0.0
          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:140125 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6289 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:9410310 (8.9 Mb)  TX bytes:497301 (485.6 Kb)
          Interrupt:11 Base address:0x2040 Memory:fe820000-fe840000 
eth2      Link encap:Ethernet  HWaddr 00:80:42:19:BB:C3  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:11 Base address:0x3000 Memory:fe900000-fe920000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:45017 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45017 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2634301 (2.5 Mb)  TX bytes:2634301 (2.5 Mb)

pppot     Link encap:Point-to-Point Protocol  
          POINTOPOINT NOARP MULTICAST  MTU:1472  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

relay     Link encap:Point-to-Point Protocol  
          inet addr:221.221.1.1  P-t-P:221.221.1.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1464  Metric:1
          RX packets:8571 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10 
          RX bytes:857100 (837.0 Kb)  TX bytes:0 (0.0 b)

tunl0     Link encap:IPIP Tunnel  HWaddr   
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

</screen dump>
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux