free routes and addresses
authorFelix Fietkau <nbd@openwrt.org>
Mon, 5 Sep 2011 03:53:07 +0000 (05:53 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 5 Sep 2011 03:53:07 +0000 (05:53 +0200)
interface-ip.c
interface-ip.h

index 6decaea..b86acb5 100644 (file)
@@ -34,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);
 
        list_del(&addr->list);
        system_del_address(iface->l3_iface->dev, addr);
+       free(addr);
 }
 
 void interface_del_ctx_addr(struct interface *iface, void *ctx)
 }
 
 void interface_del_ctx_addr(struct interface *iface, void *ctx)
@@ -58,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);
 {
        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)
 }
 
 void interface_del_all_routes(struct interface *iface)
index 2f5cf85..e83e327 100644 (file)
@@ -31,6 +31,7 @@ struct device_route {
        void *ctx;
 
        enum device_addr_flags flags;
        void *ctx;
 
        enum device_addr_flags flags;
+       bool keep;
 
        unsigned int mask;
        union if_addr addr;
 
        unsigned int mask;
        union if_addr addr;