X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=blobdiff_plain;f=interface-ip.c;h=b86acb5856033d240724a80e022f83b1d8e132c7;hp=6c673c69272f1044cdb7c6e91f2129937aff6441;hb=df13b3ade3f366446033214b3a85228005c014ea;hpb=f6fb6bee2c29f31d13d0b0288f4f680b6b56e9ba diff --git a/interface-ip.c b/interface-ip.c index 6c673c6..b86acb5 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -5,6 +5,7 @@ #include "netifd.h" #include "device.h" #include "interface.h" +#include "interface-ip.h" #include "proto.h" #include "ubus.h" #include "system.h" @@ -18,7 +19,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); } @@ -33,6 +34,7 @@ void interface_del_address(struct interface *iface, struct device_addr *addr) list_del(&addr->list); system_del_address(iface->l3_iface->dev, addr); + free(addr); } void interface_del_ctx_addr(struct interface *iface, void *ctx) @@ -49,7 +51,7 @@ void interface_del_ctx_addr(struct interface *iface, void *ctx) int interface_add_route(struct interface *iface, struct device_route *route) { - list_add(&route->list, &iface->routes); + list_add_tail(&route->list, &iface->routes); return system_add_route(iface->l3_iface->dev, route); } @@ -57,6 +59,8 @@ void interface_del_route(struct interface *iface, struct device_route *route) { list_del(&route->list); system_del_route(iface->l3_iface->dev, route); + if (!route->keep) + free(route); } void interface_del_all_routes(struct interface *iface)