diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-05-04 11:23:55 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-04 11:23:55 -0700 |
commit | 711439b1c3560b916dd5ffcbf906452d1ac960b0 (patch) | |
tree | f5cbc53b348da6a7c22edc033bad6f54c29d7545 /pkg/tcpip/stack/route.go | |
parent | cbc5bef2a66ece1f9e63b213d4dfa616db488df8 (diff) | |
parent | b660f16d18827f0310594c80d9387de11430f15f (diff) |
Merge pull request #2275 from nybidari:iptables
PiperOrigin-RevId: 309783486
Diffstat (limited to 'pkg/tcpip/stack/route.go')
-rw-r--r-- | pkg/tcpip/stack/route.go | 13 |
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, + } +} |