Walt Wimer
|
RE: QNX4 IP route questions
|
Walt Wimer
06/04/2010 10:17 AM
post56053
|
RE: QNX4 IP route questions
I asked:
"If I choose to go with dynamically manipulating the routing table (for
Solution 2 or Solution 3 above), is the SIOCADDRT/SIOCDELRT mechanism still
the best API for this? This mechanism uses an old paradigm for specifying
the route destination and does not support classless IP routing (a.k.a.
CIDR). I.e. I can't specify a route such as 192.168.1.0/23. Nevertheless,
there are indications that the actual IP routing table might use the newer
Berkeley radix tree implementation, that *does* support classless routing.
Thus I'm wondering if there is a newer API somewhere that I don't know
about. Is there?"
Some Google research suggests that the answer to this particular question
may potentially be found in the FreeBSD route(4) man page. The newer API
uses a special socket with protocol family PF_ROUTE. Routing information is
read and written via a message protocol to/from such a socket. Here's an
excerpt from the FreeBSD route(4) man page (found via Google):
ROUTE(4) BSD Kernel Interfaces Manual
ROUTE(4)
NAME
route -- kernel packet forwarding database
SYNOPSIS
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/route.h>
int
socket(PF_ROUTE, SOCK_RAW, int family);
DESCRIPTION
FreeBSD provides some packet routing facilities. The kernel maintains
a
routing information database, which is used in selecting the
appropriate
network interface when transmitting packets.
A user process (or possibly multiple co-operating processes) maintains
this database by sending messages over a special kind of socket. This
supplants fixed size ioctl(2)'s used in earlier releases. Routing
table
changes may only be carried out by the super user.
The operating system may spontaneously emit routing messages in
response
to external events, such as receipt of a re-direct, or failure to
locate
a suitable route for a request. The message types are described in
greater detail below.
Walt
|
|
|