bgpd, zebra: Ensure that passed flags is 0 for unregister event

The flags passed in should be 0 for an unregister event.  Ensure
that we respect that.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-11-13 14:30:17 -05:00
parent 832d0f566f
commit e0b84ba1f6
2 changed files with 9 additions and 1 deletions

View File

@ -154,7 +154,12 @@ void bgp_reg_dereg_for_label(struct bgp_node *rn, struct bgp_info *ri, int reg)
/* Set length and flags */
stream_putw_at(s, 0, stream_get_endp(s));
stream_putw_at(s, flags_pos, flags);
/*
* We only need to write new flags if this is a register
*/
if (reg)
stream_putw_at(s, flags_pos, flags);
zclient_send_message(zclient);
}

View File

@ -907,6 +907,9 @@ static int zserv_fec_unregister(struct zserv *client, u_short length)
while (l < length) {
STREAM_GETW(s, flags);
if (flags != 0)
goto stream_failure;
memset(&p, 0, sizeof(p));
STREAM_GETW(s, p.family);
if (p.family != AF_INET && p.family != AF_INET6) {