>From my ASPA tree.

In rde_update_dispatch() the MP capability check for IPv4 is done for
every prefix again instead of once for withdraws and once for updates.
In the real MP case this is not an issue since the code does not loop
on that level.

Move the extra check into its own if block. This is also the place where
I will add the ASPA check (and that check we don't want to do over and
over again).

-- 
:wq Claudio

Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.580
diff -u -p -r1.580 rde.c
--- rde.c       18 Nov 2022 10:17:23 -0000      1.580
+++ rde.c       14 Dec 2022 13:59:08 -0000
@@ -1302,7 +1302,7 @@ rde_update_dispatch(struct rde_peer *pee
        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 *pee
                            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 *pee
        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 *pee
                            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,

Reply via email to