summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/route.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-05-04 18:27:04 +0000
committergVisor bot <gvisor-bot@google.com>2020-05-04 18:27:04 +0000
commit72392231ba7daaa5ce21e78cc251e707cd88437c (patch)
tree781983bafcda0c54f27355757c87480d435618c3 /pkg/tcpip/stack/route.go
parent23c3b58f2d7ade5f9aa1e8c545223941ded690e4 (diff)
parent711439b1c3560b916dd5ffcbf906452d1ac960b0 (diff)
Merge release-20200422.0-18-g711439b (automated)
Diffstat (limited to 'pkg/tcpip/stack/route.go')
-rw-r--r--pkg/tcpip/stack/route.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/route.go b/pkg/tcpip/stack/route.go
index 53148dc03..150297ab9 100644
--- a/pkg/tcpip/stack/route.go
+++ b/pkg/tcpip/stack/route.go
@@ -261,3 +261,16 @@ func (r *Route) MakeLoopedRoute() Route {
func (r *Route) Stack() *Stack {
return r.ref.stack()
}
+
+// ReverseRoute returns new route with given source and destination address.
+func (r *Route) ReverseRoute(src tcpip.Address, dst tcpip.Address) Route {
+ return Route{
+ NetProto: r.NetProto,
+ LocalAddress: dst,
+ LocalLinkAddress: r.RemoteLinkAddress,
+ RemoteAddress: src,
+ RemoteLinkAddress: r.LocalLinkAddress,
+ ref: r.ref,
+ Loop: r.Loop,
+ }
+}