pbrd: fix coverity warning

CID 1500586

There was an attempt to fix it in 920bb6f7 but the commit didn't
actually fix the warning.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
Igor Ryzhov 2021-05-19 16:24:21 +03:00
parent f96c2b6dc2
commit 3558b8b8b4

View File

@ -721,7 +721,7 @@ pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc,
* So let's search and do the right thing on the * So let's search and do the right thing on the
* interface event. * interface event.
*/ */
if (!pnhi->nhr && pnhi->ifp) { if (!pnhi->nhr) {
switch (pnhc->nexthop.type) { switch (pnhc->nexthop.type) {
case NEXTHOP_TYPE_BLACKHOLE: case NEXTHOP_TYPE_BLACKHOLE:
case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4:
@ -738,20 +738,18 @@ pbr_nht_individual_nexthop_gw_update(struct pbr_nexthop_cache *pnhc,
goto done; goto done;
} }
if (pnhi->nhr) { switch (pnhi->nhr->prefix.family) {
switch (pnhi->nhr->prefix.family) { case AF_INET:
case AF_INET: if (pnhc->nexthop.gate.ipv4.s_addr
if (pnhc->nexthop.gate.ipv4.s_addr != pnhi->nhr->prefix.u.prefix4.s_addr)
!= pnhi->nhr->prefix.u.prefix4.s_addr) goto done; /* Unrelated change */
goto done; /* Unrelated change */ break;
break; case AF_INET6:
case AF_INET6: if (memcmp(&pnhc->nexthop.gate.ipv6,
if (memcmp(&pnhc->nexthop.gate.ipv6, &pnhi->nhr->prefix.u.prefix6, 16)
&pnhi->nhr->prefix.u.prefix6, 16) != 0)
!= 0) goto done; /* Unrelated change */
goto done; /* Unrelated change */ break;
break;
}
} }
pnhi->nhr_matched = true; pnhi->nhr_matched = true;