Add an arc from your node to the "error-drop" node, set next0 = 
MYNODE_NEXT_ERROR and b0->error = node->errors[SOME_ERROR].

Please use the standard dual/single - or quad/single - loop code pattern to 
walk the incoming vector of buffer indices. You will hate your life if you try 
to code the vector-walk from first principles. It's not impossible, but I it 
will be a waste of your time / a bunch of needless aggravation.

b0->sw_if_index[VLIB_TX] is interpreted in a couple of different ways. 
"ip4/6-lookup" interprets it as a fib index. "interface-output" interprets it 
as a [tx] hardware interface ID.

I'm not sure what you're trying to do, but if it involves an ip lookup, do NOT 
set b0->sw_if_index[VLIB_TX]. Let the fib code do its job, and send pkts to 
either the input nodes - if mandatory input checks / ttl decrement have not 
been performed - or to the lookup stage if e.g. you've rewritten the ip 
header(s) in some fashion.

HTH... Dave

-----Original Message-----
From: vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> On Behalf Of Avi Cohen (A)
Sent: Wednesday, March 7, 2018 6:38 AM
To: vpp-dev@lists.fd.io
Subject: [vpp-dev] VPP - mechanism to drop packets

Hi,
I'm implementing a simple policy plugin , below is the pseudo-code 

Go over the packets vector
While (there are packets to process )
{
Check if a packet match a specific rule
  If yes - set the out-interface for the packet to be transmitted
  Else - drop packet
} 

2 Question -
1. is there  any function/mechanism that implements a drop ? or any filed in 
the packet's metadata for drop marking ?
2. Regarding the set tx out interface - I see that I can set the 
sw_if_index[VLIB_TX] - so the packet will be later transmitted through this 
interface - is this correct ? 

Best Regards
Avi




-=-=-=-=-=-=-=-=-=-=-=-
Links:

You receive all messages sent to this group.

View/Reply Online (#8447): https://lists.fd.io/g/vpp-dev/message/8447
View All Messages In Topic (2): https://lists.fd.io/g/vpp-dev/topic/14153536
Mute This Topic: https://lists.fd.io/mt/14153536/21656
New Topic: https://lists.fd.io/g/vpp-dev/post

Change Your Subscription: https://lists.fd.io/g/vpp-dev/editsub/21656
Group Home: https://lists.fd.io/g/vpp-dev
Contact Group Owner: vpp-dev+ow...@lists.fd.io
Terms of Service: https://lists.fd.io/static/tos
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to