ok
Claudio Jeker(cje...@diehard.n-r-g.com) on 2019.06.20 18:53:04 +0200:
> prefix_add() is only called by path_update() and path_update already
> knows if the prefix exists or not (by calling prefix_get()). So doing
> the same check again in prefix_add() is silly and actually rather
> expensive with lots of peers. Just alloc and link the prefix instead.
>
> OK?
> --
> :wq Claudio
>
> Index: rde_rib.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v
> retrieving revision 1.193
> diff -u -p -r1.193 rde_rib.c
> --- rde_rib.c 20 Jun 2019 13:38:21 -0000 1.193
> +++ rde_rib.c 20 Jun 2019 16:45:34 -0000
> @@ -922,24 +922,9 @@ prefix_add(struct bgpd_addr *prefix, int
> if (re == NULL)
> re = rib_add(rib, prefix, prefixlen);
>
> - p = prefix_bypeer(re, peer);
> - if (p == NULL) {
> - p = prefix_alloc();
> - prefix_link(p, re, peer, asp, comm, nexthop, nhflags, vstate);
> - return (1);
> - } else {
> - if (prefix_aspath(p) != asp ||
> - prefix_communities(p) != comm ||
> - prefix_nexthop(p) != nexthop ||
> - prefix_nhflags(p) != nhflags) {
> - /* prefix metadata changed therefor move */
> - return (prefix_move(p, peer, asp, comm, nexthop,
> - nhflags, vstate));
> - }
> - p->lastchange = time(NULL);
> - p->validation_state = vstate;
> - return (0);
> - }
> + p = prefix_alloc();
> + prefix_link(p, re, peer, asp, comm, nexthop, nhflags, vstate);
> + return (1);
> }
>
> /*
>