Skip to content

Commit

Permalink
Merge branch 'master' into oncilla-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
oncilla authored Jul 12, 2023
2 parents 4c37b0c + 9f77b13 commit d629c90
Show file tree
Hide file tree
Showing 125 changed files with 1,527 additions and 1,104 deletions.
2 changes: 1 addition & 1 deletion control/beaconing/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (

// Pather computes the remote address with a path based on the provided segment.
type Pather interface {
GetPath(svc addr.HostSVC, ps *seg.PathSegment) (*snet.SVCAddr, error)
GetPath(svc addr.SVC, ps *seg.PathSegment) (*snet.SVCAddr, error)
}

// SegmentProvider provides segments to register for the specified type.
Expand Down
1 change: 0 additions & 1 deletion control/config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ go_library(
importpath = "github.com/scionproto/scion/control/config",
visibility = ["//visibility:public"],
deps = [
"//pkg/addr:go_default_library",
"//pkg/drkey:go_default_library",
"//pkg/log:go_default_library",
"//pkg/private/serrors:go_default_library",
Expand Down
3 changes: 1 addition & 2 deletions control/config/drkey.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"strings"
"time"

"github.com/scionproto/scion/pkg/addr"
"github.com/scionproto/scion/pkg/drkey"
"github.com/scionproto/scion/pkg/private/serrors"
"github.com/scionproto/scion/private/config"
Expand Down Expand Up @@ -118,7 +117,7 @@ func (cfg *SecretValueHostList) Validate() error {
return serrors.New("GENERIC protocol is not allowed")
}
for _, ip := range list {
if h := addr.HostFromIPStr(ip); h == nil {
if _, err := netip.ParseAddr(ip); err != nil {
return serrors.New("Syntax error: not a valid address", "ip", ip)
}
}
Expand Down
12 changes: 6 additions & 6 deletions control/drkey/grpc/drkey_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func validateASHostReq(meta drkey.ASHostMeta, localIA addr.IA, peerAddr net.Addr
return serrors.New("invalid request, req.dstIA != localIA",
"request_dst_isd_as", meta.DstIA, "local_isd_as", localIA)
}
dstHost := addr.HostFromIPStr(meta.DstHost)
dstHost := net.ParseIP(meta.DstHost)
if !hostAddr.Equal(dstHost) {
return serrors.New("invalid request, dst_host != remote host",
"dst_host", dstHost, "remote_host", hostAddr)
Expand All @@ -320,7 +320,7 @@ func validateHostASReq(meta drkey.HostASMeta, localIA addr.IA, peerAddr net.Addr
return serrors.New("invalid request, req.SrcIA != localIA",
"request_src_isd_as", meta.SrcIA, "local_isd_as", localIA)
}
srcHost := addr.HostFromIPStr(meta.SrcHost)
srcHost := net.ParseIP(meta.SrcHost)
if !hostAddr.Equal(srcHost) {
return serrors.New("invalid request, src_host != remote host",
"src_host", srcHost, "remote_host", hostAddr)
Expand All @@ -335,8 +335,8 @@ func validateHostHostReq(meta drkey.HostHostMeta, localIA addr.IA, peerAddr net.
if err != nil {
return err
}
srcHost := addr.HostFromIPStr(meta.SrcHost)
dstHost := addr.HostFromIPStr(meta.DstHost)
srcHost := net.ParseIP(meta.SrcHost)
dstHost := net.ParseIP(meta.DstHost)

if !((meta.SrcIA.Equal(localIA) && hostAddr.Equal(srcHost)) ||
(meta.DstIA.Equal(localIA) && hostAddr.Equal(dstHost))) {
Expand All @@ -353,13 +353,13 @@ func validateHostHostReq(meta drkey.HostHostMeta, localIA addr.IA, peerAddr net.
return nil
}

func hostAddrFromPeer(peerAddr net.Addr) (addr.HostAddr, error) {
func hostAddrFromPeer(peerAddr net.Addr) (net.IP, error) {
tcpAddr, ok := peerAddr.(*net.TCPAddr)
if !ok {
return nil, serrors.New("invalid peer address type, expected *net.TCPAddr",
"peer", peerAddr, "type", common.TypeOf(peerAddr))
}
return addr.HostFromIP(tcpAddr.IP), nil
return tcpAddr.IP, nil
}

func getMeta(protoId drkeypb.Protocol, ts *timestamppb.Timestamp, srcIA,
Expand Down
2 changes: 1 addition & 1 deletion control/onehop/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Addr struct {
// Egress is the interface over which the remote AS should be reached.
Egress uint16
// SVC is the service anycast address of the designated service in the remote AS.
SVC addr.HostSVC
SVC addr.SVC
// NextHop is the router that owns the egress interface.
NextHop *net.UDPAddr
}
Expand Down
2 changes: 1 addition & 1 deletion control/segreq/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (

// Pather computes the remote address with a path based on the provided segment.
type Pather interface {
GetPath(svc addr.HostSVC, ps *seg.PathSegment) (*snet.SVCAddr, error)
GetPath(svc addr.SVC, ps *seg.PathSegment) (*snet.SVCAddr, error)
}

// CoreChecker checks whether a given ia is core.
Expand Down
2 changes: 1 addition & 1 deletion daemon/cmd/daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func realMain(ctx context.Context) error {
defer rcCleaner.Stop()

dialer := &libgrpc.TCPDialer{
SvcResolver: func(dst addr.HostSVC) []resolver.Address {
SvcResolver: func(dst addr.SVC) []resolver.Address {
if base := dst.Base(); base != addr.SvcCS {
panic("Unsupported address type, implementation error?")
}
Expand Down
1 change: 1 addition & 0 deletions daemon/drkey/grpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ go_library(
"//pkg/proto/control_plane:go_default_library",
"//pkg/proto/drkey:go_default_library",
"//pkg/scrypto/cppki:go_default_library",
"//pkg/snet:go_default_library",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
],
)
Expand Down
7 changes: 4 additions & 3 deletions daemon/drkey/grpc/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
sc_grpc "github.com/scionproto/scion/pkg/grpc"
"github.com/scionproto/scion/pkg/private/serrors"
cppb "github.com/scionproto/scion/pkg/proto/control_plane"
"github.com/scionproto/scion/pkg/snet"
)

// Fetcher obtains end-host key from the local CS.
Expand All @@ -34,7 +35,7 @@ func (f *Fetcher) ASHostKey(
meta drkey.ASHostMeta,
) (drkey.ASHostKey, error) {

conn, err := f.Dialer.Dial(ctx, addr.SvcCS)
conn, err := f.Dialer.Dial(ctx, &snet.SVCAddr{SVC: addr.SvcCS})
if err != nil {
return drkey.ASHostKey{}, serrors.WrapStr("dialing", err)
}
Expand All @@ -59,7 +60,7 @@ func (f *Fetcher) HostASKey(
meta drkey.HostASMeta,
) (drkey.HostASKey, error) {

conn, err := f.Dialer.Dial(ctx, addr.SvcCS)
conn, err := f.Dialer.Dial(ctx, &snet.SVCAddr{SVC: addr.SvcCS})
if err != nil {
return drkey.HostASKey{}, serrors.WrapStr("dialing", err)
}
Expand All @@ -84,7 +85,7 @@ func (f *Fetcher) HostHostKey(
meta drkey.HostHostMeta,
) (drkey.HostHostKey, error) {

conn, err := f.Dialer.Dial(ctx, addr.SvcCS)
conn, err := f.Dialer.Dial(ctx, &snet.SVCAddr{SVC: addr.SvcCS})
if err != nil {
return drkey.HostHostKey{}, serrors.WrapStr("dialing", err)
}
Expand Down
2 changes: 1 addition & 1 deletion daemon/fetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type dstProvider struct {
}

func (r *dstProvider) Dst(_ context.Context, _ segfetcher.Request) (net.Addr, error) {
return addr.SvcCS, nil
return &snet.SVCAddr{SVC: addr.SvcCS}, nil
}

type neverLocal struct{}
Expand Down
Loading

0 comments on commit d629c90

Please sign in to comment.