Skip to content

Commit

Permalink
Add additional check in tc actuator Actuate
Browse files Browse the repository at this point in the history
Ensure that qdisc is provided if filters are

Signed-off-by: Adrian Chiris <[email protected]>
  • Loading branch information
adrianchiris committed Aug 4, 2022
1 parent 32d5559 commit 55d1b33
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/tc/actuator_tc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ type ActuatorTCImpl struct {
// Actuate is an implementation of Actuator interface. it applies TCObjects on the representor
// Note: it assumes all filters are in Chain 0
func (a *ActuatorTCImpl) Actuate(objects *TCObjects) error {
if objects.QDisc == nil && len(objects.Filters) > 0 {
return errors.New("Qdisc cannot be nil if Filters are provided")
}

// list qdiscs
currentQDiscs, err := a.tcApi.QDiscList()
if err != nil {
Expand Down

0 comments on commit 55d1b33

Please sign in to comment.