Skip to content

Commit 4ef077d

Browse files
committed
Support tc flower ip tos
1 parent e7896ff commit 4ef077d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: src/tc/filters/cls_flower.rs

+5
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ pub type MplsBos = u8;
211211
pub type MplsTc = u8;
212212
pub type MplsLabel = u32;
213213
pub type TcpFlagsMask = u8;
214+
pub type IpTos = u8;
214215

215216
bitflags! {
216217
// TcpFlags _ARE_ exactly 8 bits.
@@ -1370,6 +1371,7 @@ pub enum TcFilterFlowerOption {
13701371
KeyMplsLabel(MplsLabel),
13711372
KeyTcpFlags(TcpFlags),
13721373
KeyTcpFlagsMask(TcpFlagsMask),
1374+
KeyIpTos(IpTos),
13731375
}
13741376

13751377
impl Nla for TcFilterFlowerOption {
@@ -1445,6 +1447,7 @@ impl Nla for TcFilterFlowerOption {
14451447
Self::KeyMplsLabel(_) => 4,
14461448
Self::KeyTcpFlags(_) => 2,
14471449
Self::KeyTcpFlagsMask(_) => 2,
1450+
Self::KeyIpTos(_) => 1,
14481451
Self::Other(attr) => attr.value_len(),
14491452
}
14501453
}
@@ -1525,6 +1528,7 @@ impl Nla for TcFilterFlowerOption {
15251528
Self::KeyMplsLabel(_) => TCA_FLOWER_KEY_MPLS_LABEL,
15261529
Self::KeyTcpFlags(_) => TCA_FLOWER_KEY_TCP_FLAGS,
15271530
Self::KeyTcpFlagsMask(_) => TCA_FLOWER_KEY_TCP_FLAGS_MASK,
1531+
Self::KeyIpTos(_) => TCA_FLOWER_KEY_IP_TOS,
15281532
Self::Other(attr) => attr.kind(),
15291533
}
15301534
}
@@ -1676,6 +1680,7 @@ impl Nla for TcFilterFlowerOption {
16761680
Self::KeyTcpFlagsMask(flags) => {
16771681
buffer.copy_from_slice((*flags as u16).to_be_bytes().as_slice())
16781682
}
1683+
Self::KeyIpTos(tos) => buffer.copy_from_slice(&[*tos].as_slice()),
16791684
Self::Other(attr) => attr.emit_value(buffer),
16801685
}
16811686
}

0 commit comments

Comments
 (0)