Skip to content

Commit

Permalink
pbrd: prevent null access on some nexthops in nht
Browse files Browse the repository at this point in the history
Prevent null access on nhg->nexthop

Ticket: CM-30378
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
Testing Done: Manual verification
  • Loading branch information
Wesley Coakley committed Apr 20, 2021
1 parent e89992a commit 6821f1d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pbrd/pbr_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,17 +524,18 @@ void pbr_nht_set_seq_nhg(struct pbr_map_sequence *pbrms,

pbrms->nhgrp_name = XSTRDUP(MTYPE_TMP, nhgc->name);

switch (nhg->nexthop->type) {
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
pbrms->family = AF_INET6;
break;
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
pbrms->family = AF_INET;
default:
break;
}
if (nhg->nexthop)
switch (nhg->nexthop->type) {
case NEXTHOP_TYPE_IPV6:
case NEXTHOP_TYPE_IPV6_IFINDEX:
pbrms->family = AF_INET6;
break;
case NEXTHOP_TYPE_IPV4:
case NEXTHOP_TYPE_IPV4_IFINDEX:
pbrms->family = AF_INET;
default:
break;
}
}

void pbr_nht_add_individual_nexthop(struct pbr_map_sequence *pbrms,
Expand Down

0 comments on commit 6821f1d

Please sign in to comment.