netdev
[Top] [All Lists]

kernel 2.0.38: getting route entries addendum/patch.

To: netdev@xxxxxxxxxxx
Subject: kernel 2.0.38: getting route entries addendum/patch.
From: Gigi Sullivan <sullivan@xxxxxxxxxxxxx>
Date: Sun, 16 Jan 2000 10:36:28 +0100
Reply-to: sullivan@xxxxxxxxxxxxx
Sender: owner-netdev@xxxxxxxxxxx
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' <sullivan@xxxxxxxxxxxxx>  -- ITALY

Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)

<Prev in Thread] Current Thread [Next in Thread>
  • kernel 2.0.38: getting route entries addendum/patch., Gigi Sullivan <=