Reputation: 5469
I'm porting an application from Linux to FreeBSD that needs to look at the table of network routes ("route" on Linux or "netstat -r" on FreeBSD).
On Linux, the application simply reads /proc/net/route and /proc/net/inet6_route.
What is the best way to do this programatically on FreeBSD ?
Upvotes: 6
Views: 3583
Reputation: 29757
This is documented in the man page route(4). Basically, you read()
and write()
a PF_ROUTE
socket. You can look at the /sbin/route source for an example.
Upvotes: 3