Configuring Linux routing tables/rules from a C-program



Hi

Which is the preferred way to configure routing table(s), rules, etc.
from a C-program?

Would it be to

1) Spawn a copy of the iproute2 "ip" program (in /sbin/ip ) with
relevant parameters?

or

2) Use the netlink protocol "directly", i.e. with RTM_NEWROUTE,
RTM_NEWRULE, etc.?

Brs
.



Relevant Pages