Skip to content

Commit fa21129

Browse files
committed
Add weight high order byte.
1 parent d327d20 commit fa21129

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/nexthop/group.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ use netlink_packet_utils::{
44
DecodeError, Emitable,
55
};
66

7-
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
7+
#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
88
/// Nexthop Group
99
pub struct NexthopGroup {
1010
/// Nexthop id
1111
pub id: u32,
1212
/// Weight of this nexthop
1313
pub weight: u8,
14-
/// Reserved
15-
pub resvd1: u8,
14+
/// High order bits of weight
15+
pub weight_high: u8,
1616
/// Reserved
1717
pub resvd2: u16,
1818
}
@@ -25,7 +25,7 @@ impl Emitable for NexthopGroup {
2525
fn emit(&self, buffer: &mut [u8]) {
2626
NativeEndian::write_u32(buffer, self.id);
2727
buffer[4] = self.weight;
28-
buffer[5] = self.resvd1;
28+
buffer[5] = self.weight_high;
2929
NativeEndian::write_u16(&mut buffer[6..8], self.resvd2);
3030
}
3131
}
@@ -35,7 +35,7 @@ impl NexthopGroup {
3535
let grp = Self {
3636
id: parse_u32(payload)?,
3737
weight: payload[4],
38-
resvd1: payload[5],
38+
weight_high: payload[5],
3939
resvd2: parse_u16(&payload[6..8])?,
4040
};
4141
Ok(grp)

0 commit comments

Comments
 (0)