diff options
| author | Mark Stapp <mjs@voltanet.io> | 2019-11-08 14:13:33 -0500 | 
|---|---|---|
| committer | Mark Stapp <mjs@voltanet.io> | 2020-03-27 09:37:02 -0400 | 
| commit | e4a1ec7454490af0ea45013cb279eb9b15edef51 (patch) | |
| tree | eb93d94f2b0e726a70dea73eeb8deeb18bb2be57 | |
| parent | ee8606ee39a50b8a644352be4881a77a5822911d (diff) | |
zebra,lib: use const in more apis
Use const with some args to ipaddr, zebra vxlan, mpls
lsp, and nexthop apis; add some extra checks to some
nexthop-related apis.
Signed-off-by: Mark Stapp <mjs@voltanet.io>
| -rw-r--r-- | lib/ipaddr.h | 2 | ||||
| -rw-r--r-- | lib/mpls.c | 2 | ||||
| -rw-r--r-- | lib/mpls.h | 5 | ||||
| -rw-r--r-- | lib/nexthop.c | 13 | ||||
| -rw-r--r-- | lib/nexthop.h | 13 | ||||
| -rw-r--r-- | lib/nexthop_group.c | 4 | ||||
| -rw-r--r-- | lib/nexthop_group.h | 2 | ||||
| -rw-r--r-- | lib/zclient.c | 2 | ||||
| -rw-r--r-- | lib/zclient.h | 3 | ||||
| -rw-r--r-- | zebra/zebra_mpls.c | 56 | ||||
| -rw-r--r-- | zebra/zebra_mpls.h | 4 | ||||
| -rw-r--r-- | zebra/zebra_vxlan.c | 45 | ||||
| -rw-r--r-- | zebra/zebra_vxlan.h | 6 | 
13 files changed, 94 insertions, 63 deletions
diff --git a/lib/ipaddr.h b/lib/ipaddr.h index c6372f1abb..cd7f79a04e 100644 --- a/lib/ipaddr.h +++ b/lib/ipaddr.h @@ -112,7 +112,7 @@ static inline void ipv4_to_ipv4_mapped_ipv6(struct in6_addr *in6,  /*   * convert an ipv4 mapped ipv6 address back to ipv4 address   */ -static inline void ipv4_mapped_ipv6_to_ipv4(struct in6_addr *in6, +static inline void ipv4_mapped_ipv6_to_ipv4(const struct in6_addr *in6,  					    struct in_addr *in)  {  	memset(in, 0, sizeof(struct in_addr)); diff --git a/lib/mpls.c b/lib/mpls.c index 759fe1206d..ac5792a686 100644 --- a/lib/mpls.c +++ b/lib/mpls.c @@ -79,7 +79,7 @@ int mpls_str2label(const char *label_str, uint8_t *num_labels,  /*   * Label to string conversion, labels in string separated by '/'.   */ -char *mpls_label2str(uint8_t num_labels, mpls_label_t *labels, char *buf, +char *mpls_label2str(uint8_t num_labels, const mpls_label_t *labels, char *buf,  		     int len, int pretty)  {  	char label_buf[BUFSIZ]; diff --git a/lib/mpls.h b/lib/mpls.h index 635ecc77a1..05cf2935e8 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -209,10 +209,13 @@ static inline char *label2str(mpls_label_t label, char *buf, size_t len)  int mpls_str2label(const char *label_str, uint8_t *num_labels,  		   mpls_label_t *labels); +/* Generic string buffer for label-stack-to-str */ +#define MPLS_LABEL_STRLEN 1024 +  /*   * Label to string conversion, labels in string separated by '/'.   */ -char *mpls_label2str(uint8_t num_labels, mpls_label_t *labels, char *buf, +char *mpls_label2str(uint8_t num_labels, const mpls_label_t *labels, char *buf,  		     int len, int pretty);  #ifdef __cplusplus diff --git a/lib/nexthop.c b/lib/nexthop.c index c3be0a71e6..68ce81c293 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -393,8 +393,8 @@ struct nexthop *nexthop_from_blackhole(enum blackhole_type bh_type)  }  /* Update nexthop with label information. */ -void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t type, -			uint8_t num_labels, mpls_label_t *label) +void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t ltype, +			uint8_t num_labels, const mpls_label_t *labels)  {  	struct mpls_label_stack *nh_label;  	int i; @@ -402,13 +402,18 @@ void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t type,  	if (num_labels == 0)  		return; -	nexthop->nh_label_type = type; +	/* Enforce limit on label stack size */ +	if (num_labels > MPLS_MAX_LABELS) +		num_labels = MPLS_MAX_LABELS; + +	nexthop->nh_label_type = ltype; +  	nh_label = XCALLOC(MTYPE_NH_LABEL,  			   sizeof(struct mpls_label_stack)  				   + num_labels * sizeof(mpls_label_t));  	nh_label->num_labels = num_labels;  	for (i = 0; i < num_labels; i++) -		nh_label->label[i] = *(label + i); +		nh_label->label[i] = *(labels + i);  	nexthop->nh_label = nh_label;  } diff --git a/lib/nexthop.h b/lib/nexthop.h index 6710914e40..8d7580f6b4 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -118,13 +118,22 @@ struct nexthop {  	uint8_t weight;  }; + +/* Utility to append one nexthop to another. */ +#define NEXTHOP_APPEND(to, new)           \ +	do {                              \ +		(to)->next = (new);       \ +		(new)->prev = (to);       \ +		(new)->next = NULL;       \ +	} while (0) +  struct nexthop *nexthop_new(void);  void nexthop_free(struct nexthop *nexthop);  void nexthops_free(struct nexthop *nexthop); -void nexthop_add_labels(struct nexthop *, enum lsp_types_t, uint8_t, -			mpls_label_t *); +void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t ltype, +			uint8_t num_labels, const mpls_label_t *labels);  void nexthop_del_labels(struct nexthop *);  /* diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index d660428bcd..c6479cf4ff 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -225,6 +225,10 @@ void nexthop_group_copy(struct nexthop_group *to,  void nexthop_group_delete(struct nexthop_group **nhg)  { +	/* OK to call with NULL group */ +	if ((*nhg) == NULL) +		return; +  	if ((*nhg)->nexthop)  		nexthops_free((*nhg)->nexthop); diff --git a/lib/nexthop_group.h b/lib/nexthop_group.h index f99a53f694..76e1e64ca5 100644 --- a/lib/nexthop_group.h +++ b/lib/nexthop_group.h @@ -57,6 +57,8 @@ void copy_nexthops(struct nexthop **tnh, const struct nexthop *nh,  uint32_t nexthop_group_hash_no_recurse(const struct nexthop_group *nhg);  uint32_t nexthop_group_hash(const struct nexthop_group *nhg);  void nexthop_group_mark_duplicates(struct nexthop_group *nhg); + +/* Add a nexthop to a list, enforcing the canonical sort order. */  void nexthop_group_add_sorted(struct nexthop_group *nhg,  			      struct nexthop *nexthop); diff --git a/lib/zclient.c b/lib/zclient.c index 1ac0e49e13..a8f973ab95 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -1388,7 +1388,7 @@ stream_failure:  	return false;  } -struct nexthop *nexthop_from_zapi_nexthop(struct zapi_nexthop *znh) +struct nexthop *nexthop_from_zapi_nexthop(const struct zapi_nexthop *znh)  {  	struct nexthop *n = nexthop_new(); diff --git a/lib/zclient.h b/lib/zclient.h index 4de42a35bb..03d0485f90 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -769,7 +769,8 @@ bool zapi_iptable_notify_decode(struct stream *s,  		uint32_t *unique,  		enum zapi_iptable_notify_owner *note); -extern struct nexthop *nexthop_from_zapi_nexthop(struct zapi_nexthop *znh); +extern struct nexthop *nexthop_from_zapi_nexthop( +	const struct zapi_nexthop *znh);  int zapi_nexthop_from_nexthop(struct zapi_nexthop *znh,  			      const struct nexthop *nh);  extern bool zapi_nexthop_update_decode(struct stream *s, diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index d373fdf370..999e91486d 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -98,14 +98,14 @@ static void lsp_free(struct hash *lsp_table, zebra_lsp_t **plsp);  static char *nhlfe2str(zebra_nhlfe_t *nhlfe, char *buf, int size);  static int nhlfe_nhop_match(zebra_nhlfe_t *nhlfe, enum nexthop_types_t gtype, -			    union g_addr *gate, ifindex_t ifindex); +			    const union g_addr *gate, ifindex_t ifindex);  static zebra_nhlfe_t *nhlfe_find(zebra_lsp_t *lsp, enum lsp_types_t lsp_type, -				 enum nexthop_types_t gtype, union g_addr *gate, -				 ifindex_t ifindex); +				 enum nexthop_types_t gtype, +				 const union g_addr *gate, ifindex_t ifindex);  static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type, -				enum nexthop_types_t gtype, union g_addr *gate, -				ifindex_t ifindex, uint8_t num_labels, -				mpls_label_t *labels); +				enum nexthop_types_t gtype, +				const union g_addr *gate, ifindex_t ifindex, +				uint8_t num_labels, mpls_label_t *labels);  static int nhlfe_del(zebra_nhlfe_t *snhlfe);  static void nhlfe_out_label_update(zebra_nhlfe_t *nhlfe,  				   struct mpls_label_stack *nh_label); @@ -117,13 +117,13 @@ static void nhlfe_print(zebra_nhlfe_t *nhlfe, struct vty *vty);  static void lsp_print(zebra_lsp_t *lsp, void *ctxt);  static void *slsp_alloc(void *p);  static int snhlfe_match(zebra_snhlfe_t *snhlfe, enum nexthop_types_t gtype, -			union g_addr *gate, ifindex_t ifindex); +			const union g_addr *gate, ifindex_t ifindex);  static zebra_snhlfe_t *snhlfe_find(zebra_slsp_t *slsp,  				   enum nexthop_types_t gtype, -				   union g_addr *gate, ifindex_t ifindex); +				   const union g_addr *gate, ifindex_t ifindex);  static zebra_snhlfe_t *snhlfe_add(zebra_slsp_t *slsp,  				  enum nexthop_types_t gtype, -				  union g_addr *gate, ifindex_t ifindex, +				  const union g_addr *gate, ifindex_t ifindex,  				  mpls_label_t out_label);  static int snhlfe_del(zebra_snhlfe_t *snhlfe);  static int snhlfe_del_all(zebra_slsp_t *slsp); @@ -960,7 +960,7 @@ static wq_item_status lsp_process(struct work_queue *wq, void *data)  			UNSET_FLAG(lsp->flags, LSP_FLAG_CHANGED);  			/* We leave the INSTALLED flag set here -			 * so we know an update in in-flight. +			 * so we know an update is in-flight.  			 */  			/* @@ -1149,7 +1149,7 @@ static char *nhlfe2str(zebra_nhlfe_t *nhlfe, char *buf, int size)   * Check if NHLFE matches with search info passed.   */  static int nhlfe_nhop_match(zebra_nhlfe_t *nhlfe, enum nexthop_types_t gtype, -			    union g_addr *gate, ifindex_t ifindex) +			    const union g_addr *gate, ifindex_t ifindex)  {  	struct nexthop *nhop;  	int cmp = 1; @@ -1191,8 +1191,8 @@ static int nhlfe_nhop_match(zebra_nhlfe_t *nhlfe, enum nexthop_types_t gtype,   * Locate NHLFE that matches with passed info.   */  static zebra_nhlfe_t *nhlfe_find(zebra_lsp_t *lsp, enum lsp_types_t lsp_type, -				 enum nexthop_types_t gtype, union g_addr *gate, -				 ifindex_t ifindex) +				 enum nexthop_types_t gtype, +				 const union g_addr *gate, ifindex_t ifindex)  {  	zebra_nhlfe_t *nhlfe; @@ -1214,9 +1214,9 @@ static zebra_nhlfe_t *nhlfe_find(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,   * check done.   */  static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type, -				enum nexthop_types_t gtype, union g_addr *gate, -				ifindex_t ifindex, uint8_t num_labels, -				mpls_label_t labels[]) +				enum nexthop_types_t gtype, +				const union g_addr *gate, ifindex_t ifindex, +				uint8_t num_labels, mpls_label_t labels[])  {  	zebra_nhlfe_t *nhlfe;  	struct nexthop *nexthop; @@ -1520,7 +1520,7 @@ static struct list *hash_get_sorted_list(struct hash *hash, void *cmp)  /*   * Compare two LSPs based on their label values.   */ -static int lsp_cmp(zebra_lsp_t *lsp1, zebra_lsp_t *lsp2) +static int lsp_cmp(const zebra_lsp_t *lsp1, const zebra_lsp_t *lsp2)  {  	if (lsp1->ile.in_label < lsp2->ile.in_label)  		return -1; @@ -1547,7 +1547,7 @@ static void *slsp_alloc(void *p)  /*   * Compare two static LSPs based on their label values.   */ -static int slsp_cmp(zebra_slsp_t *slsp1, zebra_slsp_t *slsp2) +static int slsp_cmp(const zebra_slsp_t *slsp1, const zebra_slsp_t *slsp2)  {  	if (slsp1->ile.in_label < slsp2->ile.in_label)  		return -1; @@ -1562,7 +1562,7 @@ static int slsp_cmp(zebra_slsp_t *slsp1, zebra_slsp_t *slsp2)   * Check if static NHLFE matches with search info passed.   */  static int snhlfe_match(zebra_snhlfe_t *snhlfe, enum nexthop_types_t gtype, -			union g_addr *gate, ifindex_t ifindex) +			const union g_addr *gate, ifindex_t ifindex)  {  	int cmp = 1; @@ -1593,7 +1593,7 @@ static int snhlfe_match(zebra_snhlfe_t *snhlfe, enum nexthop_types_t gtype,   */  static zebra_snhlfe_t *snhlfe_find(zebra_slsp_t *slsp,  				   enum nexthop_types_t gtype, -				   union g_addr *gate, ifindex_t ifindex) +				   const union g_addr *gate, ifindex_t ifindex)  {  	zebra_snhlfe_t *snhlfe; @@ -1615,7 +1615,7 @@ static zebra_snhlfe_t *snhlfe_find(zebra_slsp_t *slsp,   */  static zebra_snhlfe_t *snhlfe_add(zebra_slsp_t *slsp,  				  enum nexthop_types_t gtype, -				  union g_addr *gate, ifindex_t ifindex, +				  const union g_addr *gate, ifindex_t ifindex,  				  mpls_label_t out_label)  {  	zebra_snhlfe_t *snhlfe; @@ -2746,7 +2746,7 @@ int mpls_ftn_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,  int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,  		     mpls_label_t in_label, uint8_t num_out_labels,  		     mpls_label_t out_labels[], enum nexthop_types_t gtype, -		     union g_addr *gate, ifindex_t ifindex) +		     const union g_addr *gate, ifindex_t ifindex)  {  	struct hash *lsp_table;  	zebra_ile_t tmp_ile; @@ -2759,11 +2759,12 @@ int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,  	if (!lsp_table)  		return -1; -	/* If entry is present, exit. */ +	/* Find or create LSP object */  	tmp_ile.in_label = in_label;  	lsp = hash_get(lsp_table, &tmp_ile, lsp_alloc);  	if (!lsp)  		return -1; +  	nhlfe = nhlfe_find(lsp, type, gtype, gate, ifindex);  	if (nhlfe) {  		struct nexthop *nh = nhlfe->nexthop; @@ -2780,8 +2781,8 @@ int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,  			return 0;  		if (IS_ZEBRA_DEBUG_MPLS) { -			char buf2[BUFSIZ]; -			char buf3[BUFSIZ]; +			char buf2[MPLS_LABEL_STRLEN]; +			char buf3[MPLS_LABEL_STRLEN];  			nhlfe2str(nhlfe, buf, BUFSIZ);  			mpls_label2str(num_out_labels, out_labels, buf2, @@ -2842,7 +2843,7 @@ int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,   */  int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,  		       mpls_label_t in_label, enum nexthop_types_t gtype, -		       union g_addr *gate, ifindex_t ifindex) +		       const union g_addr *gate, ifindex_t ifindex)  {  	struct hash *lsp_table;  	zebra_ile_t tmp_ile; @@ -3056,11 +3057,12 @@ int zebra_mpls_static_lsp_add(struct zebra_vrf *zvrf, mpls_label_t in_label,  	if (!slsp_table)  		return -1; -	/* If entry is present, exit. */ +	/* Find or create LSP. */  	tmp_ile.in_label = in_label;  	slsp = hash_get(slsp_table, &tmp_ile, slsp_alloc);  	if (!slsp)  		return -1; +  	snhlfe = snhlfe_find(slsp, gtype, gate, ifindex);  	if (snhlfe) {  		if (snhlfe->out_label == out_label) diff --git a/zebra/zebra_mpls.h b/zebra/zebra_mpls.h index 2489e8e510..33cb614346 100644 --- a/zebra/zebra_mpls.h +++ b/zebra/zebra_mpls.h @@ -288,7 +288,7 @@ int mpls_ftn_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,  int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,  		     mpls_label_t in_label, uint8_t num_out_labels,  		     mpls_label_t out_labels[], enum nexthop_types_t gtype, -		     union g_addr *gate, ifindex_t ifindex); +		     const union g_addr *gate, ifindex_t ifindex);  /*   * Uninstall a particular NHLFE in the forwarding table. If this is @@ -296,7 +296,7 @@ int mpls_lsp_install(struct zebra_vrf *zvrf, enum lsp_types_t type,   */  int mpls_lsp_uninstall(struct zebra_vrf *zvrf, enum lsp_types_t type,  		       mpls_label_t in_label, enum nexthop_types_t gtype, -		       union g_addr *gate, ifindex_t ifindex); +		       const union g_addr *gate, ifindex_t ifindex);  /*   * Uninstall all NHLFEs for a particular LSP forwarding entry. diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index 2e1daa6fdf..aa2e5c91c9 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -121,11 +121,11 @@ static struct interface *zvni_map_to_macvlan(struct interface *br_if,  /* l3-vni next-hop neigh related APIs */  static zebra_neigh_t *zl3vni_nh_lookup(zebra_l3vni_t *zl3vni, -				       struct ipaddr *ip); +				       const struct ipaddr *ip);  static void *zl3vni_nh_alloc(void *p);  static zebra_neigh_t *zl3vni_nh_add(zebra_l3vni_t *zl3vni, -				    struct ipaddr *vtep_ip, -				    struct ethaddr *rmac); +				    const struct ipaddr *vtep_ip, +				    const struct ethaddr *rmac);  static int zl3vni_nh_del(zebra_l3vni_t *zl3vni, zebra_neigh_t *n);  static int zl3vni_nh_install(zebra_l3vni_t *zl3vni, zebra_neigh_t *n);  static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni, zebra_neigh_t *n); @@ -133,10 +133,10 @@ static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni, zebra_neigh_t *n);  /* l3-vni rmac related APIs */  static void zl3vni_print_rmac_hash(struct hash_bucket *, void *);  static zebra_mac_t *zl3vni_rmac_lookup(zebra_l3vni_t *zl3vni, -				       struct ethaddr *rmac); +				       const struct ethaddr *rmac);  static void *zl3vni_rmac_alloc(void *p);  static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, -				    struct ethaddr *rmac); +				    const struct ethaddr *rmac);  static int zl3vni_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac);  static int zl3vni_rmac_install(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac);  static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac); @@ -4434,7 +4434,7 @@ static void zl3vni_cleanup_all(struct hash_bucket *bucket, void *args)  }  static void rb_find_or_add_host(struct host_rb_tree_entry *hrbe, -				struct prefix *host) +				const struct prefix *host)  {  	struct host_rb_entry lookup;  	struct host_rb_entry *hle; @@ -4473,7 +4473,7 @@ static void rb_delete_host(struct host_rb_tree_entry *hrbe, struct prefix *host)   * Look up MAC hash entry.   */  static zebra_mac_t *zl3vni_rmac_lookup(zebra_l3vni_t *zl3vni, -				       struct ethaddr *rmac) +				       const struct ethaddr *rmac)  {  	zebra_mac_t tmp;  	zebra_mac_t *pmac; @@ -4502,7 +4502,8 @@ static void *zl3vni_rmac_alloc(void *p)  /*   * Add RMAC entry to l3-vni   */ -static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, struct ethaddr *rmac) +static zebra_mac_t *zl3vni_rmac_add(zebra_l3vni_t *zl3vni, +				    const struct ethaddr *rmac)  {  	zebra_mac_t tmp_rmac;  	zebra_mac_t *zrmac = NULL; @@ -4632,9 +4633,10 @@ static int zl3vni_rmac_uninstall(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac)  }  /* handle rmac add */ -static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, struct ethaddr *rmac, -				  struct ipaddr *vtep_ip, -				  struct prefix *host_prefix) +static int zl3vni_remote_rmac_add(zebra_l3vni_t *zl3vni, +				  const struct ethaddr *rmac, +				  const struct ipaddr *vtep_ip, +				  const struct prefix *host_prefix)  {  	char buf[ETHER_ADDR_STRLEN];  	char buf1[INET6_ADDRSTRLEN]; @@ -4709,7 +4711,8 @@ static void zl3vni_remote_rmac_del(zebra_l3vni_t *zl3vni, zebra_mac_t *zrmac,  /*   * Look up nh hash entry on a l3-vni.   */ -static zebra_neigh_t *zl3vni_nh_lookup(zebra_l3vni_t *zl3vni, struct ipaddr *ip) +static zebra_neigh_t *zl3vni_nh_lookup(zebra_l3vni_t *zl3vni, +				       const struct ipaddr *ip)  {  	zebra_neigh_t tmp;  	zebra_neigh_t *n; @@ -4739,8 +4742,9 @@ static void *zl3vni_nh_alloc(void *p)  /*   * Add neighbor entry.   */ -static zebra_neigh_t *zl3vni_nh_add(zebra_l3vni_t *zl3vni, struct ipaddr *ip, -				    struct ethaddr *mac) +static zebra_neigh_t *zl3vni_nh_add(zebra_l3vni_t *zl3vni, +				    const struct ipaddr *ip, +				    const struct ethaddr *mac)  {  	zebra_neigh_t tmp_n;  	zebra_neigh_t *n = NULL; @@ -4822,9 +4826,10 @@ static int zl3vni_nh_uninstall(zebra_l3vni_t *zl3vni, zebra_neigh_t *n)  }  /* add remote vtep as a neigh entry */ -static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, struct ipaddr *vtep_ip, -				struct ethaddr *rmac, -				struct prefix *host_prefix) +static int zl3vni_remote_nh_add(zebra_l3vni_t *zl3vni, +				const struct ipaddr *vtep_ip, +				const struct ethaddr *rmac, +				const struct prefix *host_prefix)  {  	char buf[ETHER_ADDR_STRLEN];  	char buf1[ETHER_ADDR_STRLEN]; @@ -5960,9 +5965,9 @@ int is_l3vni_for_prefix_routes_only(vni_t vni)  }  /* handle evpn route in vrf table */ -void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id, struct ethaddr *rmac, -				    struct ipaddr *vtep_ip, -				    struct prefix *host_prefix) +void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id, const struct ethaddr *rmac, +				    const struct ipaddr *vtep_ip, +				    const struct prefix *host_prefix)  {  	zebra_l3vni_t *zl3vni = NULL;  	struct ipaddr ipv4_vtep; diff --git a/zebra/zebra_vxlan.h b/zebra/zebra_vxlan.h index 6ca93f6cb6..a5c13a59e3 100644 --- a/zebra/zebra_vxlan.h +++ b/zebra/zebra_vxlan.h @@ -199,9 +199,9 @@ extern void zebra_vxlan_cleanup_tables(struct zebra_vrf *);  extern void zebra_vxlan_init(void);  extern void zebra_vxlan_disable(void);  extern void zebra_vxlan_evpn_vrf_route_add(vrf_id_t vrf_id, -					   struct ethaddr *rmac, -					   struct ipaddr *ip, -					   struct prefix *host_prefix); +					   const struct ethaddr *rmac, +					   const struct ipaddr *ip, +					   const struct prefix *host_prefix);  extern void zebra_vxlan_evpn_vrf_route_del(vrf_id_t vrf_id,  					   struct ipaddr *vtep_ip,  					   struct prefix *host_prefix);  | 
