3

I use ioctl() to set the gateway address (SIOCADDRT with RTF_GATEWAY in the flags).

What's the standard ioctl routine to retrieve it?

Matt
  • 22,721
  • 17
  • 71
  • 112
user788041
  • 81
  • 3
  • 8
  • What operating system is this? That's probably important to add. – tbert Mar 07 '12 at 14:49
  • I am using an array of operating systems, from eCos to uCLinux, passing through Linux and Windows as well. The gateway setting routine is practically identical on all of them, same for getting IP address or mask, they are standard. – user788041 Mar 07 '12 at 15:52
  • Retreiving the routing table, which is what you're actually going to need to do, unless I'm completely mistaken, is a highly OS-dependent task. – tbert Mar 07 '12 at 16:00

1 Answers1

1

My understanding is that there is no 'standard ioctl routine' to get the gateway address in a cross-platform-friendly fashion. On Linux you might consider looking at using Netlink sockets, as described in this post.

Community
  • 1
  • 1