Skip to content

Conversation

@pguibert6WIND
Copy link
Member

Add ability to encapsulation L3VPN traffic directly into GRETAP interface, by using route-map.

@pguibert6WIND
Copy link
Member Author

ci:rerun

} else if (IS_ZEBRA_IF_VXLAN(ifp)) {
zebra_vxlan_if_dump_vty(vty, zebra_if);
} else if (IS_ZEBRA_IF_GRE(ifp)) {
} else if (IS_ZEBRA_IF_GRE(ifp) || IS_ZEBRA_IF_GRETAP(ifp)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure looks like you are missing this code in the json portion ( and this is EXACTLY why I didn't want a json specific function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right. I completely forgot the json part. Adding the support for it.

case ZEBRA_IF_GRE:
type = "frr-zebra:zif-gre";
break;
case ZEBRA_IF_GRETAP:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no changes in zebra/zapi_msg.c. Shouldn't we just change the IS_ZEBRA_IF_GRE to encompass a GRETAP interface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a change in zebra/zapi_msg.c... or I did not understand the question.

--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -77,6 +77,7 @@ static void zserv_encode_interface(struct stream *s, struct interface *ifp)
        stream_putl(s, ifp->mtu6);
        stream_putl(s, ifp->bandwidth);
        stream_putl(s, zif->link_ifindex);
+       stream_putl(s, ifp->zif_type);

I agree that GRE and GRETAP interfaces are similar.
But what about users that already have GRETAP interfaces used today for an other purpose?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are tests of if (IS_ZEBRA_GRE) in zapi_msg.c that you did not include the new test for to test if it is IS_ZEBRA_GRETAP`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha ok. yes, I need to clarify. today, only NHRP uses it, so NHRP is only GRE. But we have to take care of remaining code. Later GRE_SOURCE_SET and GRE_GET zapi messages should cover other kind of tunnels too.
So I added a comment.


/* Set nexthop to object */
struct rmap_l3vpn_nexthop_encapsulation_set {
uint8_t protocol;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we completely dropping the protocol?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About protocol, I need to think..

Link layer protocol is not precise enough to know I am over a GRETAP (LLT ETHERNET) or a GRE interface (LLT_IPGRE).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it was storing protocol and allowing matches against it, who have you broken with this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IP protocol of the 'rmap_l3vpn_nexthop_encapsulation_set'
structure is replaced by the zif_type, as interfaces used as backbone
for mpls ca either be ptp L3 GRE interfaces or ptp L2 GRE (GRETAP)
interfaces.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering IP6GRE and GRE equal for BGP.
I will use the same mechanism for IP6GRETAP and GRETAP interfaces.
So one new keywords: gretap

@donaldsharp
Copy link
Member

a) Documentation update
b) topotest to show this works.

@pguibert6WIND
Copy link
Member Author

ci:rerun

@pguibert6WIND pguibert6WIND force-pushed the rmap_encapsulation_gretap branch 2 times, most recently from 0505ea9 to a326503 Compare October 21, 2025 09:02
@pguibert6WIND
Copy link
Member Author

ci:rerun

@pguibert6WIND pguibert6WIND force-pushed the rmap_encapsulation_gretap branch from a326503 to 2962f58 Compare October 21, 2025 12:44
@pguibert6WIND
Copy link
Member Author

ci:rerun

@pguibert6WIND
Copy link
Member Author

@vayetze , there is a topotest added.

@pguibert6WIND pguibert6WIND force-pushed the rmap_encapsulation_gretap branch 4 times, most recently from ba6605d to 6b82fe6 Compare October 24, 2025 15:25
@frrbot frrbot bot added the libfrr label Oct 24, 2025
@pguibert6WIND pguibert6WIND force-pushed the rmap_encapsulation_gretap branch 3 times, most recently from 82def60 to 22bb12c Compare October 27, 2025 16:44
Add gretap interface information.

> Interface l2gre0 is up, line protocol is up
>   Link ups:       0    last: (never)
>   Link downs:     0    last: (never)
>   vrf: default
>   index 8 metric 0 mtu 1462 speed 0 txqlen 1000
>   flags: <UP,LOWER_UP,BROADCAST,RUNNING,MULTICAST>
>   MPLS  Not specified by CLI
>   Multicast config is Not specified by CLI
>   Shutdown config is Not specified by CLI
>   Type: Ethernet
>   HWaddr: 2e:dd:45:c2:12:44
>   inet6 fe80::2cdd:45ff:fec2:1244/64
>   Interface Type GRETAP
>   Interface Slave Type None
>   VTEP IP: 192.168.0.10 , remote 192.168.0.103
>   protodown: off

Some ZAPI code is GRE-specific for now, as only NHRP uses GRE
information.

Signed-off-by: Philippe Guibert <[email protected]>
The interface kind is needed by some daemons in order to apply some
filtering rules. The struct interface is shared between daemons via the
ZAPI socket.

Signed-off-by: Philippe Guibert <[email protected]>
Add new defines to detect ip6gre and ip6gretap interfaces.

Signed-off-by: Philippe Guibert <[email protected]>
Use the zebra interface type for the bgp route-map encapsulation gre
command. The IP protocol of the 'rmap_l3vpn_nexthop_encapsulation_set'
structure is replaced by the zif_type, as interfaces used as backbone
for mpls ca either be ptp L3 GRE interfaces or ptp L2 GRE (GRETAP)
interfaces.

Signed-off-by: Philippe Guibert <[email protected]>
Add support for gretap encapsulation type.

Signed-off-by: Philippe Guibert <[email protected]>
The bgp_vpnv4_gre test validates imported routes as ok when route-map is
detached. Whereas, The nexthop of MPLS paths must either be a labelled
nexthop or point to a GRE interface (by using route-map).

The case where this check does not matter is when local importation is
performed by using the 'import vrf' command. Fix this by applying the
automatic validation only when this command is used to import VPN paths.

Enforce the current topotest by really checking the invalidity of the path.
Apply black style to modified topotest.

Fixes: 93fd9cb ("bgpd: Validate imported routes next-hop that is in a default VRF")

Signed-off-by: Philippe Guibert <[email protected]>
The previous commit broke the bgp_vpn_import_nexthop_default_vrf test.
This test reproduced issue FRRouting#12502. By default, BGP imported MPLS paths
can not be selected, while the nexthop is not located under an MPLS
backbone, except for some exceptions. One of them is that the path is
learned by an eBGP peer located in a connected network segment. This is
what is described in [0], section b). For that, the per-interface 'mpls
bgp forwarding' command aims at helping validating the incoming BGP
path.

Add config command for test 'vpnv4_import_allowas_in' and for
'vpnv4_import_nexthop_default_vrf' that have been implemented on the
same model.

[0] https://datatracker.ietf.org/doc/html/rfc4364#section-10

Link: FRRouting@34f7a57
Link: FRRouting#12502

Signed-off-by: Philippe Guibert <[email protected]>
Add a test that demonstrates that an MPLS path can be installed over a
GRETAP interface, if a route-map autorises it.

Signed-off-by: Philippe Guibert <[email protected]>
The previous commit broke some IGP tests that were not using MPLS paths.
Move the test to be an eBGP peering, and use the interAS option that
allows bgp paths to be imported.

Signed-off-by: Philippe Guibert <[email protected]>
Like it has been done on previous commits, use the inter-AS option B
mechanism to autorise ebgp connection to convey directly MPLS paths
without any MPLS backbone support.

Signed-off-by: Philippe Guibert <[email protected]>
@pguibert6WIND pguibert6WIND force-pushed the rmap_encapsulation_gretap branch from 22bb12c to 5dc35cb Compare October 28, 2025 10:05
@pguibert6WIND
Copy link
Member Author

@ton31337 @donaldsharp , any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants