diff options
author | Paul Stewart <pstew@chromium.org> | 2012-04-24 13:11:28 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-04-25 12:50:13 -0700 |
commit | e93b038972d43fd703b3c68603fb4d02bec6504e (patch) | |
tree | 1c8d43d238604bfa01f4bdcdf26940a96ad70e12 /routing_table_entry.h | |
parent | ff14b0261ac867f98b96db9ba39490fd70269fcd (diff) | |
download | shill-e93b038972d43fd703b3c68603fb4d02bec6504e.tar.gz |
shill: Connection: UnPin routes on destruction
Tag pinned routes with the interface index associated with the request,
so they can be removed when the connection is destroyed. Also move
PinHostRoute() out of the VPN code and into the Connection.
BUG=chromium-os:29911
TEST=New unit tests
Change-Id: I46019255276469929642db4a6395e64f53e3b7d5
Reviewed-on: https://gerrit.chromium.org/gerrit/20982
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Diffstat (limited to 'routing_table_entry.h')
-rw-r--r-- | routing_table_entry.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/routing_table_entry.h b/routing_table_entry.h index 9cf41de6..8a42de73 100644 --- a/routing_table_entry.h +++ b/routing_table_entry.h @@ -16,13 +16,16 @@ namespace shill { // operator=. struct RoutingTableEntry { public: + static const int kDefaultTag = -1; + RoutingTableEntry() : dst(IPAddress::kFamilyUnknown), src(IPAddress::kFamilyUnknown), gateway(IPAddress::kFamilyUnknown), metric(0), scope(0), - from_rtnl(false) {} + from_rtnl(false), + tag(kDefaultTag) {} RoutingTableEntry(const IPAddress &dst_in, const IPAddress &src_in, @@ -35,7 +38,23 @@ struct RoutingTableEntry { gateway(gateway_in), metric(metric_in), scope(scope_in), - from_rtnl(from_rtnl_in) {} + from_rtnl(from_rtnl_in), + tag(kDefaultTag) {} + + RoutingTableEntry(const IPAddress &dst_in, + const IPAddress &src_in, + const IPAddress &gateway_in, + uint32 metric_in, + unsigned char scope_in, + bool from_rtnl_in, + int tag_in) + : dst(dst_in), + src(src_in), + gateway(gateway_in), + metric(metric_in), + scope(scope_in), + from_rtnl(from_rtnl_in), + tag(tag_in) {} RoutingTableEntry(const RoutingTableEntry &b) : dst(b.dst), @@ -43,7 +62,8 @@ struct RoutingTableEntry { gateway(b.gateway), metric(b.metric), scope(b.scope), - from_rtnl(b.from_rtnl) {} + from_rtnl(b.from_rtnl), + tag(b.tag) {} RoutingTableEntry &operator=(const RoutingTableEntry &b) { dst = b.dst; @@ -52,6 +72,7 @@ struct RoutingTableEntry { metric = b.metric; scope = b.scope; from_rtnl = b.from_rtnl; + tag = b.tag; return *this; } @@ -64,7 +85,8 @@ struct RoutingTableEntry { gateway.Equals(b.gateway) && metric == b.metric && scope == b.scope && - from_rtnl == b.from_rtnl); + from_rtnl == b.from_rtnl && + tag == b.tag); } IPAddress dst; @@ -73,6 +95,7 @@ struct RoutingTableEntry { uint32 metric; unsigned char scope; bool from_rtnl; + int tag; }; } // namespace shill |