Commit bdc27e89 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement kernel_route(MODIFY).

parent 4fce191d
......@@ -554,9 +554,21 @@ kernel_route(int operation, const unsigned char *dest, unsigned short plen,
struct rtmsg *rtm;
struct rtattr *rta;
int len = sizeof(buf.raw);
int rc;
if(operation == ROUTE_MODIFY) {
if(newmetric == metric)
return 0;
rc = kernel_route(ROUTE_ADD, dest, plen, gate, ifindex, newmetric, 0);
if(rc < 0)
return rc;
rc = kernel_route(ROUTE_FLUSH, dest, plen, gate, ifindex, metric, 0);
return rc;
}
debugf("kernel_route: %s %s/%d metric %d via %d nexthop %s\n",
operation == ROUTE_ADD ? "add" : "flush",
operation == ROUTE_ADD ? "add" :
operation == ROUTE_FLUSH ? "flush" : "???",
format_address(dest), plen, metric, ifindex,
format_address(gate));
......
......@@ -32,6 +32,7 @@ struct kernel_route {
#define ROUTE_FLUSH 0
#define ROUTE_ADD 1
#define ROUTE_MODIFY 2
int kernel_setup(int setup);
int kernel_setup_interface(int setup, const char *ifname, int ifindex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment