diff --git a/pkg/spao/mac.go b/pkg/spao/mac.go index ba78ff9684..6ef8687f98 100644 --- a/pkg/spao/mac.go +++ b/pkg/spao/mac.go @@ -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) diff --git a/pkg/spao/timestamp_test.go b/pkg/spao/timestamp_test.go index 577f4673d2..8d8f61e3d2 100644 --- a/pkg/spao/timestamp_test.go +++ b/pkg/spao/timestamp_test.go @@ -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) { diff --git a/private/drkey/drkeyutil/drkey.go b/private/drkey/drkeyutil/drkey.go index 7f34d5e0d7..95710db97e 100644 --- a/private/drkey/drkeyutil/drkey.go +++ b/private/drkey/drkeyutil/drkey.go @@ -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 ( @@ -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" ) diff --git a/tools/braccept/cases/scmp_traceroute.go b/tools/braccept/cases/scmp_traceroute.go index d70f693744..b405ce04ca 100644 --- a/tools/braccept/cases/scmp_traceroute.go +++ b/tools/braccept/cases/scmp_traceroute.go @@ -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)