Skip to content

Commit

Permalink
Merge branch 'master' into fix-typos-1
Browse files Browse the repository at this point in the history
  • Loading branch information
matzf authored Oct 12, 2023
2 parents f0d38d5 + 44c2f67 commit a260930
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 13 deletions.
3 changes: 3 additions & 0 deletions acceptance/router_multi/conf/br.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
id = "brA"
config_dir = "/share/conf"

[features]
experimental_scmp_authentication = true

[log]
[log.console]
level = "debug"
19 changes: 15 additions & 4 deletions doc/manuals/router.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ Environment Variables
.. object:: SCION_TESTING_DRKEY_EPOCH_DURATION

For **testing only**.
This option relates to :ref:`DRKey-based authentication of SCMPs <scmp-authentication>` in the
router, which is **experimental** and currently **incomplete**.
This option relates :option:`features.experimental_scmp_authentication <router-conf-toml features.experimental_scmp_authentication>`.

Override the global duration for :doc:`/cryptography/drkey` epochs.

Expand All @@ -113,8 +112,7 @@ Environment Variables
.. envvar:: SCION_TESTING_ACCEPTANCE_WINDOW

For **testing only**.
This option relates to :ref:`DRKey-based authentication of SCMPs <scmp-authentication>` in the
router, which is **experimental** and currently **incomplete**.
This option relates :option:`features.experimental_scmp_authentication <router-conf-toml features.experimental_scmp_authentication>`.

Defines the length of the window around the current time for which SCMP authentication timestamps
are accepted. See :ref:`SPAO specification <spao-absTime>`.
Expand Down Expand Up @@ -158,6 +156,19 @@ considers the following options.
If this is a relative path, it is interpreted as relative to the current working directory of the
program (i.e. **not** relative to the location of this .toml configuration file).

.. object:: features

Features is a container for generic, boolean feature flags (usually for experimental or
transitional features).

.. option:: features.experimental_scmp_authentication = <bool> (Default: false)

Enable the :ref:`DRKey-based authentication of SCMPs <scmp-authentication>` in the
router, which is **experimental** and currently **incomplete**.

When enabled, the router inserts the :ref:`authenticator-option` for SCMP messages.
For now, the MAC is computed based on a dummy key, and consequently is not practically useful.

.. object:: router

.. option:: router.receive_buffer_size = <int> (Default: 0)
Expand Down
9 changes: 9 additions & 0 deletions private/env/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ type Features struct {

// Example:
// DanceAtMidnight bool `toml:"dance_at_midnight,omitempty"`

// ExperimentalSCMPAuthentication enables experimental, DRKey-based
// authentication of SCMP messages.
//
// When enabled, the router inserts the SPAO authenticator for SCMP error messages,
// generated with a dummy key!
//
// Experimental: This field is experimental and will be subject to change.
ExperimentalSCMPAuthentication bool `toml:"experimental_scmp_authentication"`
}

func (cfg *Features) Sample(dst io.Writer, path config.Path, ctx config.CtxMap) {
Expand Down
3 changes: 2 additions & 1 deletion router/cmd/router/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ func realMain(ctx context.Context) error {
metrics := router.NewMetrics()
dp := &router.Connector{
DataPlane: router.DataPlane{
Metrics: metrics,
Metrics: metrics,
ExperimentalSCMPAuthentication: globalCfg.Features.ExperimentalSCMPAuthentication,
},
ReceiveBufferSize: globalCfg.Router.ReceiveBufferSize,
SendBufferSize: globalCfg.Router.SendBufferSize,
Expand Down
21 changes: 13 additions & 8 deletions router/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ type DataPlane struct {
Metrics *Metrics
forwardingMetrics map[uint16]forwardingMetrics

ExperimentalSCMPAuthentication bool

// The pool that stores all the packet buffers as described in the design document. See
// https://github.com/scionproto/scion/blob/master/doc/dev/design/BorderRouter.rst
packetPool chan []byte
Expand Down Expand Up @@ -2153,14 +2155,17 @@ func (p *slowPathPacketProcessor) prepareSCMP(
scmpH := slayers.SCMP{TypeCode: typeCode}
scmpH.SetNetworkLayerForChecksum(&scionL)

// Error messages must be authenticated.
// Traceroute are OPTIONALLY authenticated ONLY IF the request
// was authenticated.
// TODO(JordiSubira): Reuse the key computed in p.hasValidAuth
// if SCMPTypeTracerouteReply to create the response.
needsAuth := cause != nil ||
(scmpH.TypeCode.Type() == slayers.SCMPTypeTracerouteReply &&
p.hasValidAuth(time.Now()))
needsAuth := false
if p.d.ExperimentalSCMPAuthentication {
// Error messages must be authenticated.
// Traceroute are OPTIONALLY authenticated ONLY IF the request
// was authenticated.
// TODO(JordiSubira): Reuse the key computed in p.hasValidAuth
// if SCMPTypeTracerouteReply to create the response.
needsAuth = cause != nil ||
(scmpH.TypeCode.Type() == slayers.SCMPTypeTracerouteReply &&
p.hasValidAuth(time.Now()))
}

var quote []byte
if cause != nil {
Expand Down

0 comments on commit a260930

Please sign in to comment.