Skip to content

Commit

Permalink
Avoid crash in mirror if nextHop Ip type does not match the dest IP type
Browse files Browse the repository at this point in the history
Summary:
in S455663, wedge agent crashed on some boxes when v4 mirror was configured and nexthops were resolved to v6. While there were configuration issues, wedge agent crash also needs to be addressed.

Ensure that if the nexthop address type and mirror dest address type vary, the nexthop is not picked up

Reviewed By: phshaikh

Differential Revision: D66032846

fbshipit-source-id: a90afc782704e88cc6efc7998b05706aa9c38032
  • Loading branch information
elangovan911-meta authored and facebook-github-bot committed Nov 19, 2024
1 parent e13c412 commit 7a34125
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fboss/agent/MirrorManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ PortID MirrorManagerImpl<AddrT>::getEventorPortForSflowMirror(
template <typename AddrT>
std::shared_ptr<Mirror> MirrorManagerImpl<AddrT>::updateMirror(
const std::shared_ptr<Mirror>& mirror) {
bool isV4 = std::is_same_v<AddrT, folly::IPAddressV4>;
const AddrT destinationIp =
getIPAddress<AddrT>(mirror->getDestinationIp().value());
const auto state = sw_->getState();
Expand All @@ -91,6 +92,10 @@ std::shared_ptr<Mirror> MirrorManagerImpl<AddrT>::updateMirror(
newMirror->setSwitchId(mirror->getSwitchId());

for (const auto& nexthop : nexthops) {
// Dont consider nextHops that do not match incoming Address family
if (isV4 != nexthop.addr().isV4()) {
continue;
}
const auto entry =
resolveMirrorNextHopNeighbor(state, mirror, destinationIp, nexthop);

Expand Down

0 comments on commit 7a34125

Please sign in to comment.