Skip to content

Commit

Permalink
vrrp-error: logical errors
Browse files Browse the repository at this point in the history
- When checking for mac vlan name, we have been
  checking the wrong way. Which means more than
  one instance (if the second instance had a
  higher priority than the first) would bring an
  issue.

- Change 255 check on arriving  packet to be in
  accordance with RFC (check against priority
  instead of against vrid).

Signed-off-by: Paul Wekesa <[email protected]>
  • Loading branch information
Paul-weqe committed Nov 11, 2024
1 parent 8a8c432 commit ad61528
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion holo-vrrp/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ fn handle_vrrp_actions(interface: &mut Interface, action: VrrpAction) {
match action {
VrrpAction::Initialize(_src, pkt) => {
let vrid = pkt.vrid;
let priority = pkt.priority;

if vrid == 255 {
if priority == 255 {
interface.send_vrrp_advert(vrid);
interface.change_state(
vrid,
Expand Down
2 changes: 1 addition & 1 deletion holo-vrrp/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ impl ProtocolInstance for Interface {
impl MacVlanInterface {
pub(crate) fn is_ready(&self) -> bool {
// return true if the ifindex exists
!self.system.ifindex.is_none()
self.system.ifindex.is_some()
}

pub fn new(vrid: u8) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion holo-vrrp/src/southbound/rx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) fn process_iface_update(

//check if it is one of the macvlans being updated.
'outer: for (vrid, instance) in iface.instances.iter_mut() {
let name = format!("mvlan-vrrp-{}", vrid);
let name = msg.ifname.clone();
let mvlan_iface = &mut instance.mac_vlan;

if mvlan_iface.name == name {
Expand Down

0 comments on commit ad61528

Please sign in to comment.