Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prototype: drop SVC resolution #4387

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions control/beaconing/grpc/creation_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,9 @@ func extractIngressIfID(path snet.DataplanePath) (uint16, error) {
if !ok {
return 0, serrors.New("unexpected path", "type", common.TypeOf(path))
}
rawScionPath, ok := invertedPath.Path.(*scion.Raw)
rawScionPath, ok := invertedPath.Path.(*scion.Decoded)
if !ok {
return 0, serrors.New("unexpected path", "type", common.TypeOf(path))
}
hf, err := rawScionPath.GetCurrentHopField()
if err != nil {
return 0, serrors.WrapStr("getting current hop field", err)
return 0, serrors.New("unexpected path", "type", common.TypeOf(invertedPath.Path))
}
return hf.ConsIngress, nil
return rawScionPath.HopFields[0].ConsIngress, nil
}
5 changes: 3 additions & 2 deletions control/onehop/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ func (r *AddressRewriter) RedirectToQUIC(
) (net.Addr, bool, error) {
a, ok := address.(*Addr)
if !ok {
return r.Rewriter.RedirectToQUIC(ctx, address)
return address, false, nil
//return r.Rewriter.RedirectToQUIC(ctx, address)
}
path, err := r.getPath(a.Egress)
if err != nil {
Expand All @@ -76,7 +77,7 @@ func (r *AddressRewriter) RedirectToQUIC(
SVC: addr.SvcCS,
NextHop: a.NextHop,
}
return r.Rewriter.RedirectToQUIC(ctx, svc)
return svc, false, nil
}

func (r *AddressRewriter) getPath(egress uint16) (path.OneHop, error) {
Expand Down
1 change: 0 additions & 1 deletion pkg/grpc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ go_library(
deps = [
"//pkg/addr:go_default_library",
"//pkg/log:go_default_library",
"//pkg/private/common:go_default_library",
"//pkg/private/serrors:go_default_library",
"//pkg/snet:go_default_library",
"@com_github_grpc_ecosystem_go_grpc_middleware//retry:go_default_library",
Expand Down
5 changes: 0 additions & 5 deletions pkg/grpc/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"google.golang.org/grpc/resolver/manual"

"github.com/scionproto/scion/pkg/addr"
"github.com/scionproto/scion/pkg/private/common"
"github.com/scionproto/scion/pkg/private/serrors"
"github.com/scionproto/scion/pkg/snet"
)
Expand Down Expand Up @@ -147,10 +146,6 @@ func (d *QUICDialer) Dial(ctx context.Context, addr net.Addr) (*grpc.ClientConn,
if err != nil {
return nil, serrors.WrapStr("resolving SVC address", err)
}
if _, ok := addr.(*snet.UDPAddr); !ok {
return nil, serrors.New("wrong address type after svc resolution",
"type", common.TypeOf(addr))
}
dialer := func(context.Context, string) (net.Conn, error) {
return d.Dialer.Dial(ctx, addr)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/snet/squic/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ func computeAddressStr(address net.Addr) string {
if v, ok := address.(*snet.UDPAddr); ok {
return fmt.Sprintf("[%s,%s]:%d", v.IA, v.Host.IP, v.Host.Port)
}
if v, ok := address.(*snet.SVCAddr); ok {
return fmt.Sprintf("[%s,%s]:0", v.IA, v.SVC)
}
return address.String()
}

Expand Down
37 changes: 1 addition & 36 deletions private/app/appnet/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package appnet

import (
"context"
"errors"
"fmt"
"net"
"time"
Expand Down Expand Up @@ -72,7 +71,6 @@ type AddressRewriter struct {
// If the address is already unicast, no redirection to QUIC is attempted.
func (r AddressRewriter) RedirectToQUIC(ctx context.Context,
address net.Addr) (net.Addr, bool, error) {
logger := log.FromCtx(ctx)

// FIXME(scrye): This is not legitimate use. It's only included for
// compatibility with older unit tests. See
Expand All @@ -85,40 +83,7 @@ func (r AddressRewriter) RedirectToQUIC(ctx context.Context,
case *snet.UDPAddr:
return a, false, nil
case *snet.SVCAddr:
fa, err := r.buildFullAddress(ctx, a)
if err != nil {
return nil, false, err
}
if r.SVCResolutionFraction <= 0.0 {
return fa, false, nil
}

path, err := fa.GetPath()
if err != nil {
return nil, false, serrors.WrapStr("bad path", err)
}

// During One-Hop Path operation, use SVC resolution to also bootstrap the path.
p, u, quicRedirect, err := r.resolveSVC(ctx, path, fa.SVC)
if err != nil {
// For a revoked path we don't fallback we want to give the option
// to retry with a new path.
isRevokedPath := func(err error) bool {
var opErr *snet.OpError
return errors.As(err, &opErr) && opErr.RevInfo() != nil
}
if r.SVCResolutionFraction < 1.0 && !isRevokedPath(err) {
// SVC resolution failed but we allow legacy behavior and have some
// fraction of the timeout left for data transfers, so return
// address with SVC destination still set
logger.Debug("Falling back to legacy mode, ignore error", "err", err)
return fa, false, nil
}
return a, false, err
}

ret := &snet.UDPAddr{IA: fa.IA, Path: p.Dataplane(), NextHop: fa.NextHop, Host: u}
return ret, quicRedirect, err
return a, false, nil
}

return nil, false, serrors.New("address type not supported",
Expand Down
4 changes: 2 additions & 2 deletions private/app/appnet/infraenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (nc *NetworkConfig) initSvcRedirect(quicAddress string) (func(), error) {
// address nor the port are needed to address the resolver, but the dispatcher still
// requires them and checks unicity. At least a dynamic port is allowed.
srAddr := &net.UDPAddr{IP: nc.Public.IP, Port: 0}
conn, err := network.Listen(context.Background(), "udp", srAddr, addr.SvcWildcard)
conn, err := network.Listen(context.Background(), "udp", srAddr, addr.SvcNone)
if err != nil {
log.Info("Listen failed", "err", err)
return nil, serrors.WrapStr("listening on SCION", err, "addr", srAddr)
Expand Down Expand Up @@ -328,7 +328,7 @@ func (nc *NetworkConfig) initQUICSockets() (net.PacketConn, net.PacketConn, erro
if err != nil {
return nil, nil, serrors.WrapStr("parsing server QUIC address", err)
}
server, err := serverNet.Listen(context.Background(), "udp", serverAddr, addr.SvcNone)
server, err := serverNet.Listen(context.Background(), "udp", serverAddr, addr.SvcWildcard)
if err != nil {
return nil, nil, serrors.WrapStr("creating server connection", err)
}
Expand Down