Skip to content

Commit 427ffc5

Browse files
oleksandrivantsivShuotian Cheng
authored and
Shuotian Cheng
committed
[everflow]: Fix minor everflow issues. (sonic-net#215)
- Fix issue with session update observed when more than one session exist with destination IP address from the same subnet. - Fix issue with deletion of ACL rules attached to everflow session in inactive state.
1 parent 3c1dbd8 commit 427ffc5

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

orchagent/aclorch.cpp

+19-2
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,13 @@ bool AclRuleMirror::create()
583583
throw runtime_error("Failed to get mirror session state");
584584
}
585585

586+
// Increase session reference count regardless of state to deny
587+
// attempt to remove mirror session with attached ACL rules.
588+
if (!m_pMirrorOrch->increaseRefCount(m_sessionName))
589+
{
590+
throw runtime_error("Failed to increase mirror session reference count");
591+
}
592+
586593
if (!state)
587594
{
588595
return true;
@@ -607,19 +614,29 @@ bool AclRuleMirror::create()
607614

608615
m_state = true;
609616

610-
return m_pMirrorOrch->increaseRefCount(m_sessionName);
617+
return true;
611618
}
612619

613620
bool AclRuleMirror::remove()
614621
{
622+
if (!m_pMirrorOrch->decreaseRefCount(m_sessionName))
623+
{
624+
throw runtime_error("Failed to decrease mirror session reference count");
625+
}
626+
627+
if (!m_state)
628+
{
629+
return true;
630+
}
631+
615632
if (!AclRule::remove())
616633
{
617634
return false;
618635
}
619636

620637
m_state = false;
621638

622-
return m_pMirrorOrch->decreaseRefCount(m_sessionName);
639+
return true;
623640
}
624641

625642
void AclRuleMirror::update(SubjectType type, void *cntx)

orchagent/mirrororch.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ void MirrorOrch::updateNextHop(const NextHopUpdate& update)
566566
// and current next hop is still in next hop group - do nothing.
567567
if (session.nexthopInfo.prefix == update.prefix && update.nexthopGroup.getIpAddresses().count(session.nexthopInfo.nexthop))
568568
{
569-
return;
569+
continue;
570570
}
571571
}
572572

@@ -582,26 +582,26 @@ void MirrorOrch::updateNextHop(const NextHopUpdate& update)
582582
{
583583
deactivateSession(name, session);
584584
}
585-
return;
585+
continue;
586586
}
587587

588588
if (session.status)
589589
{
590590
if (!updateSessionDstMac(name, session))
591591
{
592-
return;
592+
continue;
593593
}
594594

595595
if (!updateSessionDstPort(name, session))
596596
{
597-
return;
597+
continue;
598598
}
599599
}
600600
else
601601
{
602602
if (!activateSession(name, session))
603603
{
604-
return;
604+
continue;
605605
}
606606
}
607607
}
@@ -638,19 +638,19 @@ void MirrorOrch::updateNeighbor(const NeighborUpdate& update)
638638
{
639639
deactivateSession(name, session);
640640
}
641-
return;
641+
continue;
642642
}
643643

644644
if (session.status)
645645
{
646646
if (!updateSessionDstMac(name, session))
647647
{
648-
return;
648+
continue;
649649
}
650650

651651
if (!updateSessionDstPort(name, session))
652652
{
653-
return;
653+
continue;
654654
}
655655
}
656656
else
@@ -748,7 +748,7 @@ void MirrorOrch::updateLagMember(const LagMemberUpdate& update)
748748
// We interesting only in first LAG member
749749
if (update.lag.m_members.size() > 1)
750750
{
751-
return;
751+
continue;
752752
}
753753

754754
const string& memberName = *update.lag.m_members.begin();
@@ -771,7 +771,7 @@ void MirrorOrch::updateLagMember(const LagMemberUpdate& update)
771771
deactivateSession(name, session);
772772
session.neighborInfo.portId = SAI_OBJECT_TYPE_NULL;
773773

774-
return;
774+
continue;
775775
}
776776

777777
// Get another LAG member and update session

0 commit comments

Comments
 (0)