From: Felix Fietkau Date: Sun, 29 Apr 2012 11:58:41 +0000 (+0200) Subject: include route/address flags in vlist comparison X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0f738b8f6c5d89ad5130c74a8dcb9a1df9a190bc;p=oweals%2Fnetifd.git include route/address flags in vlist comparison --- diff --git a/interface-ip.c b/interface-ip.c index 104cfbb..3494731 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -94,7 +94,7 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) if ((cur = tb[ROUTE_MTU]) != NULL) route->mtu = blobmsg_get_u32(cur); - vlist_add(&ip->route, &route->node, &route->mask); + vlist_add(&ip->route, &route->node, &route->flags); return; error: @@ -105,14 +105,14 @@ static int addr_cmp(const void *k1, const void *k2, void *ptr) { return memcmp(k1, k2, sizeof(struct device_addr) - - offsetof(struct device_addr, mask)); + offsetof(struct device_addr, flags)); } static int route_cmp(const void *k1, const void *k2, void *ptr) { return memcmp(k1, k2, sizeof(struct device_route) - - offsetof(struct device_route, mask)); + offsetof(struct device_route, flags)); } static void diff --git a/interface-ip.h b/interface-ip.h index df5545d..887c62c 100644 --- a/interface-ip.h +++ b/interface-ip.h @@ -23,14 +23,13 @@ union if_addr { struct device_addr { struct vlist_node node; - - enum device_addr_flags flags; bool enabled; /* ipv4 only */ uint32_t broadcast; /* must be last */ + enum device_addr_flags flags; unsigned int mask; union if_addr addr; }; @@ -38,7 +37,6 @@ struct device_addr { struct device_route { struct vlist_node node; - enum device_addr_flags flags; bool enabled; bool keep; @@ -47,6 +45,7 @@ struct device_route { int mtu; /* must be last */ + enum device_addr_flags flags; unsigned int mask; union if_addr addr; }; diff --git a/proto.c b/proto.c index 246d78e..e77b54f 100644 --- a/proto.c +++ b/proto.c @@ -142,7 +142,7 @@ parse_addr(struct interface *iface, const char *str, bool v6, int mask, if (ext) addr->flags |= DEVADDR_EXTERNAL; - vlist_add(&iface->proto_ip.addr, &addr->node, &addr->mask); + vlist_add(&iface->proto_ip.addr, &addr->node, &addr->flags); return true; } @@ -184,7 +184,7 @@ parse_gateway_option(struct interface *iface, struct blob_attr *attr, bool v6) route->mask = 0; route->flags = (v6 ? DEVADDR_INET6 : DEVADDR_INET4); - vlist_add(&iface->proto_ip.route, &route->node, &route->mask); + vlist_add(&iface->proto_ip.route, &route->node, &route->flags); return true; }