diff --git a/routingtable/filter/actions/accept_action.go b/routingtable/filter/actions/accept_action.go index 301592a4a07e9dc12ffd855efe00f9c0beca3bd2..6c0cc2acbfa3d75603ff33cc10025bdad09b3a23 100644 --- a/routingtable/filter/actions/accept_action.go +++ b/routingtable/filter/actions/accept_action.go @@ -8,6 +8,6 @@ import ( type AcceptAction struct { } -func (*AcceptAction) Do(p net.Prefix, pa *route.Path) (bool, *route.Path) { - return true, pa +func (*AcceptAction) Do(p net.Prefix, pa *route.Path) (modPath *route.Path, reject bool) { + return pa, false } diff --git a/routingtable/filter/actions/reject_action.go b/routingtable/filter/actions/reject_action.go index 1fc7316a61359e489e2416834cc501030b5e7885..d740139626b99395db71a3b2e7c2cea1d04ebacf 100644 --- a/routingtable/filter/actions/reject_action.go +++ b/routingtable/filter/actions/reject_action.go @@ -8,6 +8,6 @@ import ( type RejectAction struct { } -func (*RejectAction) Do(p net.Prefix, pa *route.Path) (bool, *route.Path) { - return false, pa +func (*RejectAction) Do(p net.Prefix, pa *route.Path) (modPath *route.Path, reject bool) { + return pa, true } diff --git a/routingtable/filter/term.go b/routingtable/filter/term.go index 1ca09d107351b9d803ff904cdc0818e2c67cb9e9..85a88eb88945581c388f790bcf17631b7f1da9db 100644 --- a/routingtable/filter/term.go +++ b/routingtable/filter/term.go @@ -39,13 +39,11 @@ func (t *Term) Process(p net.Prefix, pa *route.Path) (modPath *route.Path, rejec } func (t *Term) processActions(p net.Prefix, pa *route.Path) (modPath *route.Path, reject bool) { - var result bool modPath = pa for _, action := range t.then { - result, modPath = action.Do(p, modPath) - if !result { - reject = true + modPath, reject = action.Do(p, modPath) + if reject { continue } } diff --git a/routingtable/filter/term_test.go b/routingtable/filter/term_test.go index 6ff40c8007fd380c2829e6649a701c8d160d69ee..ee55c712c21a055d75dc61468751e1c80b92f81b 100644 --- a/routingtable/filter/term_test.go +++ b/routingtable/filter/term_test.go @@ -12,11 +12,11 @@ import ( type mockAction struct { } -func (*mockAction) Do(p net.Prefix, pa *route.Path) (bool, *route.Path) { +func (*mockAction) Do(p net.Prefix, pa *route.Path) (*route.Path, bool) { cp := *pa cp.Type = route.OSPFPathType - return true, &cp + return &cp, false } func TestProcess(t *testing.T) { diff --git a/routingtable/filter/then.go b/routingtable/filter/then.go index b16aed48d9f9911aefd9373c4d119c9ac89dcdd3..920daf43c1cdb121400168cc0ac17460bff42350 100644 --- a/routingtable/filter/then.go +++ b/routingtable/filter/then.go @@ -6,5 +6,5 @@ import ( ) type Then interface { - Do(p net.Prefix, pa *route.Path) (bool, *route.Path) + Do(p net.Prefix, pa *route.Path) (modPath *route.Path, reject bool) }