Skip to content

Commit c8d7551

Browse files
authored
Merge pull request FRRouting#19742 from FRRouting/mergify/bp/stable/10.1/pr-19732
pim6d: don't SEGV on repeated MLD records (backport FRRouting#19732)
2 parents 47deea3 + 6088e53 commit c8d7551

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pimd/pim6_mld.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,13 @@ static void gm_handle_v2_pass2_incl(struct gm_packet_state *pkt, size_t i)
710710
/* EXCLUDE state was already dropped in pass1 */
711711
assert(!gm_packet_sg_find(sg, GM_SUB_NEG, pkt->subscriber));
712712

713+
/* if repeated MLD records are in a packet, pkt == old is possible */
714+
pkt->n_active++;
715+
713716
old = gm_packet_sg_find(sg, GM_SUB_POS, pkt->subscriber);
714717
if (old)
715718
gm_packet_sg_drop(old);
716719

717-
pkt->n_active++;
718720
gm_packet_sg_subs_add(sg->subs_positive, item);
719721

720722
sg->most_recent = item;
@@ -729,6 +731,9 @@ static void gm_handle_v2_pass2_excl(struct gm_packet_state *pkt, size_t offs)
729731
struct gm_sg *sg_grp = item->sg;
730732
size_t i;
731733

734+
/* if repeated MLD records are in a packet, pkt == old is possible */
735+
pkt->n_active++;
736+
732737
old_grp = gm_packet_sg_find(sg_grp, GM_SUB_POS, pkt->subscriber);
733738
if (old_grp) {
734739
for (i = 0; i < item->n_exclude; i++) {
@@ -773,7 +778,6 @@ static void gm_handle_v2_pass2_excl(struct gm_packet_state *pkt, size_t offs)
773778

774779
item_dup = gm_packet_sg_subs_add(sg_grp->subs_positive, item);
775780
assert(!item_dup);
776-
pkt->n_active++;
777781

778782
sg_grp->most_recent = item;
779783
gm_sg_expiry_cancel(sg_grp);

0 commit comments

Comments
 (0)