Skip to content

Commit

Permalink
r1
Browse files Browse the repository at this point in the history
  • Loading branch information
lukedirtwalker committed Oct 21, 2020
1 parent 8ae367c commit 3b2ed55
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 26 deletions.
18 changes: 7 additions & 11 deletions go/cs/beaconing/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestHandlerHandleBeacon(t *testing.T) {
Peer: func() *snet.UDPAddr {
return &snet.UDPAddr{
IA: addr.IA{},
Path: testPath(localIF),
Path: spath.Path{},
}
},
Assertion: assert.NoError,
Expand All @@ -110,7 +110,7 @@ func TestHandlerHandleBeacon(t *testing.T) {
Peer: func() *snet.UDPAddr {
return &snet.UDPAddr{
IA: addr.IA{},
Path: testPath(12),
Path: spath.Path{},
}
},
Assertion: assert.Error,
Expand All @@ -136,7 +136,7 @@ func TestHandlerHandleBeacon(t *testing.T) {
Peer: func() *snet.UDPAddr {
return &snet.UDPAddr{
IA: addr.IA{},
Path: testPath(42),
Path: spath.Path{},
}
},
Assertion: assert.Error,
Expand Down Expand Up @@ -165,7 +165,7 @@ func TestHandlerHandleBeacon(t *testing.T) {
Peer: func() *snet.UDPAddr {
return &snet.UDPAddr{
IA: addr.IA{},
Path: testPath(localIF),
Path: spath.Path{},
}
},
Assertion: assert.Error,
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestHandlerHandleBeacon(t *testing.T) {
Peer: func() *snet.UDPAddr {
return &snet.UDPAddr{
IA: addr.IA{},
Path: testPath(localIF),
Path: spath.Path{},
}
},
Assertion: assert.Error,
Expand All @@ -218,7 +218,7 @@ func TestHandlerHandleBeacon(t *testing.T) {
Peer: func() *snet.UDPAddr {
return &snet.UDPAddr{
IA: addr.IA{},
Path: testPath(localIF),
Path: spath.Path{},
}
},
Assertion: assert.Error,
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestHandlerHandleBeacon(t *testing.T) {
Peer: func() *snet.UDPAddr {
return &snet.UDPAddr{
IA: addr.IA{},
Path: testPath(localIF),
Path: spath.Path{},
}
},
Assertion: assert.Error,
Expand Down Expand Up @@ -280,10 +280,6 @@ func testSegment(g *graph.Graph, ifids []common.IFIDType) *seg.PathSegment {
return pseg
}

func testPath(ingressIfid common.IFIDType) spath.Path {
return spath.Path{}
}

func testInterfaces(topo topology.Topology) *ifstate.Interfaces {
intfs := ifstate.NewInterfaces(topo.IFInfoMap(), ifstate.Config{})
intfs.Get(graph.If_110_X_120_A).Activate(graph.If_120_A_110_X)
Expand Down
5 changes: 1 addition & 4 deletions go/lib/snet/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ func (p *partialPath) UnderlayNextHop() *net.UDPAddr {
}

func (p *partialPath) Path() spath.Path {
return spath.Path{
Raw: append(p.spath.Raw[:0:0], p.spath.Raw...),
Type: p.spath.Type,
}
return p.spath.Copy()
}

func (p *partialPath) Interfaces() []PathInterface {
Expand Down
5 changes: 1 addition & 4 deletions go/lib/snet/path/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ func (p Path) UnderlayNextHop() *net.UDPAddr {
}

func (p Path) Path() spath.Path {
return spath.Path{
Raw: append(p.SPath.Raw[:0:0], p.SPath.Raw...),
Type: p.SPath.Type,
}
return p.SPath.Copy()
}

func (p Path) Interfaces() []snet.PathInterface {
Expand Down
5 changes: 1 addition & 4 deletions go/lib/svc/svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ func (h *BaseHandler) Handle(request *Request) (Result, error) {

func (h *BaseHandler) reversePath(path spath.Path) (spath.Path, error) {
// Reverse copy to not modify input packet
path = spath.Path{
Raw: append(path.Raw[:0:0], path.Raw...),
Type: path.Type,
}
path = path.Copy()
if err := path.Reverse(); err != nil {
return path, err
}
Expand Down
1 change: 0 additions & 1 deletion go/pkg/traceroute/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ go_library(
"//go/lib/slayers/path/scion:go_default_library",
"//go/lib/snet:go_default_library",
"//go/lib/sock/reliable:go_default_library",
"//go/lib/spath:go_default_library",
],
)
3 changes: 1 addition & 2 deletions go/pkg/traceroute/traceroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/scionproto/scion/go/lib/slayers/path/scion"
"github.com/scionproto/scion/go/lib/snet"
"github.com/scionproto/scion/go/lib/sock/reliable"
"github.com/scionproto/scion/go/lib/spath"
)

// Update contains the information for a single hop.
Expand Down Expand Up @@ -291,7 +290,7 @@ func (h scmpHandler) Handle(pkt *snet.Packet) error {
Remote: &snet.UDPAddr{
IA: pkt.Source.IA,
Host: &net.UDPAddr{IP: pkt.Destination.Host.IP()},
Path: spath.Path{Raw: append(pkt.Path.Raw[:0:0], pkt.Path.Raw...), Type: pkt.Path.Type},
Path: pkt.Path.Copy(),
},
Error: err,
}
Expand Down

0 comments on commit 3b2ed55

Please sign in to comment.