From 58d36928da0e3099e17309bd7a44ee442b5f5153 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 26 Feb 2012 16:38:06 +0100 Subject: [PATCH] remove device_{route,addr}->device --- interface-ip.c | 12 ++---------- interface-ip.h | 3 --- system-linux.c | 16 ---------------- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/interface-ip.c b/interface-ip.c index 2088937..93e8723 100644 --- a/interface-ip.c +++ b/interface-ip.c @@ -18,7 +18,6 @@ enum { ROUTE_TARGET, ROUTE_MASK, ROUTE_GATEWAY, - ROUTE_DEVICE, ROUTE_METRIC, ROUTE_MTU, __ROUTE_MAX @@ -29,7 +28,6 @@ static const struct blobmsg_policy route_attr[__ROUTE_MAX] = { [ROUTE_TARGET] = { .name = "target", .type = BLOBMSG_TYPE_STRING }, [ROUTE_MASK] = { .name = "netmask", .type = BLOBMSG_TYPE_STRING }, [ROUTE_GATEWAY] = { .name = "gateway", .type = BLOBMSG_TYPE_STRING }, - [ROUTE_DEVICE] = { .name = "device", .type = BLOBMSG_TYPE_STRING }, [ROUTE_METRIC] = { .name = "metric", .type = BLOBMSG_TYPE_INT32 }, [ROUTE_MTU] = { .name = "mtu", .type = BLOBMSG_TYPE_INT32 }, }; @@ -46,13 +44,9 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) struct blob_attr *tb[__ROUTE_MAX], *cur; struct device_route *route; int af = v6 ? AF_INET6 : AF_INET; - bool config = false; blobmsg_parse(route_attr, __ROUTE_MAX, tb, blobmsg_data(attr), blobmsg_data_len(attr)); - if (!tb[ROUTE_GATEWAY] && !tb[ROUTE_DEVICE]) - return; - if (!iface) { if ((cur = tb[ROUTE_INTERFACE]) == NULL) return; @@ -62,7 +56,6 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) return; ip = &iface->config_ip; - config = true; } else { ip = &iface->proto_ip; } @@ -90,6 +83,8 @@ interface_ip_add_route(struct interface *iface, struct blob_attr *attr, bool v6) DPRINTF("Failed to parse route gateway: %s\n", (char *) blobmsg_data(cur)); goto error; } + } else { + route->flags |= DEVADDR_DEVICE; } if ((cur = tb[ROUTE_METRIC]) != NULL) @@ -100,9 +95,6 @@ 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); - if (!config && (cur = tb[ROUTE_DEVICE]) != NULL) - route->device = device_get(blobmsg_data(cur), true); - vlist_add(&ip->route, &route->node); return; diff --git a/interface-ip.h b/interface-ip.h index 112c61b..f6413ee 100644 --- a/interface-ip.h +++ b/interface-ip.h @@ -27,8 +27,6 @@ struct device_addr { enum device_addr_flags flags; bool enabled; - struct device *device; - /* must be last */ unsigned int mask; union if_addr addr; @@ -42,7 +40,6 @@ struct device_route { bool keep; union if_addr nexthop; - struct device *device; int metric; int mtu; diff --git a/system-linux.c b/system-linux.c index 7f825fa..58ac5d4 100644 --- a/system-linux.c +++ b/system-linux.c @@ -816,14 +816,6 @@ static int system_addr(struct device *dev, struct device_addr *addr, int cmd) struct nl_msg *msg; - dev = addr->device; - if (dev) { - if (!dev->ifindex) - return -1; - - ifa.ifa_index = dev->ifindex; - } - msg = nlmsg_alloc_simple(cmd, 0); if (!msg) return -1; @@ -874,14 +866,6 @@ static int system_rt(struct device *dev, struct device_route *route, int cmd) if (cmd == RTM_NEWROUTE) flags |= NLM_F_CREATE | NLM_F_REPLACE; - dev = route->device; - if (dev) { - if (!dev->ifindex) - return -1; - - ifindex = dev->ifindex; - } - msg = nlmsg_alloc_simple(cmd, flags); if (!msg) return -1; -- 2.11.0