Hi Matt,

I have no explanation for why adj_index[VLIB_RX] is set to the same value as 
the TX, AFAICT it’s been that way since time immemorial 😉 I think we should 
change that logic to RX=TX; TX=lbi. I don’t see anything in the code that 
relies on RX being set to the TX.
In that case the RX will be the receive DPO which has the sw_if_index 
associated with the for-us FIB entry.

Is your plugin running as a for-us feature? That’s good if you want to see all 
the for-us packets. If you want per-prefix for-us you might consider a 
interposing your own DPO in that prefixes output chain. See the interposed 
gbp_policy_dpo_t for an example.

Regards,
neale



De : "Dave Barach (dbarach)" <dbar...@cisco.com>
Date : vendredi 14 juin 2019 à 20:30
À : "mgsm...@netgate.com" <mgsm...@netgate.com>, "Neale Ranns (nranns)" 
<nra...@cisco.com>
Objet : Re: [vpp-dev] identifying packets sent to a loopback address

This is a Neale Ranns question. Looping him in... HTH... Dave

________________________________
From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> on behalf of Matthew Smith via 
Lists.Fd.Io <mgsmith=netgate....@lists.fd.io>
Sent: Friday, June 14, 2019 1:52 PM
To: vpp-dev
Cc: vpp-dev@lists.fd.io
Subject: [vpp-dev] identifying packets sent to a loopback address

Hi,

I have a plugin node in which I want to process some received packets. When a 
packet is destined to an IP address that is configured on a loopback interface, 
I want to be able to lookup some data based on the sw_if_index of the loopback 
interface. Packets that are sent to the loopback address are received on 
hardware interfaces, so I cannot look at sw_if_index[VLIB_RX] in the vnet 
buffer opaque data to find out that the packet destination address belongs to a 
loopback. I was hoping that ip.adj_index[VLIB_TX] would contain data that would 
help me do what I'm trying to do, but that does not seem to be the case. In 
ip4-lookup, a FIB entry is found which matches the loopback address. The index 
of the adjacency for the path is stored in ip.adj_index[VLIB_TX]. But the 
stored value is subsequently overwritten in ip4-local during the call to 
ip4_local_check_src(). That function does a lookup on the source IP address and 
overwrites both ip.adj_index[VLIB_RX] and ip.adj_index[VLIB_TX] with the index 
retrieved by the lookup.

I can work around this in my plugin code if I need to but it would be nice to 
be able to use the adjacency data that was retrieved by ip4-lookup. Would it 
break anything if ip4_local_check_src() only updates ip.adj_index[VLIB_RX] and 
leaves the contents of ip.adj_index[VLIB_TX] intact?

Thanks,
-Matt

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#13295): https://lists.fd.io/g/vpp-dev/message/13295
Mute This Topic: https://lists.fd.io/mt/32066650/21656
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