kernel 2.0.38: getting route entries addendum/patch.

From: Gigi Sullivan (
Date: Sun Jan 16 2000 - 04:36:28 EST

Hi all :)

   First off, I'm sorry if this is the wrong ml. Please forgive me.
   And ... if this could be useless please forgive me twice ! :)

   I wrote a little kernel (version 2.0.38) patch (or addendum,
   callit how you want) to get the list of all the route entries
   on the system.

   I know that you can get the same result reading from /proc
   filesystem, but I was thinking:
      "We have SIOCADDRT/SIOCDELRT ioctl calls. Why don't to have
       a SIOCLSTRT ioctl call too ?"

   Well, the other reason is that /proc could be unmounted and
   however I'd like to add a "clean" way to get this kind of info.

   I won't post the patch against 2.0.38 kernel series since, before,
   I wish to get some feedback, expecially from the maintainers.

   Just FYI the patch provides a way to get all the route entries, by
   working just as the SIOCIFCONF ioctl call.
   Just for example, let's show the little C code from user space:
        (error condition are unchecked just to be clear)

      int fd;
      struct rtconf rtconf;
      struct rtreq rtreq[16];

      rtconf.rt_addr = (caddr_t) rtreq;
      rtconf.rt_len = sizeof(rtreq);

      fd = socket(AF_INET, SOCK_DGRAM, 0);
      ioctl(fd, SIOCLSTRT, &rtconf);

   rtconf{} and rtreq{} are the two new structures I added both in
   kernel and user header file.
   Now rtreq[] will hold all the route entries (er static one, obviously)
   of our system.
        rtconf.rt_len will hold the byte effectivly transferred by the kernel
   to the userspace through the ioctl call.
   As you can see, the behaviour of this ioctl is like SIOCIFCONF one.
        For any info, flame, correction and so on feel free to contact me :)
        THX !

bye bye

                           -- gg sullivan

Lorenzo Cavallaro	`Gigi Sullivan' <>  -- ITALY

Until I loved, life had no beauty; I did not know I lived until I had loved. (Theodor Korner) - To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to

This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:30 EST