Skip to content

Commit

Permalink
pass + ci
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiSubira committed Sep 22, 2023
1 parent b6c86e0 commit 3c9345e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
5 changes: 0 additions & 5 deletions pkg/spao/mac.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@ func zeroOutWithBase(base scion.Base, buf []byte) {
}
}

func bigEndian(b []byte) uint64 {
return uint64(b[0])<<40 + uint64(b[1]) +
uint64(binary.BigEndian.Uint32(b[2:6]))
}

func bigEndianPutUint48(b []byte, v uint64) {
b[0] = byte(v >> 40)
b[1] = byte(v >> 32)
Expand Down
17 changes: 16 additions & 1 deletion pkg/spao/timestamp_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
// Copyright 2022 ETH Zurich
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package spao_test

import (
"testing"
"time"

"github.com/stretchr/testify/assert"

"github.com/scionproto/scion/pkg/drkey"
"github.com/scionproto/scion/pkg/spao"
"github.com/scionproto/scion/private/drkey/drkeyutil"
"github.com/stretchr/testify/assert"
)

func TestTimestamp(t *testing.T) {
Expand Down
18 changes: 16 additions & 2 deletions private/drkey/drkeyutil/drkey.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2023 ETH Zurich
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package drkeyutil

import (
Expand All @@ -12,14 +26,14 @@ const (
DefaultEpochDuration = 24 * time.Hour
DefaultPrefetchEntries = 10000
EnvVarEpochDuration = "SCION_TESTING_DRKEY_EPOCH_DURATION"
// DefaultAcceptanceWindowOffset is the time width for accepting incoming packets. The
// DefaultAcceptanceWindowLength is the time width for accepting incoming packets. The
// acceptance widown is then compute as:
// aw := [T-a, T+a)
// where aw:= acceptance window, T := time instant and a := acceptanceWindowOffset
//
// Picking the value equal or shorter than half of the drkey Grace Period ensures
// that we accept packets for active keys only.
DefaultAcceptanceWindowLength = 5
DefaultAcceptanceWindowLength = 5 * time.Minute
EnvVarAccpetanceWindow = "SCION_TESTING_ACCEPTANCE_WINDOW"
)

Expand Down
3 changes: 2 additions & 1 deletion tools/braccept/cases/scmp_traceroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ func SCMPTracerouteIngressWithSPAO(artifactsDir string, mac hash.Hash) runner.Ca

sendTime := time.Now()
key, err := (&drkeyutil.FakeProvider{
EpochDuration: drkeyutil.LoadEpochDuration(),
EpochDuration: drkeyutil.LoadEpochDuration(),
AcceptanceWindow: drkeyutil.LoadAcceptanceWindow(),
}).GetASHostKey(sendTime, xtest.MustParseIA("1-ff00:0:4"), srcA)
if err != nil {
panic(err)
Expand Down

0 comments on commit 3c9345e

Please sign in to comment.