I am writing a daemon running on the embedded platform, which should change the default route of the device according to which it is currently connected. How can I do this programmatically? I know that I can use the system ("route del default && route add default gateway blah"); etc., but is there a more direct way?
UPDATE: I solved my problem by opening a patch for pppd that allows the use of the replaceefaultroute parameter. The patch also contains code for programmatically modifying the routing table. It is included in this gentoo bug report http://bugs.gentoo.org/227321
c linux networking
Mattsmith
source share