From 23234cb1c30f2195d69ebceb9147112876573e4d Mon Sep 17 00:00:00 2001 From: claudio Date: Wed, 14 Dec 2022 14:16:20 +0000 Subject: [PATCH] Do the IPv4 specific MP capability check only once per update/withdraw instead of per prefix. OK sthen@ --- usr.sbin/bgpd/rde.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index b6fd6d3f58e..0b07ba58c59 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.580 2022/11/18 10:17:23 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.581 2022/12/14 14:16:20 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -1302,7 +1302,7 @@ rde_update_dispatch(struct rde_peer *peer, struct imsg *imsg) p += 2; /* withdraw prefix */ - while (len > 0) { + if (len > 0) { if (peer->capa.mp[AID_INET] == 0) { log_peer_warnx(&peer->conf, "bad withdraw, %s disabled", aid2str(AID_INET)); @@ -1310,7 +1310,8 @@ rde_update_dispatch(struct rde_peer *peer, struct imsg *imsg) NULL, 0); goto done; } - + } + while (len > 0) { if (peer_has_add_path(peer, AID_INET, CAPA_AP_RECV)) { if (len <= sizeof(pathid)) { log_peer_warnx(&peer->conf, @@ -1447,7 +1448,7 @@ rde_update_dispatch(struct rde_peer *peer, struct imsg *imsg) p += 2 + attrpath_len; /* parse nlri prefix */ - while (nlri_len > 0) { + if (nlri_len > 0) { if (peer->capa.mp[AID_INET] == 0) { log_peer_warnx(&peer->conf, "bad update, %s disabled", aid2str(AID_INET)); @@ -1455,7 +1456,8 @@ rde_update_dispatch(struct rde_peer *peer, struct imsg *imsg) NULL, 0); goto done; } - + } + while (nlri_len > 0) { if (peer_has_add_path(peer, AID_INET, CAPA_AP_RECV)) { if (nlri_len <= sizeof(pathid)) { log_peer_warnx(&peer->conf, -- 2.20.1