This is one small step closer to support add-path send side.
We store the path_id_tx on the prefix and we can adjust a few places to
make use of that field. Now it is always 0 so nothing changes in the end
apart from removing some XXX comments.

-- 
:wq Claudio

Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.534
diff -u -p -r1.534 rde.c
--- rde.c       6 Feb 2022 09:51:19 -0000       1.534
+++ rde.c       24 Feb 2022 13:01:13 -0000
@@ -2422,7 +2422,7 @@ rde_dump_rib_as(struct prefix *p, struct
                }
        } else {
                if (peer_has_add_path(peer, p->pt->aid, CAPA_AP_SEND)) {
-                       rib.path_id = 0;        /* XXX add-path send */
+                       rib.path_id = p->path_id_tx;
                        rib.flags |= F_PREF_PATH_ID;
                }
        }
@@ -2507,12 +2507,16 @@ rde_dump_filter(struct prefix *p, struct
        if ((req->flags & F_CTL_INVALID) &&
            (asp->flags & F_ATTR_PARSE_ERR) == 0)
                return;
-       /*
-        * XXX handle out specially since then we want to match against our
-        * path ids.
-        */
-       if ((req->flags & F_CTL_HAS_PATHID) && req->path_id != p->path_id)
-               return;
+       if ((req->flags & F_CTL_HAS_PATHID)) {
+               /* Match against the transmit path id if adjout is used.  */
+               if (adjout) {
+                       if (req->path_id != p->path_id_tx)
+                               return;
+               } else {
+                       if (req->path_id != p->path_id)
+                               return;
+               }
+       }
        if (req->as.type != AS_UNDEF &&
            !aspath_match(asp->aspath, &req->as, 0))
                return;
Index: rde_update.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_update.c,v
retrieving revision 1.132
diff -u -p -r1.132 rde_update.c
--- rde_update.c        6 Feb 2022 09:51:19 -0000       1.132
+++ rde_update.c        24 Feb 2022 13:01:13 -0000
@@ -632,8 +632,7 @@ up_dump_prefix(u_char *buf, int len, str
                if (peer_has_add_path(peer, p->pt->aid, CAPA_AP_SEND)) {
                        if (len <= wpos + (int)sizeof(pathid))
                                break;
-                       /* XXX add-path send side */
-                       pathid = 0;
+                       pathid = htonl(p->path_id_tx);
                        memcpy(buf + wpos, &pathid, sizeof(pathid));
                        wpos += sizeof(pathid);
                }

Reply via email to