forked from Mirror/frr
zebra: Convert to struct zebra_nhlfe
as per our internal standard
We do not use typedef's to talk about structures as per our standard. Fixing. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
a7d2146a41
commit
f2595bd505
|
@ -1731,12 +1731,11 @@ static bool _netlink_route_build_multipath(const struct prefix *p,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool _netlink_mpls_build_singlepath(const struct prefix *p,
|
static inline bool
|
||||||
const char *routedesc,
|
_netlink_mpls_build_singlepath(const struct prefix *p, const char *routedesc,
|
||||||
const zebra_nhlfe_t *nhlfe,
|
const struct zebra_nhlfe *nhlfe,
|
||||||
struct nlmsghdr *nlmsg,
|
struct nlmsghdr *nlmsg, struct rtmsg *rtmsg,
|
||||||
struct rtmsg *rtmsg,
|
size_t req_size, int cmd)
|
||||||
size_t req_size, int cmd)
|
|
||||||
{
|
{
|
||||||
int bytelen;
|
int bytelen;
|
||||||
uint8_t family;
|
uint8_t family;
|
||||||
|
@ -1751,7 +1750,7 @@ static inline bool _netlink_mpls_build_singlepath(const struct prefix *p,
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
_netlink_mpls_build_multipath(const struct prefix *p, const char *routedesc,
|
_netlink_mpls_build_multipath(const struct prefix *p, const char *routedesc,
|
||||||
const zebra_nhlfe_t *nhlfe,
|
const struct zebra_nhlfe *nhlfe,
|
||||||
struct nlmsghdr *nlmsg, size_t req_size,
|
struct nlmsghdr *nlmsg, size_t req_size,
|
||||||
struct rtmsg *rtmsg, const union g_addr **src)
|
struct rtmsg *rtmsg, const union g_addr **src)
|
||||||
{
|
{
|
||||||
|
@ -4252,7 +4251,7 @@ ssize_t netlink_mpls_multipath_msg_encode(int cmd, struct zebra_dplane_ctx *ctx,
|
||||||
{
|
{
|
||||||
mpls_lse_t lse;
|
mpls_lse_t lse;
|
||||||
const struct nhlfe_list_head *head;
|
const struct nhlfe_list_head *head;
|
||||||
const zebra_nhlfe_t *nhlfe;
|
const struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *nexthop = NULL;
|
struct nexthop *nexthop = NULL;
|
||||||
unsigned int nexthop_num;
|
unsigned int nexthop_num;
|
||||||
const char *routedesc;
|
const char *routedesc;
|
||||||
|
|
|
@ -641,7 +641,7 @@ static void dplane_ctx_free_internal(struct zebra_dplane_ctx *ctx)
|
||||||
case DPLANE_OP_LSP_DELETE:
|
case DPLANE_OP_LSP_DELETE:
|
||||||
case DPLANE_OP_LSP_NOTIFY:
|
case DPLANE_OP_LSP_NOTIFY:
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
/* Unlink and free allocated NHLFEs */
|
/* Unlink and free allocated NHLFEs */
|
||||||
frr_each_safe(nhlfe_list, &ctx->u.lsp.nhlfe_list, nhlfe) {
|
frr_each_safe(nhlfe_list, &ctx->u.lsp.nhlfe_list, nhlfe) {
|
||||||
|
@ -1512,15 +1512,14 @@ const struct nhlfe_list_head *dplane_ctx_get_backup_nhlfe_list(
|
||||||
return &(ctx->u.lsp.backup_nhlfe_list);
|
return &(ctx->u.lsp.backup_nhlfe_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
zebra_nhlfe_t *dplane_ctx_add_nhlfe(struct zebra_dplane_ctx *ctx,
|
struct zebra_nhlfe *dplane_ctx_add_nhlfe(struct zebra_dplane_ctx *ctx,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t nh_type,
|
enum nexthop_types_t nh_type,
|
||||||
const union g_addr *gate,
|
const union g_addr *gate,
|
||||||
ifindex_t ifindex,
|
ifindex_t ifindex, uint8_t num_labels,
|
||||||
uint8_t num_labels,
|
mpls_label_t *out_labels)
|
||||||
mpls_label_t *out_labels)
|
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
DPLANE_CTX_VALID(ctx);
|
DPLANE_CTX_VALID(ctx);
|
||||||
|
|
||||||
|
@ -1531,15 +1530,12 @@ zebra_nhlfe_t *dplane_ctx_add_nhlfe(struct zebra_dplane_ctx *ctx,
|
||||||
return nhlfe;
|
return nhlfe;
|
||||||
}
|
}
|
||||||
|
|
||||||
zebra_nhlfe_t *dplane_ctx_add_backup_nhlfe(struct zebra_dplane_ctx *ctx,
|
struct zebra_nhlfe *dplane_ctx_add_backup_nhlfe(
|
||||||
enum lsp_types_t lsp_type,
|
struct zebra_dplane_ctx *ctx, enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t nh_type,
|
enum nexthop_types_t nh_type, const union g_addr *gate,
|
||||||
const union g_addr *gate,
|
ifindex_t ifindex, uint8_t num_labels, mpls_label_t *out_labels)
|
||||||
ifindex_t ifindex,
|
|
||||||
uint8_t num_labels,
|
|
||||||
mpls_label_t *out_labels)
|
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
DPLANE_CTX_VALID(ctx);
|
DPLANE_CTX_VALID(ctx);
|
||||||
|
|
||||||
|
@ -1551,7 +1547,7 @@ zebra_nhlfe_t *dplane_ctx_add_backup_nhlfe(struct zebra_dplane_ctx *ctx,
|
||||||
return nhlfe;
|
return nhlfe;
|
||||||
}
|
}
|
||||||
|
|
||||||
const zebra_nhlfe_t *
|
const struct zebra_nhlfe *
|
||||||
dplane_ctx_get_best_nhlfe(const struct zebra_dplane_ctx *ctx)
|
dplane_ctx_get_best_nhlfe(const struct zebra_dplane_ctx *ctx)
|
||||||
{
|
{
|
||||||
DPLANE_CTX_VALID(ctx);
|
DPLANE_CTX_VALID(ctx);
|
||||||
|
@ -1559,9 +1555,9 @@ dplane_ctx_get_best_nhlfe(const struct zebra_dplane_ctx *ctx)
|
||||||
return ctx->u.lsp.best_nhlfe;
|
return ctx->u.lsp.best_nhlfe;
|
||||||
}
|
}
|
||||||
|
|
||||||
const zebra_nhlfe_t *
|
const struct zebra_nhlfe *
|
||||||
dplane_ctx_set_best_nhlfe(struct zebra_dplane_ctx *ctx,
|
dplane_ctx_set_best_nhlfe(struct zebra_dplane_ctx *ctx,
|
||||||
zebra_nhlfe_t *nhlfe)
|
struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
DPLANE_CTX_VALID(ctx);
|
DPLANE_CTX_VALID(ctx);
|
||||||
|
|
||||||
|
@ -2407,7 +2403,7 @@ int dplane_ctx_lsp_init(struct zebra_dplane_ctx *ctx, enum dplane_op_e op,
|
||||||
zebra_lsp_t *lsp)
|
zebra_lsp_t *lsp)
|
||||||
{
|
{
|
||||||
int ret = AOK;
|
int ret = AOK;
|
||||||
zebra_nhlfe_t *nhlfe, *new_nhlfe;
|
struct zebra_nhlfe *nhlfe, *new_nhlfe;
|
||||||
|
|
||||||
ctx->zd_op = op;
|
ctx->zd_op = op;
|
||||||
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
|
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
|
||||||
|
@ -3267,7 +3263,7 @@ dplane_lsp_notif_update(zebra_lsp_t *lsp,
|
||||||
int ret = EINVAL;
|
int ret = EINVAL;
|
||||||
struct zebra_dplane_ctx *ctx = NULL;
|
struct zebra_dplane_ctx *ctx = NULL;
|
||||||
struct nhlfe_list_head *head;
|
struct nhlfe_list_head *head;
|
||||||
zebra_nhlfe_t *nhlfe, *new_nhlfe;
|
struct zebra_nhlfe *nhlfe, *new_nhlfe;
|
||||||
|
|
||||||
/* Obtain context block */
|
/* Obtain context block */
|
||||||
ctx = dplane_ctx_alloc();
|
ctx = dplane_ctx_alloc();
|
||||||
|
|
|
@ -401,26 +401,23 @@ const struct nhlfe_list_head *dplane_ctx_get_nhlfe_list(
|
||||||
const struct nhlfe_list_head *dplane_ctx_get_backup_nhlfe_list(
|
const struct nhlfe_list_head *dplane_ctx_get_backup_nhlfe_list(
|
||||||
const struct zebra_dplane_ctx *ctx);
|
const struct zebra_dplane_ctx *ctx);
|
||||||
|
|
||||||
zebra_nhlfe_t *dplane_ctx_add_nhlfe(struct zebra_dplane_ctx *ctx,
|
struct zebra_nhlfe *dplane_ctx_add_nhlfe(struct zebra_dplane_ctx *ctx,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t nh_type,
|
enum nexthop_types_t nh_type,
|
||||||
const union g_addr *gate,
|
const union g_addr *gate,
|
||||||
ifindex_t ifindex,
|
ifindex_t ifindex, uint8_t num_labels,
|
||||||
uint8_t num_labels,
|
mpls_label_t *out_labels);
|
||||||
mpls_label_t *out_labels);
|
|
||||||
|
|
||||||
zebra_nhlfe_t *dplane_ctx_add_backup_nhlfe(struct zebra_dplane_ctx *ctx,
|
struct zebra_nhlfe *dplane_ctx_add_backup_nhlfe(
|
||||||
enum lsp_types_t lsp_type,
|
struct zebra_dplane_ctx *ctx, enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t nh_type,
|
enum nexthop_types_t nh_type, const union g_addr *gate,
|
||||||
const union g_addr *gate,
|
ifindex_t ifindex, uint8_t num_labels, mpls_label_t *out_labels);
|
||||||
ifindex_t ifindex,
|
|
||||||
uint8_t num_labels,
|
|
||||||
mpls_label_t *out_labels);
|
|
||||||
|
|
||||||
const zebra_nhlfe_t *dplane_ctx_get_best_nhlfe(
|
const struct zebra_nhlfe *
|
||||||
const struct zebra_dplane_ctx *ctx);
|
dplane_ctx_get_best_nhlfe(const struct zebra_dplane_ctx *ctx);
|
||||||
const zebra_nhlfe_t *dplane_ctx_set_best_nhlfe(struct zebra_dplane_ctx *ctx,
|
const struct zebra_nhlfe *
|
||||||
zebra_nhlfe_t *nhlfe);
|
dplane_ctx_set_best_nhlfe(struct zebra_dplane_ctx *ctx,
|
||||||
|
struct zebra_nhlfe *nhlfe);
|
||||||
uint32_t dplane_ctx_get_lsp_num_ecmp(const struct zebra_dplane_ctx *ctx);
|
uint32_t dplane_ctx_get_lsp_num_ecmp(const struct zebra_dplane_ctx *ctx);
|
||||||
|
|
||||||
/* Accessors for pseudowire information */
|
/* Accessors for pseudowire information */
|
||||||
|
|
|
@ -77,11 +77,11 @@ static int fec_del(zebra_fec_t *fec);
|
||||||
|
|
||||||
static unsigned int label_hash(const void *p);
|
static unsigned int label_hash(const void *p);
|
||||||
static bool label_cmp(const void *p1, const void *p2);
|
static bool label_cmp(const void *p1, const void *p2);
|
||||||
static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
|
static int nhlfe_nexthop_active_ipv4(struct zebra_nhlfe *nhlfe,
|
||||||
struct nexthop *nexthop);
|
struct nexthop *nexthop);
|
||||||
static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
|
static int nhlfe_nexthop_active_ipv6(struct zebra_nhlfe *nhlfe,
|
||||||
struct nexthop *nexthop);
|
struct nexthop *nexthop);
|
||||||
static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe);
|
static int nhlfe_nexthop_active(struct zebra_nhlfe *nhlfe);
|
||||||
|
|
||||||
static void lsp_select_best_nhlfe(zebra_lsp_t *lsp);
|
static void lsp_select_best_nhlfe(zebra_lsp_t *lsp);
|
||||||
static void lsp_uninstall_from_kernel(struct hash_bucket *bucket, void *ctxt);
|
static void lsp_uninstall_from_kernel(struct hash_bucket *bucket, void *ctxt);
|
||||||
|
@ -98,28 +98,31 @@ static void lsp_check_free(struct hash *lsp_table, zebra_lsp_t **plsp);
|
||||||
/* Free lsp; sets caller's pointer to NULL */
|
/* Free lsp; sets caller's pointer to NULL */
|
||||||
static void lsp_free(struct hash *lsp_table, zebra_lsp_t **plsp);
|
static void lsp_free(struct hash *lsp_table, zebra_lsp_t **plsp);
|
||||||
|
|
||||||
static char *nhlfe2str(const zebra_nhlfe_t *nhlfe, char *buf, int size);
|
static char *nhlfe2str(const struct zebra_nhlfe *nhlfe, char *buf, int size);
|
||||||
static char *nhlfe_config_str(const zebra_nhlfe_t *nhlfe, char *buf, int size);
|
static char *nhlfe_config_str(const struct zebra_nhlfe *nhlfe, char *buf,
|
||||||
static int nhlfe_nhop_match(zebra_nhlfe_t *nhlfe, enum nexthop_types_t gtype,
|
int size);
|
||||||
|
static int nhlfe_nhop_match(struct zebra_nhlfe *nhlfe,
|
||||||
|
enum nexthop_types_t gtype,
|
||||||
const union g_addr *gate, ifindex_t ifindex);
|
const union g_addr *gate, ifindex_t ifindex);
|
||||||
static zebra_nhlfe_t *nhlfe_find(struct nhlfe_list_head *list,
|
static struct zebra_nhlfe *nhlfe_find(struct nhlfe_list_head *list,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t gtype,
|
enum nexthop_types_t gtype,
|
||||||
const union g_addr *gate, ifindex_t ifindex);
|
const union g_addr *gate,
|
||||||
static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
ifindex_t ifindex);
|
||||||
enum nexthop_types_t gtype,
|
static struct zebra_nhlfe *
|
||||||
const union g_addr *gate, ifindex_t ifindex,
|
nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
||||||
uint8_t num_labels, const mpls_label_t *labels,
|
enum nexthop_types_t gtype, const union g_addr *gate,
|
||||||
bool is_backup);
|
ifindex_t ifindex, uint8_t num_labels, const mpls_label_t *labels,
|
||||||
static int nhlfe_del(zebra_nhlfe_t *nhlfe);
|
bool is_backup);
|
||||||
static void nhlfe_free(zebra_nhlfe_t *nhlfe);
|
static int nhlfe_del(struct zebra_nhlfe *nhlfe);
|
||||||
static void nhlfe_out_label_update(zebra_nhlfe_t *nhlfe,
|
static void nhlfe_free(struct zebra_nhlfe *nhlfe);
|
||||||
|
static void nhlfe_out_label_update(struct zebra_nhlfe *nhlfe,
|
||||||
struct mpls_label_stack *nh_label);
|
struct mpls_label_stack *nh_label);
|
||||||
static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
|
static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
|
||||||
enum lsp_types_t type);
|
enum lsp_types_t type);
|
||||||
static int mpls_static_lsp_uninstall_all(struct zebra_vrf *zvrf,
|
static int mpls_static_lsp_uninstall_all(struct zebra_vrf *zvrf,
|
||||||
mpls_label_t in_label);
|
mpls_label_t in_label);
|
||||||
static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty,
|
static void nhlfe_print(struct zebra_nhlfe *nhlfe, struct vty *vty,
|
||||||
const char *indent);
|
const char *indent);
|
||||||
static void lsp_print(struct vty *vty, zebra_lsp_t *lsp);
|
static void lsp_print(struct vty *vty, zebra_lsp_t *lsp);
|
||||||
static void mpls_lsp_uninstall_all_type(struct hash_bucket *bucket, void *ctxt);
|
static void mpls_lsp_uninstall_all_type(struct hash_bucket *bucket, void *ctxt);
|
||||||
|
@ -137,7 +140,7 @@ static int lsp_backup_znh_install(zebra_lsp_t *lsp, enum lsp_types_t type,
|
||||||
*/
|
*/
|
||||||
static void clear_nhlfe_installed(zebra_lsp_t *lsp)
|
static void clear_nhlfe_installed(zebra_lsp_t *lsp)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
|
|
||||||
frr_each_safe(nhlfe_list, &lsp->nhlfe_list, nhlfe) {
|
frr_each_safe(nhlfe_list, &lsp->nhlfe_list, nhlfe) {
|
||||||
|
@ -168,7 +171,7 @@ static int lsp_install(struct zebra_vrf *zvrf, mpls_label_t label,
|
||||||
struct hash *lsp_table;
|
struct hash *lsp_table;
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
enum lsp_types_t lsp_type;
|
enum lsp_types_t lsp_type;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
@ -273,7 +276,7 @@ static int lsp_uninstall(struct zebra_vrf *zvrf, mpls_label_t label)
|
||||||
struct hash *lsp_table;
|
struct hash *lsp_table;
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
|
@ -597,7 +600,7 @@ static bool label_cmp(const void *p1, const void *p2)
|
||||||
* the passed flag.
|
* the passed flag.
|
||||||
* NOTE: Looking only for connected routes right now.
|
* NOTE: Looking only for connected routes right now.
|
||||||
*/
|
*/
|
||||||
static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
|
static int nhlfe_nexthop_active_ipv4(struct zebra_nhlfe *nhlfe,
|
||||||
struct nexthop *nexthop)
|
struct nexthop *nexthop)
|
||||||
{
|
{
|
||||||
struct route_table *table;
|
struct route_table *table;
|
||||||
|
@ -647,7 +650,7 @@ static int nhlfe_nexthop_active_ipv4(zebra_nhlfe_t *nhlfe,
|
||||||
* the passed flag.
|
* the passed flag.
|
||||||
* NOTE: Looking only for connected routes right now.
|
* NOTE: Looking only for connected routes right now.
|
||||||
*/
|
*/
|
||||||
static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
|
static int nhlfe_nexthop_active_ipv6(struct zebra_nhlfe *nhlfe,
|
||||||
struct nexthop *nexthop)
|
struct nexthop *nexthop)
|
||||||
{
|
{
|
||||||
struct route_table *table;
|
struct route_table *table;
|
||||||
|
@ -692,7 +695,7 @@ static int nhlfe_nexthop_active_ipv6(zebra_nhlfe_t *nhlfe,
|
||||||
* or not.
|
* or not.
|
||||||
* NOTE: Each NHLFE points to only 1 nexthop.
|
* NOTE: Each NHLFE points to only 1 nexthop.
|
||||||
*/
|
*/
|
||||||
static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe)
|
static int nhlfe_nexthop_active(struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
@ -767,8 +770,8 @@ static int nhlfe_nexthop_active(zebra_nhlfe_t *nhlfe)
|
||||||
*/
|
*/
|
||||||
static void lsp_select_best_nhlfe(zebra_lsp_t *lsp)
|
static void lsp_select_best_nhlfe(zebra_lsp_t *lsp)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
zebra_nhlfe_t *best;
|
struct zebra_nhlfe *best;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
|
||||||
|
@ -899,7 +902,7 @@ static void lsp_schedule(struct hash_bucket *bucket, void *ctxt)
|
||||||
static wq_item_status lsp_process(struct work_queue *wq, void *data)
|
static wq_item_status lsp_process(struct work_queue *wq, void *data)
|
||||||
{
|
{
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *oldbest, *newbest;
|
struct zebra_nhlfe *oldbest, *newbest;
|
||||||
char buf[BUFSIZ], buf2[BUFSIZ];
|
char buf[BUFSIZ], buf2[BUFSIZ];
|
||||||
struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT);
|
struct zebra_vrf *zvrf = vrf_info_lookup(VRF_DEFAULT);
|
||||||
enum zebra_dplane_result res;
|
enum zebra_dplane_result res;
|
||||||
|
@ -976,7 +979,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (CHECK_FLAG(lsp->flags, LSP_FLAG_CHANGED)) {
|
} else if (CHECK_FLAG(lsp->flags, LSP_FLAG_CHANGED)) {
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
|
|
||||||
UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
|
UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);
|
||||||
|
@ -1033,7 +1036,7 @@ static void lsp_processq_del(struct work_queue *wq, void *data)
|
||||||
struct zebra_vrf *zvrf;
|
struct zebra_vrf *zvrf;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
struct hash *lsp_table;
|
struct hash *lsp_table;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
zvrf = vrf_info_lookup(VRF_DEFAULT);
|
||||||
assert(zvrf);
|
assert(zvrf);
|
||||||
|
@ -1138,7 +1141,7 @@ static void lsp_check_free(struct hash *lsp_table, zebra_lsp_t **plsp)
|
||||||
static void lsp_free(struct hash *lsp_table, zebra_lsp_t **plsp)
|
static void lsp_free(struct hash *lsp_table, zebra_lsp_t **plsp)
|
||||||
{
|
{
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
if (plsp == NULL || *plsp == NULL)
|
if (plsp == NULL || *plsp == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -1166,7 +1169,7 @@ static void lsp_free(struct hash *lsp_table, zebra_lsp_t **plsp)
|
||||||
/*
|
/*
|
||||||
* Create printable string for NHLFE entry.
|
* Create printable string for NHLFE entry.
|
||||||
*/
|
*/
|
||||||
static char *nhlfe2str(const zebra_nhlfe_t *nhlfe, char *buf, int size)
|
static char *nhlfe2str(const struct zebra_nhlfe *nhlfe, char *buf, int size)
|
||||||
{
|
{
|
||||||
const struct nexthop *nexthop;
|
const struct nexthop *nexthop;
|
||||||
|
|
||||||
|
@ -1193,7 +1196,8 @@ static char *nhlfe2str(const zebra_nhlfe_t *nhlfe, char *buf, int size)
|
||||||
/*
|
/*
|
||||||
* Check if NHLFE matches with search info passed.
|
* Check if NHLFE matches with search info passed.
|
||||||
*/
|
*/
|
||||||
static int nhlfe_nhop_match(zebra_nhlfe_t *nhlfe, enum nexthop_types_t gtype,
|
static int nhlfe_nhop_match(struct zebra_nhlfe *nhlfe,
|
||||||
|
enum nexthop_types_t gtype,
|
||||||
const union g_addr *gate, ifindex_t ifindex)
|
const union g_addr *gate, ifindex_t ifindex)
|
||||||
{
|
{
|
||||||
struct nexthop *nhop;
|
struct nexthop *nhop;
|
||||||
|
@ -1235,12 +1239,13 @@ static int nhlfe_nhop_match(zebra_nhlfe_t *nhlfe, enum nexthop_types_t gtype,
|
||||||
/*
|
/*
|
||||||
* Locate NHLFE that matches with passed info.
|
* Locate NHLFE that matches with passed info.
|
||||||
*/
|
*/
|
||||||
static zebra_nhlfe_t *nhlfe_find(struct nhlfe_list_head *list,
|
static struct zebra_nhlfe *nhlfe_find(struct nhlfe_list_head *list,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t gtype,
|
enum nexthop_types_t gtype,
|
||||||
const union g_addr *gate, ifindex_t ifindex)
|
const union g_addr *gate,
|
||||||
|
ifindex_t ifindex)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
frr_each_safe(nhlfe_list, list, nhlfe) {
|
frr_each_safe(nhlfe_list, list, nhlfe) {
|
||||||
if (nhlfe->type != lsp_type)
|
if (nhlfe->type != lsp_type)
|
||||||
|
@ -1255,18 +1260,17 @@ static zebra_nhlfe_t *nhlfe_find(struct nhlfe_list_head *list,
|
||||||
/*
|
/*
|
||||||
* Allocate and init new NHLFE.
|
* Allocate and init new NHLFE.
|
||||||
*/
|
*/
|
||||||
static zebra_nhlfe_t *nhlfe_alloc(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
static struct zebra_nhlfe *
|
||||||
enum nexthop_types_t gtype,
|
nhlfe_alloc(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
||||||
const union g_addr *gate, ifindex_t ifindex,
|
enum nexthop_types_t gtype, const union g_addr *gate,
|
||||||
uint8_t num_labels,
|
ifindex_t ifindex, uint8_t num_labels, const mpls_label_t *labels)
|
||||||
const mpls_label_t *labels)
|
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
|
|
||||||
assert(lsp);
|
assert(lsp);
|
||||||
|
|
||||||
nhlfe = XCALLOC(MTYPE_NHLFE, sizeof(zebra_nhlfe_t));
|
nhlfe = XCALLOC(MTYPE_NHLFE, sizeof(struct zebra_nhlfe));
|
||||||
|
|
||||||
nhlfe->lsp = lsp;
|
nhlfe->lsp = lsp;
|
||||||
nhlfe->type = lsp_type;
|
nhlfe->type = lsp_type;
|
||||||
|
@ -1311,13 +1315,14 @@ static zebra_nhlfe_t *nhlfe_alloc(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
||||||
* Add primary or backup NHLFE. Base entry must have been created and
|
* Add primary or backup NHLFE. Base entry must have been created and
|
||||||
* duplicate check done.
|
* duplicate check done.
|
||||||
*/
|
*/
|
||||||
static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
static struct zebra_nhlfe *nhlfe_add(zebra_lsp_t *lsp,
|
||||||
enum nexthop_types_t gtype,
|
enum lsp_types_t lsp_type,
|
||||||
const union g_addr *gate, ifindex_t ifindex,
|
enum nexthop_types_t gtype,
|
||||||
uint8_t num_labels, const mpls_label_t *labels,
|
const union g_addr *gate,
|
||||||
bool is_backup)
|
ifindex_t ifindex, uint8_t num_labels,
|
||||||
|
const mpls_label_t *labels, bool is_backup)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
if (!lsp)
|
if (!lsp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1350,7 +1355,7 @@ static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
||||||
/*
|
/*
|
||||||
* Common delete for NHLFEs.
|
* Common delete for NHLFEs.
|
||||||
*/
|
*/
|
||||||
static void nhlfe_free(zebra_nhlfe_t *nhlfe)
|
static void nhlfe_free(struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
if (!nhlfe)
|
if (!nhlfe)
|
||||||
return;
|
return;
|
||||||
|
@ -1368,7 +1373,7 @@ static void nhlfe_free(zebra_nhlfe_t *nhlfe)
|
||||||
/*
|
/*
|
||||||
* Disconnect NHLFE from LSP, and free. Entry must be present on LSP's list.
|
* Disconnect NHLFE from LSP, and free. Entry must be present on LSP's list.
|
||||||
*/
|
*/
|
||||||
static int nhlfe_del(zebra_nhlfe_t *nhlfe)
|
static int nhlfe_del(struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
|
|
||||||
|
@ -1398,7 +1403,7 @@ static int nhlfe_del(zebra_nhlfe_t *nhlfe)
|
||||||
/*
|
/*
|
||||||
* Update label for NHLFE entry.
|
* Update label for NHLFE entry.
|
||||||
*/
|
*/
|
||||||
static void nhlfe_out_label_update(zebra_nhlfe_t *nhlfe,
|
static void nhlfe_out_label_update(struct zebra_nhlfe *nhlfe,
|
||||||
struct mpls_label_stack *nh_label)
|
struct mpls_label_stack *nh_label)
|
||||||
{
|
{
|
||||||
nhlfe->nexthop->nh_label->label[0] = nh_label->label[0];
|
nhlfe->nexthop->nh_label->label[0] = nh_label->label[0];
|
||||||
|
@ -1407,7 +1412,7 @@ static void nhlfe_out_label_update(zebra_nhlfe_t *nhlfe,
|
||||||
static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
|
static int mpls_lsp_uninstall_all(struct hash *lsp_table, zebra_lsp_t *lsp,
|
||||||
enum lsp_types_t type)
|
enum lsp_types_t type)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
int schedule_lsp = 0;
|
int schedule_lsp = 0;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
|
@ -1497,7 +1502,7 @@ static int mpls_static_lsp_uninstall_all(struct zebra_vrf *zvrf,
|
||||||
return mpls_lsp_uninstall_all(lsp_table, lsp, ZEBRA_LSP_STATIC);
|
return mpls_lsp_uninstall_all(lsp_table, lsp, ZEBRA_LSP_STATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static json_object *nhlfe_json(zebra_nhlfe_t *nhlfe)
|
static json_object *nhlfe_json(struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
json_object *json_nhlfe = NULL;
|
json_object *json_nhlfe = NULL;
|
||||||
|
@ -1569,7 +1574,7 @@ static json_object *nhlfe_json(zebra_nhlfe_t *nhlfe)
|
||||||
/*
|
/*
|
||||||
* Print the NHLFE for a LSP forwarding entry.
|
* Print the NHLFE for a LSP forwarding entry.
|
||||||
*/
|
*/
|
||||||
static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty,
|
static void nhlfe_print(struct zebra_nhlfe *nhlfe, struct vty *vty,
|
||||||
const char *indent)
|
const char *indent)
|
||||||
{
|
{
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
|
@ -1631,7 +1636,7 @@ static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty,
|
||||||
*/
|
*/
|
||||||
static void lsp_print(struct vty *vty, zebra_lsp_t *lsp)
|
static void lsp_print(struct vty *vty, zebra_lsp_t *lsp)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe, *backup;
|
struct zebra_nhlfe *nhlfe, *backup;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
vty_out(vty, "Local label: %u%s\n", lsp->ile.in_label,
|
vty_out(vty, "Local label: %u%s\n", lsp->ile.in_label,
|
||||||
|
@ -1670,7 +1675,7 @@ static void lsp_print(struct vty *vty, zebra_lsp_t *lsp)
|
||||||
*/
|
*/
|
||||||
static json_object *lsp_json(zebra_lsp_t *lsp)
|
static json_object *lsp_json(zebra_lsp_t *lsp)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe = NULL;
|
struct zebra_nhlfe *nhlfe = NULL;
|
||||||
json_object *json = json_object_new_object();
|
json_object *json = json_object_new_object();
|
||||||
json_object *json_nhlfe_list = json_object_new_array();
|
json_object *json_nhlfe_list = json_object_new_array();
|
||||||
|
|
||||||
|
@ -1763,7 +1768,7 @@ void zebra_mpls_lsp_dplane_result(struct zebra_dplane_ctx *ctx)
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
struct hash *lsp_table;
|
struct hash *lsp_table;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
enum dplane_op_e op;
|
enum dplane_op_e op;
|
||||||
enum zebra_dplane_result status;
|
enum zebra_dplane_result status;
|
||||||
|
@ -1858,8 +1863,8 @@ static bool compare_notif_nhlfes(const struct nhlfe_list_head *ctx_head,
|
||||||
struct nhlfe_list_head *nhlfe_head,
|
struct nhlfe_list_head *nhlfe_head,
|
||||||
int *start_counter, int *end_counter)
|
int *start_counter, int *end_counter)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
const zebra_nhlfe_t *ctx_nhlfe;
|
const struct zebra_nhlfe *ctx_nhlfe;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
const struct nexthop *ctx_nexthop;
|
const struct nexthop *ctx_nexthop;
|
||||||
int start_count = 0, end_count = 0;
|
int start_count = 0, end_count = 0;
|
||||||
|
@ -1953,8 +1958,8 @@ static int update_nhlfes_from_ctx(struct nhlfe_list_head *nhlfe_head,
|
||||||
const struct nhlfe_list_head *ctx_head)
|
const struct nhlfe_list_head *ctx_head)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
const zebra_nhlfe_t *ctx_nhlfe;
|
const struct zebra_nhlfe *ctx_nhlfe;
|
||||||
struct nexthop *nexthop;
|
struct nexthop *nexthop;
|
||||||
const struct nexthop *ctx_nexthop;
|
const struct nexthop *ctx_nexthop;
|
||||||
bool is_debug = (IS_ZEBRA_DEBUG_DPLANE | IS_ZEBRA_DEBUG_MPLS);
|
bool is_debug = (IS_ZEBRA_DEBUG_DPLANE | IS_ZEBRA_DEBUG_MPLS);
|
||||||
|
@ -2198,13 +2203,11 @@ int zebra_mpls_lsp_uninstall(struct zebra_vrf *zvrf, struct route_node *rn,
|
||||||
* Add an NHLFE to an LSP, return the newly-added object. This path only changes
|
* Add an NHLFE to an LSP, return the newly-added object. This path only changes
|
||||||
* the LSP object - nothing is scheduled for processing, for example.
|
* the LSP object - nothing is scheduled for processing, for example.
|
||||||
*/
|
*/
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_nhlfe(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *
|
||||||
enum lsp_types_t lsp_type,
|
zebra_mpls_lsp_add_nhlfe(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t gtype,
|
enum nexthop_types_t gtype, const union g_addr *gate,
|
||||||
const union g_addr *gate,
|
ifindex_t ifindex, uint8_t num_labels,
|
||||||
ifindex_t ifindex,
|
const mpls_label_t *out_labels)
|
||||||
uint8_t num_labels,
|
|
||||||
const mpls_label_t *out_labels)
|
|
||||||
{
|
{
|
||||||
/* Just a public pass-through to the internal implementation */
|
/* Just a public pass-through to the internal implementation */
|
||||||
return nhlfe_add(lsp, lsp_type, gtype, gate, ifindex, num_labels,
|
return nhlfe_add(lsp, lsp_type, gtype, gate, ifindex, num_labels,
|
||||||
|
@ -2216,13 +2219,10 @@ zebra_nhlfe_t *zebra_mpls_lsp_add_nhlfe(zebra_lsp_t *lsp,
|
||||||
* This path only changes the LSP object - nothing is scheduled for
|
* This path only changes the LSP object - nothing is scheduled for
|
||||||
* processing, for example.
|
* processing, for example.
|
||||||
*/
|
*/
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_backup_nhlfe(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *zebra_mpls_lsp_add_backup_nhlfe(
|
||||||
enum lsp_types_t lsp_type,
|
zebra_lsp_t *lsp, enum lsp_types_t lsp_type, enum nexthop_types_t gtype,
|
||||||
enum nexthop_types_t gtype,
|
const union g_addr *gate, ifindex_t ifindex, uint8_t num_labels,
|
||||||
const union g_addr *gate,
|
const mpls_label_t *out_labels)
|
||||||
ifindex_t ifindex,
|
|
||||||
uint8_t num_labels,
|
|
||||||
const mpls_label_t *out_labels)
|
|
||||||
{
|
{
|
||||||
/* Just a public pass-through to the internal implementation */
|
/* Just a public pass-through to the internal implementation */
|
||||||
return nhlfe_add(lsp, lsp_type, gtype, gate, ifindex, num_labels,
|
return nhlfe_add(lsp, lsp_type, gtype, gate, ifindex, num_labels,
|
||||||
|
@ -2232,11 +2232,11 @@ zebra_nhlfe_t *zebra_mpls_lsp_add_backup_nhlfe(zebra_lsp_t *lsp,
|
||||||
/*
|
/*
|
||||||
* Add an NHLFE to an LSP based on a nexthop; return the newly-added object
|
* Add an NHLFE to an LSP based on a nexthop; return the newly-added object
|
||||||
*/
|
*/
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_nh(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *zebra_mpls_lsp_add_nh(zebra_lsp_t *lsp,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
const struct nexthop *nh)
|
const struct nexthop *nh)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
if (nh->nh_label == NULL || nh->nh_label->num_labels == 0)
|
if (nh->nh_label == NULL || nh->nh_label->num_labels == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2252,11 +2252,11 @@ zebra_nhlfe_t *zebra_mpls_lsp_add_nh(zebra_lsp_t *lsp,
|
||||||
* Add a backup NHLFE to an LSP based on a nexthop;
|
* Add a backup NHLFE to an LSP based on a nexthop;
|
||||||
* return the newly-added object.
|
* return the newly-added object.
|
||||||
*/
|
*/
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_backup_nh(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *zebra_mpls_lsp_add_backup_nh(zebra_lsp_t *lsp,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
const struct nexthop *nh)
|
const struct nexthop *nh)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
if (nh->nh_label == NULL || nh->nh_label->num_labels == 0)
|
if (nh->nh_label == NULL || nh->nh_label->num_labels == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2271,7 +2271,7 @@ zebra_nhlfe_t *zebra_mpls_lsp_add_backup_nh(zebra_lsp_t *lsp,
|
||||||
/*
|
/*
|
||||||
* Free an allocated NHLFE
|
* Free an allocated NHLFE
|
||||||
*/
|
*/
|
||||||
void zebra_mpls_nhlfe_free(zebra_nhlfe_t *nhlfe)
|
void zebra_mpls_nhlfe_free(struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
/* Just a pass-through to the internal implementation */
|
/* Just a pass-through to the internal implementation */
|
||||||
nhlfe_free(nhlfe);
|
nhlfe_free(nhlfe);
|
||||||
|
@ -3083,13 +3083,12 @@ znh_done:
|
||||||
* a new LSP entry or a new NHLFE for an existing in-label or an update of
|
* a new LSP entry or a new NHLFE for an existing in-label or an update of
|
||||||
* the out-label for an existing NHLFE (update case).
|
* the out-label for an existing NHLFE (update case).
|
||||||
*/
|
*/
|
||||||
static zebra_nhlfe_t *
|
static struct zebra_nhlfe *
|
||||||
lsp_add_nhlfe(zebra_lsp_t *lsp, enum lsp_types_t type,
|
lsp_add_nhlfe(zebra_lsp_t *lsp, enum lsp_types_t type, uint8_t num_out_labels,
|
||||||
uint8_t num_out_labels, const mpls_label_t *out_labels,
|
const mpls_label_t *out_labels, enum nexthop_types_t gtype,
|
||||||
enum nexthop_types_t gtype, const union g_addr *gate,
|
const union g_addr *gate, ifindex_t ifindex, bool is_backup)
|
||||||
ifindex_t ifindex, bool is_backup)
|
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
char buf[MPLS_LABEL_STRLEN];
|
char buf[MPLS_LABEL_STRLEN];
|
||||||
const char *backup_str;
|
const char *backup_str;
|
||||||
|
|
||||||
|
@ -3182,7 +3181,7 @@ int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,
|
||||||
struct hash *lsp_table;
|
struct hash *lsp_table;
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
lsp_table = zvrf->lsp_table;
|
lsp_table = zvrf->lsp_table;
|
||||||
|
@ -3213,7 +3212,7 @@ int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,
|
||||||
static int lsp_znh_install(zebra_lsp_t *lsp, enum lsp_types_t type,
|
static int lsp_znh_install(zebra_lsp_t *lsp, enum lsp_types_t type,
|
||||||
const struct zapi_nexthop *znh)
|
const struct zapi_nexthop *znh)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
nhlfe = lsp_add_nhlfe(lsp, type, znh->label_num, znh->labels,
|
nhlfe = lsp_add_nhlfe(lsp, type, znh->label_num, znh->labels,
|
||||||
znh->type, &znh->gate, znh->ifindex,
|
znh->type, &znh->gate, znh->ifindex,
|
||||||
|
@ -3251,7 +3250,7 @@ static int lsp_znh_install(zebra_lsp_t *lsp, enum lsp_types_t type,
|
||||||
static int lsp_backup_znh_install(zebra_lsp_t *lsp, enum lsp_types_t type,
|
static int lsp_backup_znh_install(zebra_lsp_t *lsp, enum lsp_types_t type,
|
||||||
const struct zapi_nexthop *znh)
|
const struct zapi_nexthop *znh)
|
||||||
{
|
{
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
nhlfe = lsp_add_nhlfe(lsp, type, znh->label_num,
|
nhlfe = lsp_add_nhlfe(lsp, type, znh->label_num,
|
||||||
znh->labels, znh->type, &znh->gate,
|
znh->labels, znh->type, &znh->gate,
|
||||||
|
@ -3297,7 +3296,7 @@ int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,
|
||||||
struct hash *lsp_table;
|
struct hash *lsp_table;
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
char buf[NEXTHOP_STRLEN];
|
char buf[NEXTHOP_STRLEN];
|
||||||
bool schedule_lsp = false;
|
bool schedule_lsp = false;
|
||||||
|
|
||||||
|
@ -3476,7 +3475,7 @@ int zebra_mpls_lsp_label_consistent(struct zebra_vrf *zvrf,
|
||||||
struct hash *slsp_table;
|
struct hash *slsp_table;
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
const struct nexthop *nh;
|
const struct nexthop *nh;
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
|
@ -3544,7 +3543,7 @@ int zebra_mpls_static_lsp_add(struct zebra_vrf *zvrf, mpls_label_t in_label,
|
||||||
struct hash *slsp_table;
|
struct hash *slsp_table;
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
|
@ -3623,7 +3622,7 @@ int zebra_mpls_static_lsp_del(struct zebra_vrf *zvrf, mpls_label_t in_label,
|
||||||
struct hash *slsp_table;
|
struct hash *slsp_table;
|
||||||
struct zebra_ile tmp_ile;
|
struct zebra_ile tmp_ile;
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
/* Lookup table. */
|
/* Lookup table. */
|
||||||
slsp_table = zvrf->slsp_table;
|
slsp_table = zvrf->slsp_table;
|
||||||
|
@ -3734,7 +3733,7 @@ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf,
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
json_object *json = NULL;
|
json_object *json = NULL;
|
||||||
zebra_lsp_t *lsp = NULL;
|
zebra_lsp_t *lsp = NULL;
|
||||||
zebra_nhlfe_t *nhlfe = NULL;
|
struct zebra_nhlfe *nhlfe = NULL;
|
||||||
struct listnode *node = NULL;
|
struct listnode *node = NULL;
|
||||||
struct list *lsp_list = hash_get_sorted_list(zvrf->lsp_table, lsp_cmp);
|
struct list *lsp_list = hash_get_sorted_list(zvrf->lsp_table, lsp_cmp);
|
||||||
|
|
||||||
|
@ -3825,7 +3824,8 @@ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf,
|
||||||
/*
|
/*
|
||||||
* Create printable string for static LSP configuration.
|
* Create printable string for static LSP configuration.
|
||||||
*/
|
*/
|
||||||
static char *nhlfe_config_str(const zebra_nhlfe_t *nhlfe, char *buf, int size)
|
static char *nhlfe_config_str(const struct zebra_nhlfe *nhlfe, char *buf,
|
||||||
|
int size)
|
||||||
{
|
{
|
||||||
const struct nexthop *nh;
|
const struct nexthop *nh;
|
||||||
|
|
||||||
|
@ -3867,7 +3867,7 @@ static char *nhlfe_config_str(const zebra_nhlfe_t *nhlfe, char *buf, int size)
|
||||||
int zebra_mpls_write_lsp_config(struct vty *vty, struct zebra_vrf *zvrf)
|
int zebra_mpls_write_lsp_config(struct vty *vty, struct zebra_vrf *zvrf)
|
||||||
{
|
{
|
||||||
zebra_lsp_t *lsp;
|
zebra_lsp_t *lsp;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *nh;
|
struct nexthop *nh;
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
struct list *slsp_list =
|
struct list *slsp_list =
|
||||||
|
|
|
@ -49,7 +49,6 @@ extern "C" {
|
||||||
|
|
||||||
/* Typedefs */
|
/* Typedefs */
|
||||||
|
|
||||||
typedef struct zebra_nhlfe_t_ zebra_nhlfe_t;
|
|
||||||
typedef struct zebra_lsp_t_ zebra_lsp_t;
|
typedef struct zebra_lsp_t_ zebra_lsp_t;
|
||||||
typedef struct zebra_fec_t_ zebra_fec_t;
|
typedef struct zebra_fec_t_ zebra_fec_t;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ PREDECL_DLIST(nhlfe_list);
|
||||||
/*
|
/*
|
||||||
* (Outgoing) nexthop label forwarding entry
|
* (Outgoing) nexthop label forwarding entry
|
||||||
*/
|
*/
|
||||||
struct zebra_nhlfe_t_ {
|
struct zebra_nhlfe {
|
||||||
/* Type of entry - static etc. */
|
/* Type of entry - static etc. */
|
||||||
enum lsp_types_t type;
|
enum lsp_types_t type;
|
||||||
|
|
||||||
|
@ -101,7 +100,7 @@ struct zebra_lsp_t_ {
|
||||||
/* List of NHLFEs, pointer to best, and num equal-cost. */
|
/* List of NHLFEs, pointer to best, and num equal-cost. */
|
||||||
struct nhlfe_list_head nhlfe_list;
|
struct nhlfe_list_head nhlfe_list;
|
||||||
|
|
||||||
zebra_nhlfe_t *best_nhlfe;
|
struct zebra_nhlfe *best_nhlfe;
|
||||||
uint32_t num_ecmp;
|
uint32_t num_ecmp;
|
||||||
|
|
||||||
/* Backup nhlfes, if present. The nexthop in a primary/active nhlfe
|
/* Backup nhlfes, if present. The nexthop in a primary/active nhlfe
|
||||||
|
@ -144,7 +143,7 @@ struct zebra_fec_t_ {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Declare typesafe list apis/macros */
|
/* Declare typesafe list apis/macros */
|
||||||
DECLARE_DLIST(nhlfe_list, struct zebra_nhlfe_t_, list);
|
DECLARE_DLIST(nhlfe_list, struct zebra_nhlfe, list);
|
||||||
|
|
||||||
/* Function declarations. */
|
/* Function declarations. */
|
||||||
|
|
||||||
|
@ -177,37 +176,32 @@ int zebra_mpls_lsp_uninstall(struct zebra_vrf *zvrf, struct route_node *rn,
|
||||||
struct route_entry *re);
|
struct route_entry *re);
|
||||||
|
|
||||||
/* Add an NHLFE to an LSP, return the newly-added object */
|
/* Add an NHLFE to an LSP, return the newly-added object */
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_nhlfe(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *
|
||||||
enum lsp_types_t lsp_type,
|
zebra_mpls_lsp_add_nhlfe(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
|
||||||
enum nexthop_types_t gtype,
|
enum nexthop_types_t gtype, const union g_addr *gate,
|
||||||
const union g_addr *gate,
|
ifindex_t ifindex, uint8_t num_labels,
|
||||||
ifindex_t ifindex,
|
const mpls_label_t *out_labels);
|
||||||
uint8_t num_labels,
|
|
||||||
const mpls_label_t *out_labels);
|
|
||||||
|
|
||||||
/* Add or update a backup NHLFE for an LSP; return the object */
|
/* Add or update a backup NHLFE for an LSP; return the object */
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_backup_nhlfe(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *zebra_mpls_lsp_add_backup_nhlfe(
|
||||||
enum lsp_types_t lsp_type,
|
zebra_lsp_t *lsp, enum lsp_types_t lsp_type, enum nexthop_types_t gtype,
|
||||||
enum nexthop_types_t gtype,
|
const union g_addr *gate, ifindex_t ifindex, uint8_t num_labels,
|
||||||
const union g_addr *gate,
|
const mpls_label_t *out_labels);
|
||||||
ifindex_t ifindex,
|
|
||||||
uint8_t num_labels,
|
|
||||||
const mpls_label_t *out_labels);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add NHLFE or backup NHLFE to an LSP based on a nexthop. These just maintain
|
* Add NHLFE or backup NHLFE to an LSP based on a nexthop. These just maintain
|
||||||
* the LSP and NHLFE objects; nothing is scheduled for processing.
|
* the LSP and NHLFE objects; nothing is scheduled for processing.
|
||||||
* Return: the newly-added object
|
* Return: the newly-added object
|
||||||
*/
|
*/
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_nh(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *zebra_mpls_lsp_add_nh(zebra_lsp_t *lsp,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
const struct nexthop *nh);
|
const struct nexthop *nh);
|
||||||
zebra_nhlfe_t *zebra_mpls_lsp_add_backup_nh(zebra_lsp_t *lsp,
|
struct zebra_nhlfe *zebra_mpls_lsp_add_backup_nh(zebra_lsp_t *lsp,
|
||||||
enum lsp_types_t lsp_type,
|
enum lsp_types_t lsp_type,
|
||||||
const struct nexthop *nh);
|
const struct nexthop *nh);
|
||||||
|
|
||||||
/* Free an allocated NHLFE */
|
/* Free an allocated NHLFE */
|
||||||
void zebra_mpls_nhlfe_free(zebra_nhlfe_t *nhlfe);
|
void zebra_mpls_nhlfe_free(struct zebra_nhlfe *nhlfe);
|
||||||
|
|
||||||
int zebra_mpls_fec_register(struct zebra_vrf *zvrf, struct prefix *p,
|
int zebra_mpls_fec_register(struct zebra_vrf *zvrf, struct prefix *p,
|
||||||
uint32_t label, uint32_t label_index,
|
uint32_t label, uint32_t label_index,
|
||||||
|
|
|
@ -44,7 +44,7 @@ struct {
|
||||||
} kr_state;
|
} kr_state;
|
||||||
|
|
||||||
static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
|
static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
|
||||||
const zebra_nhlfe_t *nhlfe)
|
const struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
struct iovec iov[5];
|
struct iovec iov[5];
|
||||||
struct rt_msghdr hdr;
|
struct rt_msghdr hdr;
|
||||||
|
@ -136,7 +136,7 @@ static int kernel_send_rtmsg_v4(int action, mpls_label_t in_label,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
|
static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
|
||||||
const zebra_nhlfe_t *nhlfe)
|
const struct zebra_nhlfe *nhlfe)
|
||||||
{
|
{
|
||||||
struct iovec iov[5];
|
struct iovec iov[5];
|
||||||
struct rt_msghdr hdr;
|
struct rt_msghdr hdr;
|
||||||
|
@ -240,7 +240,7 @@ static int kernel_send_rtmsg_v6(int action, mpls_label_t in_label,
|
||||||
static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
|
static int kernel_lsp_cmd(struct zebra_dplane_ctx *ctx)
|
||||||
{
|
{
|
||||||
const struct nhlfe_list_head *head;
|
const struct nhlfe_list_head *head;
|
||||||
const zebra_nhlfe_t *nhlfe;
|
const struct zebra_nhlfe *nhlfe;
|
||||||
const struct nexthop *nexthop = NULL;
|
const struct nexthop *nexthop = NULL;
|
||||||
unsigned int nexthop_num = 0;
|
unsigned int nexthop_num = 0;
|
||||||
int action;
|
int action;
|
||||||
|
|
|
@ -1965,7 +1965,7 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct route_entry *match = NULL;
|
struct route_entry *match = NULL;
|
||||||
int resolved;
|
int resolved;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
struct nexthop *newhop;
|
struct nexthop *newhop;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
rib_dest_t *dest;
|
rib_dest_t *dest;
|
||||||
|
|
|
@ -99,7 +99,7 @@ struct zebra_sr_policy *zebra_sr_policy_find_by_name(char *name)
|
||||||
static int zebra_sr_policy_notify_update_client(struct zebra_sr_policy *policy,
|
static int zebra_sr_policy_notify_update_client(struct zebra_sr_policy *policy,
|
||||||
struct zserv *client)
|
struct zserv *client)
|
||||||
{
|
{
|
||||||
const zebra_nhlfe_t *nhlfe;
|
const struct zebra_nhlfe *nhlfe;
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
uint32_t message = 0;
|
uint32_t message = 0;
|
||||||
unsigned long nump = 0;
|
unsigned long nump = 0;
|
||||||
|
@ -293,7 +293,7 @@ int zebra_sr_policy_validate(struct zebra_sr_policy *policy,
|
||||||
int zebra_sr_policy_bsid_install(struct zebra_sr_policy *policy)
|
int zebra_sr_policy_bsid_install(struct zebra_sr_policy *policy)
|
||||||
{
|
{
|
||||||
struct zapi_srte_tunnel *zt = &policy->segment_list;
|
struct zapi_srte_tunnel *zt = &policy->segment_list;
|
||||||
zebra_nhlfe_t *nhlfe;
|
struct zebra_nhlfe *nhlfe;
|
||||||
|
|
||||||
if (zt->local_label == MPLS_LABEL_NONE)
|
if (zt->local_label == MPLS_LABEL_NONE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue