summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-04-29 13:58:41 +0200
committerFelix Fietkau <nbd@openwrt.org>2012-04-29 14:02:24 +0200
commit0f738b8f6c5d89ad5130c74a8dcb9a1df9a190bc (patch)
tree6e3c3bc9dd4d0bb19cec73ce2b1b0d218a21f861
parent8a1a1dda9cfff45a7cd48f5d108d0174fadd84ee (diff)
include route/address flags in vlist comparison
-rw-r--r--interface-ip.c6
-rw-r--r--interface-ip.h5
-rw-r--r--proto.c4
3 files changed, 7 insertions, 8 deletions
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;
}