diff options
Diffstat (limited to 'bgpd/rfapi/rfapi_import.h')
| -rw-r--r-- | bgpd/rfapi/rfapi_import.h | 281 | 
1 files changed, 117 insertions, 164 deletions
diff --git a/bgpd/rfapi/rfapi_import.h b/bgpd/rfapi/rfapi_import.h index 3ba76539dd..d43619ee8a 100644 --- a/bgpd/rfapi/rfapi_import.h +++ b/bgpd/rfapi/rfapi_import.h @@ -1,4 +1,4 @@ -/*  +/*   *   * Copyright 2009-2016, LabN Consulting, L.L.C.   * @@ -35,72 +35,60 @@   * routes are not segregated by RD - the RD is stored in bgp_info_extra   * and is needed to determine if two prefixes are the same.   */ -struct rfapi_import_table -{ -  struct rfapi_import_table *next; -  struct rfapi_nve_group_cfg *rfg; -  struct ecommunity *rt_import_list;    /* copied from nve grp */ -  int refcount;                 /* nve grps and nves */ -  uint32_t l2_logical_net_id;   /* L2 only: EVPN Eth Seg Id */ -  struct route_table *imported_vpn[AFI_MAX]; -  struct rfapi_monitor_vpn *vpn0_queries[AFI_MAX]; -  struct rfapi_monitor_eth *eth0_queries; -  struct route_table *imported_encap[AFI_MAX]; -  struct skiplist *monitor_exterior_orphans; -  int local_count[AFI_MAX]; -  int remote_count[AFI_MAX]; -  int holddown_count[AFI_MAX]; -  int imported_count[AFI_MAX]; +struct rfapi_import_table { +	struct rfapi_import_table *next; +	struct rfapi_nve_group_cfg *rfg; +	struct ecommunity *rt_import_list; /* copied from nve grp */ +	int refcount;			   /* nve grps and nves */ +	uint32_t l2_logical_net_id;	/* L2 only: EVPN Eth Seg Id */ +	struct route_table *imported_vpn[AFI_MAX]; +	struct rfapi_monitor_vpn *vpn0_queries[AFI_MAX]; +	struct rfapi_monitor_eth *eth0_queries; +	struct route_table *imported_encap[AFI_MAX]; +	struct skiplist *monitor_exterior_orphans; +	int local_count[AFI_MAX]; +	int remote_count[AFI_MAX]; +	int holddown_count[AFI_MAX]; +	int imported_count[AFI_MAX];  }; -#define RFAPI_LOCAL_BI(bi) \ -    (((bi)->type == ZEBRA_ROUTE_BGP) && ((bi)->sub_type == BGP_ROUTE_RFP)) +#define RFAPI_LOCAL_BI(bi)                                                     \ +	(((bi)->type == ZEBRA_ROUTE_BGP) && ((bi)->sub_type == BGP_ROUTE_RFP)) -#define RFAPI_DIRECT_IMPORT_BI(bi) \ -    (((bi)->type ==  ZEBRA_ROUTE_BGP_DIRECT) || ((bi)->type ==  ZEBRA_ROUTE_BGP_DIRECT_EXT)) +#define RFAPI_DIRECT_IMPORT_BI(bi)                                             \ +	(((bi)->type == ZEBRA_ROUTE_BGP_DIRECT)                                \ +	 || ((bi)->type == ZEBRA_ROUTE_BGP_DIRECT_EXT)) -#define RFAPI_UPDATE_ITABLE_COUNT(bi, itable, afi, cnt) \ -    if (RFAPI_LOCAL_BI(bi)) {				\ -	(itable)->local_count[(afi)] += (cnt);		\ -    } else {						\ -        if (RFAPI_DIRECT_IMPORT_BI(bi))                 \ -            (itable)->imported_count[(afi)] += (cnt);   \ -        else                                            \ -            (itable)->remote_count[(afi)]   += (cnt);   \ -    } +#define RFAPI_UPDATE_ITABLE_COUNT(bi, itable, afi, cnt)                        \ +	if (RFAPI_LOCAL_BI(bi)) {                                              \ +		(itable)->local_count[(afi)] += (cnt);                         \ +	} else {                                                               \ +		if (RFAPI_DIRECT_IMPORT_BI(bi))                                \ +			(itable)->imported_count[(afi)] += (cnt);              \ +		else                                                           \ +			(itable)->remote_count[(afi)] += (cnt);                \ +	} -extern uint8_t -rfapiRfpCost (struct attr *attr); +extern uint8_t rfapiRfpCost(struct attr *attr); -extern void -rfapiDebugBacktrace (void); +extern void rfapiDebugBacktrace(void); -extern void -rfapiCheckRouteCount (void); +extern void rfapiCheckRouteCount(void);  /*   * Print BI in an Import Table   */ -extern void -rfapiPrintBi (void *stream, struct bgp_info *bi); +extern void rfapiPrintBi(void *stream, struct bgp_info *bi); -extern void -rfapiShowImportTable ( -  void			*stream, -  const char		*label, -  struct route_table	*rt, -  int			isvpn); +extern void rfapiShowImportTable(void *stream, const char *label, +				 struct route_table *rt, int isvpn);  extern struct rfapi_import_table * -rfapiImportTableRefAdd ( -  struct bgp *bgp, -  struct ecommunity *rt_import_list, -  struct rfapi_nve_group_cfg *rfg); +rfapiImportTableRefAdd(struct bgp *bgp, struct ecommunity *rt_import_list, +		       struct rfapi_nve_group_cfg *rfg); -extern void -rfapiImportTableRefDelByIt ( -  struct bgp			*bgp, -  struct rfapi_import_table	*it_target); +extern void rfapiImportTableRefDelByIt(struct bgp *bgp, +				       struct rfapi_import_table *it_target);  /* @@ -112,106 +100,78 @@ rfapiImportTableRefDelByIt (   * then return those, and also include all the non-removed routes from the   * next less-specific node (i.e., this node's parent) at the end.   */ -extern struct rfapi_next_hop_entry * -rfapiRouteNode2NextHopList ( -  struct route_node	*rn, -  uint32_t		lifetime,		/* put into nexthop entries */ -  struct rfapi_ip_addr	*exclude_vnaddr,	/* omit routes to same NVE */ -  struct route_table    *rfd_rib_table,		/* preload this NVE rib table */ -  struct prefix		*pfx_target_original);	/* query target */ - -extern struct rfapi_next_hop_entry * -rfapiRouteTable2NextHopList ( -  struct route_table	*rt, -  uint32_t		lifetime,		/* put into nexthop entries */ -  struct rfapi_ip_addr	*exclude_vnaddr,	/* omit routes to same NVE */ -  struct route_table    *rfd_rib_table,		/* preload this NVE rib table */ -  struct prefix		*pfx_target_original);	/* query target */ - -extern struct rfapi_next_hop_entry * -rfapiEthRouteTable2NextHopList ( -  uint32_t			logical_net_id, -  struct rfapi_ip_prefix	*rprefix, -  uint32_t			lifetime,        /* put into nexthop entries */ -  struct rfapi_ip_addr		*exclude_vnaddr, /* omit routes to same NVE */ -  struct route_table            *rib_route_table,/* preload NVE rib node */ -  struct prefix			*pfx_target_original);	/* query target */ - -extern int -rfapiEcommunitiesIntersect (struct ecommunity *e1, struct ecommunity *e2); - -extern void -rfapiCheckRefcount (struct route_node *rn, safi_t safi, int lockoffset); - -extern int -rfapiHasNonRemovedRoutes (struct route_node *rn); - -extern int -rfapiProcessDeferredClose (struct thread *t); - -extern int -rfapiGetUnAddrOfVpnBi (struct bgp_info *bi, struct prefix *p); - -extern void -rfapiNexthop2Prefix (struct attr *attr, struct prefix *p); - -extern void -rfapiUnicastNexthop2Prefix ( -  afi_t		afi, -  struct attr	*attr, -  struct prefix	*p); +extern struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList( +	struct route_node *rn, uint32_t lifetime, /* put into nexthop entries */ +	struct rfapi_ip_addr *exclude_vnaddr,     /* omit routes to same NVE */ +	struct route_table *rfd_rib_table,   /* preload this NVE rib table */ +	struct prefix *pfx_target_original); /* query target */ + +extern struct rfapi_next_hop_entry *rfapiRouteTable2NextHopList( +	struct route_table *rt, +	uint32_t lifetime,		      /* put into nexthop entries */ +	struct rfapi_ip_addr *exclude_vnaddr, /* omit routes to same NVE */ +	struct route_table *rfd_rib_table,    /* preload this NVE rib table */ +	struct prefix *pfx_target_original);  /* query target */ + +extern struct rfapi_next_hop_entry *rfapiEthRouteTable2NextHopList( +	uint32_t logical_net_id, struct rfapi_ip_prefix *rprefix, +	uint32_t lifetime,		      /* put into nexthop entries */ +	struct rfapi_ip_addr *exclude_vnaddr, /* omit routes to same NVE */ +	struct route_table *rib_route_table,  /* preload NVE rib node */ +	struct prefix *pfx_target_original);  /* query target */ + +extern int rfapiEcommunitiesIntersect(struct ecommunity *e1, +				      struct ecommunity *e2); + +extern void rfapiCheckRefcount(struct route_node *rn, safi_t safi, +			       int lockoffset); + +extern int rfapiHasNonRemovedRoutes(struct route_node *rn); + +extern int rfapiProcessDeferredClose(struct thread *t); + +extern int rfapiGetUnAddrOfVpnBi(struct bgp_info *bi, struct prefix *p); + +extern void rfapiNexthop2Prefix(struct attr *attr, struct prefix *p); + +extern void rfapiUnicastNexthop2Prefix(afi_t afi, struct attr *attr, +				       struct prefix *p);  /* Filtered Import Function actions */  #define FIF_ACTION_UPDATE	0  #define FIF_ACTION_WITHDRAW	1  #define FIF_ACTION_KILL		2 -extern void -rfapiBgpInfoFilteredImportVPN ( -  struct rfapi_import_table	*import_table, -  int				action, -  struct peer			*peer, -  void				*rfd,		/* set for looped back routes */ -  struct prefix			*p, -  struct prefix			*aux_prefix,	/* AFI_ETHER: optional IP */ -  afi_t				afi, -  struct prefix_rd		*prd, -  struct attr			*attr,		/* part of bgp_info */ -  u_char			type,		/* part of bgp_info */ -  u_char			sub_type,	/* part of bgp_info */ -  uint32_t			*label);	/* part of bgp_info */ - -extern struct rfapi_next_hop_entry * -rfapiEthRouteNode2NextHopList ( -  struct route_node		*rn, -  struct rfapi_ip_prefix	*rprefix, -  uint32_t			lifetime,	 /* put into nexthop entries */ -  struct rfapi_ip_addr		*exclude_vnaddr, /* omit routes to same NVE */ -  struct route_table            *rib_route_table,/* preload NVE rib table */ -  struct prefix			*pfx_target_original); /* query target */ +extern void rfapiBgpInfoFilteredImportVPN( +	struct rfapi_import_table *import_table, int action, struct peer *peer, +	void *rfd, /* set for looped back routes */ +	struct prefix *p, +	struct prefix *aux_prefix, /* AFI_ETHER: optional IP */ +	afi_t afi, struct prefix_rd *prd, +	struct attr *attr, /* part of bgp_info */ +	u_char type,       /* part of bgp_info */ +	u_char sub_type,   /* part of bgp_info */ +	uint32_t *label);  /* part of bgp_info */ -extern struct rfapi_import_table * -rfapiMacImportTableGetNoAlloc ( -  struct bgp	*bgp, -  uint32_t	lni); +extern struct rfapi_next_hop_entry *rfapiEthRouteNode2NextHopList( +	struct route_node *rn, struct rfapi_ip_prefix *rprefix, +	uint32_t lifetime,		      /* put into nexthop entries */ +	struct rfapi_ip_addr *exclude_vnaddr, /* omit routes to same NVE */ +	struct route_table *rib_route_table,  /* preload NVE rib table */ +	struct prefix *pfx_target_original);  /* query target */ -extern struct rfapi_import_table * -rfapiMacImportTableGet ( -  struct bgp	*bgp, -  uint32_t	lni); +extern struct rfapi_import_table *rfapiMacImportTableGetNoAlloc(struct bgp *bgp, +								uint32_t lni); + +extern struct rfapi_import_table *rfapiMacImportTableGet(struct bgp *bgp, +							 uint32_t lni); -extern int -rfapiGetL2o ( -  struct attr			*attr, -  struct rfapi_l2address_option *l2o); +extern int rfapiGetL2o(struct attr *attr, struct rfapi_l2address_option *l2o); -extern int rfapiEcommunityGetLNI ( -  struct ecommunity	*ecom, -  uint32_t		*lni); +extern int rfapiEcommunityGetLNI(struct ecommunity *ecom, uint32_t *lni); -extern int rfapiEcommunityGetEthernetTag ( -  struct ecommunity *ecom, -  uint16_t * tag_id); +extern int rfapiEcommunityGetEthernetTag(struct ecommunity *ecom, +					 uint16_t *tag_id);  /* enable for debugging; disable for performance */  #if 0 @@ -225,7 +185,7 @@ extern int rfapiEcommunityGetEthernetTag (   *   * UI helper: For use by the "clear vnc prefixes" command   * - * input:  + * input:   *	un			if set, tunnel must match this prefix   *	vn			if set, nexthop prefix must match this prefix   *	p			if set, prefix must match this prefix @@ -240,25 +200,21 @@ extern int rfapiEcommunityGetEthernetTag (   * return value:   *	void   --------------------------------------------*/ -extern void -rfapiDeleteRemotePrefixes ( -  struct prefix	*un, -  struct prefix	*vn, -  struct prefix	*p, -  struct rfapi_import_table *it, -  int		delete_active, -  int		delete_holddown, -  uint32_t	*pARcount,     /* active routes */ -  uint32_t	*pAHcount,     /* active nves */ -  uint32_t	*pHRcount,     /* holddown routes */ -  uint32_t	*pHHcount);    /* holddown nves */ +extern void rfapiDeleteRemotePrefixes(struct prefix *un, struct prefix *vn, +				      struct prefix *p, +				      struct rfapi_import_table *it, +				      int delete_active, int delete_holddown, +				      uint32_t *pARcount,  /* active routes */ +				      uint32_t *pAHcount,  /* active nves */ +				      uint32_t *pHRcount,  /* holddown routes */ +				      uint32_t *pHHcount); /* holddown nves */  /*------------------------------------------   * rfapiCountAllItRoutes   *   * UI helper: count VRF routes from BGP side   * - * input:  + * input:   *   * output   *	pARcount		count of active routes @@ -268,19 +224,17 @@ rfapiDeleteRemotePrefixes (   * return value:   *	void   --------------------------------------------*/ -extern void -rfapiCountAllItRoutes ( -  int *pALRcount,      /* active local routes */ -  int *pARRcount,      /* active remote routes */ -  int *pHRcount,       /* holddown routes */ -  int *pIRcount);      /* direct imported routes */ +extern void rfapiCountAllItRoutes(int *pALRcount, /* active local routes */ +				  int *pARRcount, /* active remote routes */ +				  int *pHRcount,  /* holddown routes */ +				  int *pIRcount); /* direct imported routes */  /*------------------------------------------   * rfapiGetHolddownFromLifetime   *   * calculate holddown value based on lifetime   * - * input:  + * input:   *     lifetime                lifetime   *   * return value: @@ -288,7 +242,6 @@ rfapiCountAllItRoutes (   *     and RFAPI_LIFETIME_INFINITE_WITHDRAW_DELAY   *   --------------------------------------------*/ -extern uint32_t -rfapiGetHolddownFromLifetime (uint32_t lifetime); +extern uint32_t rfapiGetHolddownFromLifetime(uint32_t lifetime);  #endif /* QUAGGA_HGP_RFAPI_IMPORT_H */  | 
