mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 10:04:18 +00:00
Merge pull request #13335 from pguibert6WIND/bgp_lu_explicit_per_afi
bgpd: configure explicit-null for local paths per address family
This commit is contained in:
commit
8bc79f3855
@ -3087,10 +3087,13 @@ static bool bgp_lu_need_null_label(struct bgp *bgp,
|
|||||||
need_null_label:
|
need_null_label:
|
||||||
if (label == NULL)
|
if (label == NULL)
|
||||||
return true;
|
return true;
|
||||||
if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LU_EXPLICIT_NULL))
|
/* Disable PHP : explicit-null */
|
||||||
/* Disable PHP : explicit-null */
|
if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LU_IPV4_EXPLICIT_NULL) &&
|
||||||
*label = afi == AFI_IP ? MPLS_LABEL_IPV4_EXPLICIT_NULL
|
afi == AFI_IP)
|
||||||
: MPLS_LABEL_IPV6_EXPLICIT_NULL;
|
*label = MPLS_LABEL_IPV4_EXPLICIT_NULL;
|
||||||
|
else if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LU_IPV6_EXPLICIT_NULL) &&
|
||||||
|
afi == AFI_IP6)
|
||||||
|
*label = MPLS_LABEL_IPV6_EXPLICIT_NULL;
|
||||||
else
|
else
|
||||||
/* Enforced PHP popping: implicit-null */
|
/* Enforced PHP popping: implicit-null */
|
||||||
*label = MPLS_LABEL_IMPLICIT_NULL;
|
*label = MPLS_LABEL_IMPLICIT_NULL;
|
||||||
|
@ -2821,17 +2821,27 @@ DEFUN(no_bgp_ebgp_requires_policy, no_bgp_ebgp_requires_policy_cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEFPY(bgp_lu_uses_explicit_null, bgp_lu_uses_explicit_null_cmd,
|
DEFPY(bgp_lu_uses_explicit_null, bgp_lu_uses_explicit_null_cmd,
|
||||||
"[no] bgp labeled-unicast explicit-null",
|
"[no] bgp labeled-unicast <explicit-null|ipv4-explicit-null|ipv6-explicit-null>$value",
|
||||||
NO_STR BGP_STR
|
NO_STR BGP_STR
|
||||||
"BGP Labeled-unicast options\n"
|
"BGP Labeled-unicast options\n"
|
||||||
"Use explicit-null label values for local prefixes\n")
|
"Use explicit-null label values for all local prefixes\n"
|
||||||
|
"Use the IPv4 explicit-null label value for IPv4 local prefixes\n"
|
||||||
|
"Use the IPv6 explicit-null label value for IPv6 local prefixes\n")
|
||||||
{
|
{
|
||||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||||
|
uint64_t label_mode;
|
||||||
|
|
||||||
if (no)
|
if (strmatch(value, "ipv4-explicit-null"))
|
||||||
UNSET_FLAG(bgp->flags, BGP_FLAG_LU_EXPLICIT_NULL);
|
label_mode = BGP_FLAG_LU_IPV4_EXPLICIT_NULL;
|
||||||
|
else if (strmatch(value, "ipv6-explicit-null"))
|
||||||
|
label_mode = BGP_FLAG_LU_IPV6_EXPLICIT_NULL;
|
||||||
else
|
else
|
||||||
SET_FLAG(bgp->flags, BGP_FLAG_LU_EXPLICIT_NULL);
|
label_mode = BGP_FLAG_LU_IPV4_EXPLICIT_NULL |
|
||||||
|
BGP_FLAG_LU_IPV6_EXPLICIT_NULL;
|
||||||
|
if (no)
|
||||||
|
UNSET_FLAG(bgp->flags, label_mode);
|
||||||
|
else
|
||||||
|
SET_FLAG(bgp->flags, label_mode);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18250,8 +18260,17 @@ int bgp_config_write(struct vty *vty)
|
|||||||
? ""
|
? ""
|
||||||
: "no ");
|
: "no ");
|
||||||
|
|
||||||
if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LU_EXPLICIT_NULL))
|
if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LU_IPV4_EXPLICIT_NULL) &&
|
||||||
|
!!CHECK_FLAG(bgp->flags, BGP_FLAG_LU_IPV6_EXPLICIT_NULL))
|
||||||
vty_out(vty, " bgp labeled-unicast explicit-null\n");
|
vty_out(vty, " bgp labeled-unicast explicit-null\n");
|
||||||
|
else if (!!CHECK_FLAG(bgp->flags,
|
||||||
|
BGP_FLAG_LU_IPV4_EXPLICIT_NULL))
|
||||||
|
vty_out(vty,
|
||||||
|
" bgp labeled-unicast ipv4-explicit-null\n");
|
||||||
|
else if (!!CHECK_FLAG(bgp->flags,
|
||||||
|
BGP_FLAG_LU_IPV6_EXPLICIT_NULL))
|
||||||
|
vty_out(vty,
|
||||||
|
" bgp labeled-unicast ipv6-explicit-null\n");
|
||||||
|
|
||||||
/* draft-ietf-idr-deprecate-as-set-confed-set */
|
/* draft-ietf-idr-deprecate-as-set-confed-set */
|
||||||
if (bgp->reject_as_sets)
|
if (bgp->reject_as_sets)
|
||||||
|
@ -500,8 +500,10 @@ struct bgp {
|
|||||||
#define BGP_FLAG_HARD_ADMIN_RESET (1ULL << 31)
|
#define BGP_FLAG_HARD_ADMIN_RESET (1ULL << 31)
|
||||||
/* Evaluate the AIGP attribute during the best path selection process */
|
/* Evaluate the AIGP attribute during the best path selection process */
|
||||||
#define BGP_FLAG_COMPARE_AIGP (1ULL << 32)
|
#define BGP_FLAG_COMPARE_AIGP (1ULL << 32)
|
||||||
/* For BGP-LU, force local prefixes to use explicit-null label */
|
/* For BGP-LU, force IPv4 local prefixes to use ipv4-explicit-null label */
|
||||||
#define BGP_FLAG_LU_EXPLICIT_NULL (1ULL << 33)
|
#define BGP_FLAG_LU_IPV4_EXPLICIT_NULL (1ULL << 33)
|
||||||
|
/* For BGP-LU, force IPv6 local prefixes to use ipv6-explicit-null label */
|
||||||
|
#define BGP_FLAG_LU_IPV6_EXPLICIT_NULL (1ULL << 34)
|
||||||
|
|
||||||
/* BGP default address-families.
|
/* BGP default address-families.
|
||||||
* New peers inherit enabled afi/safis from bgp instance.
|
* New peers inherit enabled afi/safis from bgp instance.
|
||||||
|
@ -2780,7 +2780,7 @@ Labeled unicast
|
|||||||
|
|
||||||
*bgpd* supports labeled information, as per :rfc:`3107`.
|
*bgpd* supports labeled information, as per :rfc:`3107`.
|
||||||
|
|
||||||
.. clicmd:: bgp labeled-unicast explicit-null
|
.. clicmd:: bgp labeled-unicast <explicit-null|ipv4-explicit-null|ipv6-explicit-null>
|
||||||
|
|
||||||
By default, locally advertised prefixes use the `implicit-null` label to
|
By default, locally advertised prefixes use the `implicit-null` label to
|
||||||
encode in the outgoing NLRI. The following command uses the `explicit-null`
|
encode in the outgoing NLRI. The following command uses the `explicit-null`
|
||||||
|
Loading…
Reference in New Issue
Block a user