MirredAction

The MirredAction class supports packet mirroring and packet redirection.

class MirredAction(action_index: Optional[int] = None, *, mirred_action: str, direction: str, to_dev: str)[source]

This class supports the tc(8) mirred action as documented in tc-mirred(8).

Parameters:
  • action_index – an integer that effectively names the action

  • mirred_action – either mirror or redirect

  • direction – either ingress or egress

  • to_dev – destination interface

MIRROR = 'mirror'

mirred mirroring action

REDIRECT = 'redirect'

mirred redirect action

EGRESS = 'egress'

Direction for packets to be sent out

INGRESS = 'ingress'

Direction for packets to be received

classmethod get_kind() str[source]

Returns mirred

get_destination_interface() str[source]

Returns the name of the destination interface

get_mirred_action() str[source]

Returns the mirred action, either MirredAction.MIRROR or MirredAction.REDIRECT

get_direction() Optional[str][source]

Returns the direction of the packet when it arrives at the destination interface, either MirredAction.INGRESS or MirredAction.EGRESS

action_creation_args() List[str]

Returns a list of tc(8) arguments to instantiate this action

get_action_index() Optional[int]

Returns the action index

get_install_duration() int

Returns the number of seconds since the action was installed (created)

get_stats() Optional[ActionStats]

Returns action statistics

get_use_duration() int

It is not clear how the use duration (in seconds) is defined. As a data point, the install duration and use duration of an action created as part of a filter creation always have the same value.

parse_common_lines(line_iter: LineGroupIterator) None

Parse lines common to all actions. Stop when an empty line is encountered (the end of the action)

set_action_index(action_index: int) None

Sets the action index

set_durations(*, install_duration: int, use_duration: int) None

Set the install and use duration