Hi David,

I'll answer from my perspective (maybe not 100% correct).

Both your commands will create 2 paths with attached nexthop. It will
source the fib path for 10.0.0.2/32 based on the "connected" path for
10.0.0.0/24 (which is a glean path on the interface GigabitEthernet2/0/1).
You'd see it as "arp-ipv4: via 10.0.0.2 GigabitEthernet2/0/1".
So, when the first packet would come to dst in the 100.64.10.0/23, the arp
request will be sent automatically. After the arp response is processed, an
adj-fib path for 10.0.0.2/32 (with l2 headers) will be added. And there's
no need to iterate over all the routes with such nexthop.

I didn't get your use case, but I can assume one thing. In case your
control plane is responsible for adding such routes, you need only to
subscribe to neighbours events (want_ip_neighbor_events for the specific ip
address and/or interface). Then you can lookup routes in CP with such
nexthop and do whatever you want with those routes. In case your CP isn't
responsible for that, you need to dump all the routes from time to time and
do the same thing.

If you can tell more about your use-case there might be more bright ideas.

On Thu, 23 Dec 2021 at 14:13, David Gohberg <gohb...@gmail.com> wrote:

> Hello,
>
> From reading the routing data model:
>
> https://fdio-vpp.readthedocs.io/en/latest/gettingstarted/developers/fib20/routes.html#id2
> I understand that when I add a static route (using the "ip route add"
> command) to an attached next hop, VPP will resolve that
> route, which is triggered (in my case of plain ol' routing) by a
> successful ARP learning event. What I want is to perform
> some logic on each of the routes that their attached next-hop is a
> recently learned neighbor.
>
> Taking the example from the doc: if I use
> ip route add table 1 64.10.1.0/24 10.0.0.2 GigabitEthernet2/0/1
> ip route add table 1 64.10.2.0/24 10.0.0.2 GigabitEthernet2/0/1
> then upon learning the MAC of 10.0.0.2 neighbor,
> I want to be able to programmatically fetch the 64.10.1.0/24 and
> 64.10.2.0/24 prefixes in that context of neighbor resolution.
>
> I've traced down the neighbor learning logic to `ip_neighbor_add` function
> in `vnet/ip-neighbor/` but I couldn't figure out
> where VPP performs the route resolution following a neighbor learning
> event.
>
> If I understand the model correctly, a new neighbor IP and MAC triggers a
> change to the adjacency table.
> In order to fetch the matching prefixes, I need to be able to iterate over
> entries of fib_entry_t , for each entry checking the fib_path_t it has, and
> whether the path's  ip_adjancency_t is matching the IP and MAC of the
> recently learned neighbor.
>
> Is my perception correct?
>
> Thanks,
> David
> 
>
>

-- 
Best regards
Stanislav Zaikin
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#20661): https://lists.fd.io/g/vpp-dev/message/20661
Mute This Topic: https://lists.fd.io/mt/87917518/21656
Mute #routing:https://lists.fd.io/g/vpp-dev/mutehashtag/routing
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to