diff options
| author | Russ White <russ@riw.us> | 2022-09-13 11:30:54 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-13 11:30:54 -0400 | 
| commit | 7fa5e07b1cbf045f22547db11686eb82d5323079 (patch) | |
| tree | 4d22271eb7469e4e3bfab32f51b6c75950fc2cb6 /bgpd/bgp_routemap_nb_config.c | |
| parent | c3c5f18c2b8a96dd9ce7a42ddaee4ce19e9d288e (diff) | |
| parent | 324e8b1f79ccd00f75cdb8ba95ba0c0ee5e82b4d (diff) | |
Merge pull request #11899 from opensourcerouting/feature/route_validation_extended_community
bgpd: Implement Origin Validation State via extended communities
Diffstat (limited to 'bgpd/bgp_routemap_nb_config.c')
| -rw-r--r-- | bgpd/bgp_routemap_nb_config.c | 54 | 
1 files changed, 54 insertions, 0 deletions
diff --git a/bgpd/bgp_routemap_nb_config.c b/bgpd/bgp_routemap_nb_config.c index 585c2a3ff0..b18cf9d4dd 100644 --- a/bgpd/bgp_routemap_nb_config.c +++ b/bgpd/bgp_routemap_nb_config.c @@ -381,6 +381,60 @@ lib_route_map_entry_match_condition_rmap_match_condition_rpki_destroy(  }  /* + * XPath: + * /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:rpki-extcommunity + */ +int lib_route_map_entry_match_condition_rmap_match_condition_rpki_extcommunity_modify( +	struct nb_cb_modify_args *args) +{ +	struct routemap_hook_context *rhc; +	const char *rpki; +	enum rmap_compile_rets ret; + +	switch (args->event) { +	case NB_EV_VALIDATE: +	case NB_EV_PREPARE: +	case NB_EV_ABORT: +		break; +	case NB_EV_APPLY: +		/* Add configuration. */ +		rhc = nb_running_get_entry(args->dnode, NULL, true); +		rpki = yang_dnode_get_string(args->dnode, NULL); + +		/* Set destroy information. */ +		rhc->rhc_mhook = bgp_route_match_delete; +		rhc->rhc_rule = "rpki-extcommunity"; +		rhc->rhc_event = RMAP_EVENT_MATCH_DELETED; + +		ret = bgp_route_match_add(rhc->rhc_rmi, "rpki-extcommunity", +					  rpki, RMAP_EVENT_MATCH_ADDED, +					  args->errmsg, args->errmsg_len); + +		if (ret != RMAP_COMPILE_SUCCESS) { +			rhc->rhc_mhook = NULL; +			return NB_ERR_INCONSISTENCY; +		} +	} + +	return NB_OK; +} + +int lib_route_map_entry_match_condition_rmap_match_condition_rpki_extcommunity_destroy( +	struct nb_cb_destroy_args *args) +{ +	switch (args->event) { +	case NB_EV_VALIDATE: +	case NB_EV_PREPARE: +	case NB_EV_ABORT: +		break; +	case NB_EV_APPLY: +		return lib_route_map_entry_match_destroy(args); +	} + +	return NB_OK; +} + +/*   * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:probability   */  int  | 
