@@ -14,21 +14,27 @@ use netlink_packet_utils::{
1414
1515use super :: { TcActionGeneric , TcActionGenericBuffer } ;
1616
17+ /// Traffic control action used to mirror or redirect packets.
1718#[ derive( Debug , PartialEq , Eq , Clone ) ]
1819#[ non_exhaustive]
1920pub struct TcActionMirror { }
2021impl TcActionMirror {
22+ /// The `TcActionAttribute::Kind` of this action.
2123 pub const KIND : & ' static str = "mirred" ;
2224}
2325
2426const TCA_MIRRED_TM : u16 = 1 ;
2527const TCA_MIRRED_PARMS : u16 = 2 ;
2628
29+ /// Options for the `TcActionMirror` action.
2730#[ derive( Debug , PartialEq , Eq , Clone ) ]
2831#[ non_exhaustive]
2932pub enum TcActionMirrorOption {
33+ /// TODO: document this after we make it something better than `Vec<u8>`
3034 Tm ( Vec < u8 > ) ,
35+ /// Parameters for the mirred action.
3136 Parms ( TcMirror ) ,
37+ /// Other attributes unknown at the time of writing.
3238 Other ( DefaultNla ) ,
3339}
3440
@@ -74,11 +80,15 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>>
7480
7581const TC_MIRRED_BUF_LEN : usize = TcActionGeneric :: BUF_LEN + 8 ;
7682
83+ /// Parameters for the mirred action.
7784#[ derive( Debug , PartialEq , Eq , Clone , Default ) ]
7885#[ non_exhaustive]
7986pub struct TcMirror {
87+ /// Generic action parameters.
8088 pub generic : TcActionGeneric ,
89+ /// Describes how the packet be mirrored or redirected.
8190 pub eaction : TcMirrorActionType ,
91+ /// Interface index to mirror or redirect to.
8292 pub ifindex : u32 ,
8393}
8494
@@ -121,14 +131,20 @@ const TCA_EGRESS_MIRROR: i32 = 2;
121131const TCA_INGRESS_REDIR : i32 = 3 ;
122132const TCA_INGRESS_MIRROR : i32 = 4 ;
123133
134+ /// Type of mirroring or redirecting action.
124135#[ derive( Debug , PartialEq , Eq , Clone , Copy , Default ) ]
125136#[ non_exhaustive]
126137pub enum TcMirrorActionType {
127138 #[ default]
139+ /// Redirect to the egress pipeline.
128140 EgressRedir ,
141+ /// Mirror to the egress pipeline.
129142 EgressMirror ,
143+ /// Redirect to the ingress pipeline.
130144 IngressRedir ,
145+ /// Mirror to the ingress pipeline.
131146 IngressMirror ,
147+ /// Other action type unknown at the time of writing.
132148 Other ( i32 ) ,
133149}
134150
0 commit comments