From f6fb6bee2c29f31d13d0b0288f4f680b6b56e9ba Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 3 May 2011 00:53:40 +0200 Subject: add routes/gateway support --- interface-ip.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'interface-ip.c') diff --git a/interface-ip.c b/interface-ip.c index 51f23ef..6c673c6 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -46,3 +46,23 @@ void interface_del_ctx_addr(struct interface *iface, void *ctx) interface_del_address(iface, addr); } } + +int interface_add_route(struct interface *iface, struct device_route *route) +{ + list_add(&route->list, &iface->routes); + return system_add_route(iface->l3_iface->dev, route); +} + +void interface_del_route(struct interface *iface, struct device_route *route) +{ + list_del(&route->list); + system_del_route(iface->l3_iface->dev, route); +} + +void interface_del_all_routes(struct interface *iface) +{ + struct device_route *route, *tmp; + + list_for_each_entry_safe(route, tmp, &iface->routes, list) + interface_del_route(iface, route); +} -- cgit v1.2.3