Thanks for the follow-up. I've been working through this (new to DPOs)
and trying to wrap my head around things. Still a work in progress. If I
have the right pieces then my main issue is the stacking in step 3. Also
not certain on the index param in step 2. Maybe this can just be 0?
1) register
dpo_type_t my_dpo_mpls_type = dpo_register_new_type(my_vft, my_dpo_nodes)
2) set
fib_prefix_t pfx;
pfx.fp_proto = FIB_PROTOCOL_MPLS;
pfx.fp_len = 21;
pfx.fp_label = 100; // first label after pop/swap (12345->100)
dpo_proto_t dproto = fib_proto_to_dpo(pfx.fp_proto);
dpo_id_t my_dpo_id = DPO_INVALID
dpo_set(&my_dpo_id, my_dpo_mpls_type, dproto, ??? /* index */)
Don't know what to use for the index param. I see in some examples it's
used to select the instance (e.g. from a pool), but I don't have
anything like that.
3) stack
Don't know if I should use dpo_stack() or dpo_stack_from_node(). The
latter looks simpler, but for either case I'm not clear on what to use
for the parent. my_node should come after mpls-label-imposition-pipe or
mpls-output. Checked a few examples, but they didn't seem to apply here.
dpo_stack(my_dpo_type, dproto, &my_dpo_id, ??? /* parent */)
or
dpo_stack_from_node(my_node.index, &my_dpo_id, ??? /* parent */)
4) add new DPO to FIB
fib_table_entry_special_dpo_add(
fib_index, // provided via cli/api
&pfx, // from step 2
FIB_SOURCE_SPECIAL,
FIB_ENTRY_FLAG_EXCLUSIVE,
&my_dpo_id // from step 2
);
Thanks,
Jeff
On 1/8/26 22:43, Neale Ranns via lists.fd.io wrote:
Hi Jeff,
Sorry, it looks like I got my example links wrong; here’s a case for the
‘exclusive’: https://github.com/FDio/vpp/blob/master/src/plugins/
unittest/fib_test.c#L1552 <https://github.com/FDio/vpp/blob/master/src/
plugins/unittest/fib_test.c#L1552>
You’ll need your own DPO type and its equivalent create function will
replace example’s use of the lookup DPO. dpo_register_new_type is how
you register a new DPO type. There are lots of examples to copy.
You can chain/stack DPOs together if you want to use additional existing
functionality. For example, If you want MPLS label push functionality
then you can stack your DPO on an instance of a mpls_label_dpo_t.
/neale
*From: *[email protected] <[email protected]> on behalf of Jeff via
lists.fd.io <[email protected]>
*Date: *Friday, 9 January 2026 at 1:38 am
*To: *[email protected] <[email protected]>
*Subject: *Re: [vpp-dev] MPLS to node
Thanks for the guidance Neale, this definitely helps.
I think approach #2 suits my purpose. Looking at the example you linked
it looks like I'll use a combination of mpls_label_dpo_create() and
fib_table_entry_special_dpo_add(). I'm not clear on all the parameters
yet, but will look at it more and try some things. I'll circle back if I
can't figure it out.
Thanks again,
Jeff
On 1/6/26 17:51, Neale Ranns via lists.fd.io wrote:
Hi Jeff,
There isn’t a way to achieve that using the current CLI.
I would suggest you add a new CLI/API for your feature (e.g. jeff-feat
label 100 … ) and then if:
1. You want your feature to process then packet and then pass it on to
the normal FIB processing, you would ‘interpose’ your feature’s DPO in
the existing FIB chain (i.e. your CLI would be in addition to the usual
‘mpls local-label 100 …. via X’). see example: https://nam12.safelinks.protection.outlook.com/?
url=https%3A%2F%2Fgithub.com%2FFDio%2F&data=05%7C02%7Cneale%40graphiant.com%7Cc190e854586f470035ae08de4ec3947a%7C162101cdceb34e62ab2e3abc7aeede47%7C0%7C0%7C639034799091128835%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=wuH7VpPjER77JzkkYA60y6SC5OkwNkdLSOVvz%2Fm8E0o%3D&reserved=0
<https://github.com/FDio/>
vpp/blob/master/src/plugins/unittest/fib_test.c#L9824 <https://
github.com/FDio/vpp/blob/master/src/plugins/unittest/fib_test.c#L9824>
and your DPO will need to implement the interpose functionality:
https://nam12.safelinks.protection.outlook.com/?
url=https%3A%2F%2Fgithub.com%2FFDio%2Fvpp%2Fblob%2Fmaster%2Fsrc%2Fvnet%2Fdpo%2F&data=05%7C02%7Cneale%40graphiant.com%7Cc190e854586f470035ae08de4ec3947a%7C162101cdceb34e62ab2e3abc7aeede47%7C0%7C0%7C639034799091171335%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=CmJqf2SmEX2GfXvrW5ZOKub7V%2FEGr88x3KleNh5B66M%3D&reserved=0
<https://github.com/FDio/vpp/blob/master/src/vnet/dpo/>
mpls_label_dpo.c#L1239
<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FFDio%2Fvpp%2Fblob%2Fmaster%2Fsrc%2F&data=05%7C02%7Cneale%40graphiant.com%7Cc190e854586f470035ae08de4ec3947a%7C162101cdceb34e62ab2e3abc7aeede47%7C0%7C0%7C639034799091199914%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ClCjhtJru3zW2SOlwGM4iPLeRkvJHqoFPQJJkqPf6jo%3D&reserved=0
vnet/dpo/mpls_label_dpo.c#L1239>
2. you only want your node to handle the MPLS packets, in which case
your feature can directly create the MPLS table entry and provide the
DPO to use, e.g.: https://nam12.safelinks.protection.outlook.com/?
url=https%3A%2F%2Fgithub.com%2FFDio%2Fvpp%2Fblob%2Fmaster%2Fsrc%2Fplugins%2F&data=05%7C02%7Cneale%40graphiant.com%7Cc190e854586f470035ae08de4ec3947a%7C162101cdceb34e62ab2e3abc7aeede47%7C0%7C0%7C639034799091220816%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=D2jLVf9LXC2X3qJCvW03twfzS%2FR8POfHw2%2FShosmuiA%3D&reserved=0
<https://github.com/FDio/vpp/blob/master/src/plugins/>
unittest/fib_test.c#L9824
<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FFDio%2Fvpp%2Fblob%2Fmaster%2Fsrc%2F&data=05%7C02%7Cneale%40graphiant.com%7Cc190e854586f470035ae08de4ec3947a%7C162101cdceb34e62ab2e3abc7aeede47%7C0%7C0%7C639034799091240878%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=QxW6mrPSMq1jFVHQ9MOQkWhZrjV7SxBJ8flhM7nQ5cU%3D&reserved=0
plugins/unittest/fib_test.c#L9824>
/neale
*From: *[email protected] <[email protected]> on behalf of Jeff via
lists.fd.io <[email protected]>
*Date: *Wednesday, 7 January 2026 at 7:40 am
*To: *[email protected] <[email protected]>
*Subject: *[vpp-dev] MPLS to node
Hello,
Is it possible to send incoming MPLS traffic to my_node after a label
pop/swap? For example, if VPP receives an MPLS frame with label 12345:
1) pop label 12345
2) add labels 100 101 102
3) enqueue to my_node
Maybe something like the following, but I don't know if "mpls
local-label" supports sending to a custom node. I looked at the "via"
options in unformat_fib_route_path(), but nothing jumped out.
mpls table add 0
mpls local-label add 100 eos via <my_node> out-labels 100
mpls local-label add 100 non-eos via <my_node> out-labels 100
sr mpls policy add bsid 12345 next 100 next 101 next 102
or
mpls table add 0
mpls local-label add 12345 eos via <my_node> out-labels 100 101 102
mpls local-label add 12345 non-eos via <my_node> out-labels 100 101 102
Thanks,
Jeff
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#26713): https://lists.fd.io/g/vpp-dev/message/26713
Mute This Topic: https://lists.fd.io/mt/117112683/21656
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/14379924/21656/631435203/xyzzy
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-