@@ -14,21 +14,27 @@ use netlink_packet_utils::{
14
14
15
15
use super :: { TcActionGeneric , TcActionGenericBuffer } ;
16
16
17
+ /// Traffic control action used to mirror or redirect packets.
17
18
#[ derive( Debug , PartialEq , Eq , Clone ) ]
18
19
#[ non_exhaustive]
19
20
pub struct TcActionMirror { }
20
21
impl TcActionMirror {
22
+ /// The `TcActionAttribute::Kind` of this action.
21
23
pub const KIND : & ' static str = "mirred" ;
22
24
}
23
25
24
26
const TCA_MIRRED_TM : u16 = 1 ;
25
27
const TCA_MIRRED_PARMS : u16 = 2 ;
26
28
29
+ /// Options for the `TcActionMirror` action.
27
30
#[ derive( Debug , PartialEq , Eq , Clone ) ]
28
31
#[ non_exhaustive]
29
32
pub enum TcActionMirrorOption {
33
+ /// TODO: document this after we make it something better than `Vec<u8>`
30
34
Tm ( Vec < u8 > ) ,
35
+ /// Parameters for the mirred action.
31
36
Parms ( TcMirror ) ,
37
+ /// Other attributes unknown at the time of writing.
32
38
Other ( DefaultNla ) ,
33
39
}
34
40
@@ -74,11 +80,15 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<NlaBuffer<&'a T>>
74
80
75
81
const TC_MIRRED_BUF_LEN : usize = TcActionGeneric :: BUF_LEN + 8 ;
76
82
83
+ /// Parameters for the mirred action.
77
84
#[ derive( Debug , PartialEq , Eq , Clone , Default ) ]
78
85
#[ non_exhaustive]
79
86
pub struct TcMirror {
87
+ /// Generic action parameters.
80
88
pub generic : TcActionGeneric ,
89
+ /// Describes how the packet be mirrored or redirected.
81
90
pub eaction : TcMirrorActionType ,
91
+ /// Interface index to mirror or redirect to.
82
92
pub ifindex : u32 ,
83
93
}
84
94
@@ -121,14 +131,20 @@ const TCA_EGRESS_MIRROR: i32 = 2;
121
131
const TCA_INGRESS_REDIR : i32 = 3 ;
122
132
const TCA_INGRESS_MIRROR : i32 = 4 ;
123
133
134
+ /// Type of mirroring or redirecting action.
124
135
#[ derive( Debug , PartialEq , Eq , Clone , Copy , Default ) ]
125
136
#[ non_exhaustive]
126
137
pub enum TcMirrorActionType {
127
138
#[ default]
139
+ /// Redirect to the egress pipeline.
128
140
EgressRedir ,
141
+ /// Mirror to the egress pipeline.
129
142
EgressMirror ,
143
+ /// Redirect to the ingress pipeline.
130
144
IngressRedir ,
145
+ /// Mirror to the ingress pipeline.
131
146
IngressMirror ,
147
+ /// Other action type unknown at the time of writing.
132
148
Other ( i32 ) ,
133
149
}
134
150
0 commit comments