diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-02-08 09:50:32 -0500 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-02-08 20:35:14 -0500 | 
| commit | 339e36d258ad73701d7b9eccc0e56e48cdea1a2d (patch) | |
| tree | 38adacaebff070103e0388f5aff39d8668cbbbef /zebra/zebra_mpls.h | |
| parent | 70e98a7fe7296a1279c6b7142e57221f71ff3121 (diff) | |
lib, sharpd, zebra: Add new enum for lsp type and pass it through.
Add the ability to pass the lsp owner type through the zapi
and in addition add a new label type for the sharp protocol
for testing.
Finally modify zebra_mpls.h to not have defaults specified
for the enum.  That way when we add a new LSP type the
compile fails and the person doing the addition knows
where he has to touch shit.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_mpls.h')
| -rw-r--r-- | zebra/zebra_mpls.h | 37 | 
1 files changed, 34 insertions, 3 deletions
diff --git a/zebra/zebra_mpls.h b/zebra/zebra_mpls.h index 27a4971691..fd14b29ca9 100644 --- a/zebra/zebra_mpls.h +++ b/zebra/zebra_mpls.h @@ -428,9 +428,19 @@ static inline u_char lsp_distance(enum lsp_types_t type)  		return (route_distance(ZEBRA_ROUTE_LDP));  	case ZEBRA_LSP_BGP:  		return (route_distance(ZEBRA_ROUTE_BGP)); -	default: +	case ZEBRA_LSP_NONE: +	case ZEBRA_LSP_SHARP: +	case ZEBRA_LSP_SR:  		return 150;  	} + +	/* +	 * For some reason certain compilers do not believe +	 * that all the cases have been handled.  And +	 * WTF does this work differently than when I removed +	 * the default case???? +	 */ +	return 150;  }  /* @@ -444,6 +454,8 @@ static inline enum lsp_types_t lsp_type_from_re_type(int re_type)  		return ZEBRA_LSP_STATIC;  	case ZEBRA_ROUTE_BGP:  		return ZEBRA_LSP_BGP; +	case ZEBRA_ROUTE_SHARP: +		return ZEBRA_LSP_SHARP;  	default:  		return ZEBRA_LSP_NONE;  	} @@ -464,9 +476,18 @@ static inline int re_type_from_lsp_type(enum lsp_types_t lsp_type)  	case ZEBRA_LSP_SR:  		return ZEBRA_ROUTE_OSPF;  	case ZEBRA_LSP_NONE: -	default:  		return ZEBRA_ROUTE_KERNEL; +	case ZEBRA_LSP_SHARP: +		return ZEBRA_ROUTE_SHARP;  	} + +	/* +	 * For some reason certain compilers do not believe +	 * that all the cases have been handled.  And +	 * WTF does this work differently than when I removed +	 * the default case???? +	 */ +	return ZEBRA_ROUTE_KERNEL;  }  /* NHLFE type as printable string. */ @@ -481,9 +502,19 @@ static inline const char *nhlfe_type2str(enum lsp_types_t lsp_type)  		return "BGP";  	case ZEBRA_LSP_SR:  		return "SR"; -	default: +	case ZEBRA_LSP_SHARP: +		return "SHARP"; +	case ZEBRA_LSP_NONE:  		return "Unknown";  	} + +	/* +	 * For some reason certain compilers do not believe +	 * that all the cases have been handled.  And +	 * WTF does this work differently than when I removed +	 * the default case???? +	 */ +	return "Unknown";  }  static inline void mpls_mark_lsps_for_processing(struct zebra_vrf *zvrf)  | 
