X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=interface-ip.c;h=2a26a4af06f8fb570b237a6e51b504c59afe4bf0;hp=51f23eff92943059670373cb1efc39f36f69eead;hb=07a47add60b567f65dd2051fe45ac49e1ae97524;hpb=273550337f70b8b2175875e0c4f0bbd483cfe326;ds=sidebyside diff --git a/interface-ip.c b/interface-ip.c index 51f23ef..2a26a4a 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -18,7 +18,7 @@ int interface_add_address(struct interface *iface, struct device_addr *addr) else family = AF_INET; - list_add(&addr->list, &iface->address); + list_add_tail(&addr->list, &iface->address); return system_add_address(iface->l3_iface->dev, addr); } @@ -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_tail(&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); +}