Skip to content

Commit 95ffaac

Browse files
author
Marc Odermatt
committedSep 12, 2024·
passes lint
1 parent b6e5580 commit 95ffaac

File tree

11 files changed

+612
-411
lines changed

11 files changed

+612
-411
lines changed
 

‎daemon/internal/servers/grpc.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -658,19 +658,23 @@ func requestToHostHostMeta(req *sdpb.DRKeyHostHostRequest) (drkey.HostHostMeta,
658658
}, nil
659659
}
660660

661-
func (s *DaemonServer) RemotePolicyDescription(ctx context.Context,
662-
request *experimental.RemotePolicyDescriptionRequest) (
663-
*experimental.RemotePolicyDescriptionResponse, error) {
661+
func (s *DaemonServer) PolicyDescription(ctx context.Context,
662+
request *sdpb.PolicyDescriptionRequest) (
663+
*sdpb.PolicyDescriptionResponse, error) {
664664
conn, err := s.Dialer.Dial(ctx, &snet.SVCAddr{SVC: addr.SvcCS})
665665
if err != nil {
666666
log.FromCtx(ctx).Debug("Dialing CS failed", "err", err)
667667
}
668668
defer conn.Close()
669669
client := experimental.NewFABRIDIntraServiceClient(conn)
670-
response, err := client.RemotePolicyDescription(ctx, request)
670+
response, err := client.RemotePolicyDescription(ctx,
671+
&experimental.RemotePolicyDescriptionRequest{
672+
PolicyIdentifier: request.PolicyIdentifier,
673+
IsdAs: request.IsdAs,
674+
})
671675
if err != nil {
672-
return &experimental.RemotePolicyDescriptionResponse{}, err
676+
return &sdpb.PolicyDescriptionResponse{}, err
673677
}
674678

675-
return response, nil
679+
return &sdpb.PolicyDescriptionResponse{Description: response.Description}, nil
676680
}

‎doc/command/scion/scion.rst

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SEE ALSO
2525

2626
* :ref:`scion address <scion_address>` - Show (one of) this host's SCION address(es)
2727
* :ref:`scion completion <scion_completion>` - Generate the autocompletion script for the specified shell
28+
* :ref:`scion fabrid <scion_fabrid>` - Display FABRID policy information
2829
* :ref:`scion ping <scion_ping>` - Test connectivity to a remote SCION host using SCMP echo packets
2930
* :ref:`scion showpaths <scion_showpaths>` - Display paths to a SCION AS
3031
* :ref:`scion traceroute <scion_traceroute>` - Trace the SCION route to a remote SCION AS using SCMP traceroute packets

‎doc/command/scion/scion_fabrid.rst

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
:orphan:
2+
3+
.. _scion_fabrid:
4+
5+
scion fabrid
6+
------------
7+
8+
Display FABRID policy information
9+
10+
Synopsis
11+
~~~~~~~~
12+
13+
14+
'fabrid' lists available policies at a remote AS, or shows the
15+
description of a specific policy.
16+
17+
::
18+
19+
scion fabrid [flags]
20+
21+
Examples
22+
~~~~~~~~
23+
24+
::
25+
26+
scion showpaths 1-ff00:0:110 --extended
27+
scion showpaths 1-ff00:0:110 --local 127.0.0.55 --json
28+
scion showpaths 1-ff00:0:111 --sequence="0-0#2 0*" # outgoing IfID=2
29+
scion showpaths 1-ff00:0:111 --sequence="0* 0-0#41" # incoming IfID=41 at dstIA
30+
scion showpaths 1-ff00:0:111 --sequence="0* 1-ff00:0:112 0*" # 1-ff00:0:112 on the path
31+
scion showpaths 1-ff00:0:110 --no-probe
32+
33+
Options
34+
~~~~~~~
35+
36+
::
37+
38+
--epic Enable EPIC.
39+
-e, --extended Show extended path meta data information
40+
--format string Specify the output format (human|json|yaml) (default "human")
41+
-h, --help help for fabrid
42+
--isd-as isd-as The local ISD-AS to use. (default 0-0)
43+
-l, --local ip Local IP address to listen on. (default invalid IP)
44+
--log.level string Console logging level verbosity (debug|info|error)
45+
-m, --maxpaths int Maximum number of paths that are displayed (default 10)
46+
--no-color disable colored output
47+
--no-probe Do not probe the paths and print the health status
48+
-r, --refresh Set refresh flag for SCION Daemon path request
49+
--sciond string SCION Daemon address. (default "127.0.0.1:30255")
50+
--sequence string Space separated list of hop predicates
51+
--timeout duration Timeout (default 5s)
52+
--tracing.agent string Tracing agent address
53+
54+
SEE ALSO
55+
~~~~~~~~
56+
57+
* :ref:`scion <scion>` - SCION networking utilities.
58+

‎pkg/daemon/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ go_library(
2121
"//pkg/private/ctrl/path_mgmt:go_default_library",
2222
"//pkg/private/prom:go_default_library",
2323
"//pkg/private/serrors:go_default_library",
24-
"//pkg/proto/control_plane/experimental:go_default_library",
2524
"//pkg/proto/daemon:go_default_library",
2625
"//pkg/proto/drkey:go_default_library",
2726
"//pkg/scrypto/cppki:go_default_library",

‎pkg/daemon/grpc.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"github.com/scionproto/scion/pkg/private/common"
3232
"github.com/scionproto/scion/pkg/private/ctrl/path_mgmt"
3333
"github.com/scionproto/scion/pkg/private/serrors"
34-
cppb "github.com/scionproto/scion/pkg/proto/control_plane/experimental"
3534
sdpb "github.com/scionproto/scion/pkg/proto/daemon"
3635
dkpb "github.com/scionproto/scion/pkg/proto/drkey"
3736
"github.com/scionproto/scion/pkg/scrypto/cppki"
@@ -282,7 +281,7 @@ func (c grpcConn) RemotePolicyDescription(ctx context.Context,
282281
identifier uint32, ia addr.IA) (string, error) {
283282

284283
client := sdpb.NewDaemonServiceClient(c.conn)
285-
response, err := client.RemotePolicyDescription(ctx, &cppb.RemotePolicyDescriptionRequest{
284+
response, err := client.PolicyDescription(ctx, &sdpb.PolicyDescriptionRequest{
286285
PolicyIdentifier: identifier,
287286
IsdAs: uint64(ia),
288287
})

‎pkg/proto/daemon/daemon.pb.go

+520-387
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎proto/daemon/v1/daemon.proto

+16-5
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ service DaemonService {
4848
rpc DRKeyHostHost (DRKeyHostHostRequest) returns (DRKeyHostHostResponse) {}
4949
// FabridKeys returns the DRKeys for FABRID
5050
rpc FabridKeys (FabridKeysRequest) returns (FabridKeysResponse) {}
51-
// Used by a host inside the AS to request a policy description for another AS. The control
52-
// service will request the policy description from the remote AS if it is unknown to the
53-
// control service.
54-
rpc RemotePolicyDescription(proto.control_plane.experimental.v1.RemotePolicyDescriptionRequest) returns
55-
(proto.control_plane.experimental.v1.RemotePolicyDescriptionResponse) {}
51+
// Used by a host inside the AS to request a policy description. Global policies are fetched
52+
// from GitHub, non-global policies are handled by the control service.
53+
rpc PolicyDescription(PolicyDescriptionRequest) returns
54+
(PolicyDescriptionResponse) {}
5655
}
5756

5857
message PathsRequest {
@@ -178,6 +177,18 @@ message FabridKeysResponse {
178177
optional FabridKeyResponse host_host_key = 2;
179178
}
180179

180+
message PolicyDescriptionRequest {
181+
// The identifier for the policy
182+
uint32 policy_identifier = 1;
183+
// Remote ISD-AS of the non-global policy identifier
184+
uint64 isd_as = 2;
185+
}
186+
187+
message PolicyDescriptionResponse {
188+
// A description of the local policy.
189+
string description = 1;
190+
}
191+
181192
message EpicAuths {
182193
// AuthPHVF is the authenticator use to calculate the PHVF.
183194
bytes auth_phvf = 1;

‎scion/cmd/scion/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ go_library(
66
srcs = [
77
"address.go",
88
"common.go",
9+
"fabrid.go",
910
"gendocs.go",
1011
"main.go",
1112
"observability.go",
1213
"ping.go",
1314
"showpaths.go",
1415
"traceroute.go",
15-
"fabrid.go",
1616
],
1717
importpath = "github.com/scionproto/scion/scion/cmd/scion",
1818
visibility = ["//visibility:private"],

‎scion/cmd/scion/fabrid.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ import (
2121
"strconv"
2222
"time"
2323

24+
"github.com/spf13/cobra"
25+
2426
"github.com/scionproto/scion/pkg/addr"
2527
"github.com/scionproto/scion/pkg/log"
2628
"github.com/scionproto/scion/pkg/private/serrors"
2729
"github.com/scionproto/scion/private/app"
2830
"github.com/scionproto/scion/private/app/flag"
2931
"github.com/scionproto/scion/private/tracing"
3032
"github.com/scionproto/scion/scion/fabrid"
31-
"github.com/spf13/cobra"
3233
)
3334

3435
func newFabrid(pather CommandPather) *cobra.Command {

‎scion/fabrid/BUILD.bazel

-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ go_library(
1111
deps = [
1212
"//pkg/addr:go_default_library",
1313
"//pkg/daemon:go_default_library",
14-
"//pkg/private/common:go_default_library",
1514
"//pkg/private/serrors:go_default_library",
16-
"//pkg/snet:go_default_library",
17-
"//private/app/path:go_default_library",
18-
"//private/app/path/pathprobe:go_default_library",
19-
"//private/path/pathpol:go_default_library",
2015
],
2116
)

‎scion/fabrid/fabrid.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ import (
1818
"context"
1919
"encoding/json"
2020
"fmt"
21+
"io/ioutil"
22+
"net/http"
23+
2124
"github.com/scionproto/scion/pkg/addr"
2225
"github.com/scionproto/scion/pkg/daemon"
2326
"github.com/scionproto/scion/pkg/private/serrors"
24-
"io/ioutil"
25-
"net/http"
2627
)
2728

2829
// Result contains all the discovered paths.
@@ -46,7 +47,6 @@ func Run(ctx context.Context, dst *addr.IA, identifier uint32, cfg Config) (*Res
4647
return nil, serrors.WrapStr("retrieving description from the SCION Daemon", err)
4748
}
4849
} else {
49-
// Replace with the raw URL of your GitHub content (e.g., https://raw.githubusercontent.com/user/repo/branch/path/to/policies.json)
5050
globalPolicyURL := "https://raw.githubusercontent.com/marcodermatt/fabrid-global-policies/main/policy-descriptions.json"
5151

5252
// Fetch the global policy from the URL

0 commit comments

Comments
 (0)
Please sign in to comment.