diff options
| author | Mark Stapp <mjs@voltanet.io> | 2021-10-26 12:50:26 -0400 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-26 12:50:26 -0400 | 
| commit | d12799878586a9ea5823fc51de5432495c94fe7a (patch) | |
| tree | 89899683ae6b1cc1eb26e54d343b6e856e5e30ba /zebra/zebra_netns_notify.c | |
| parent | 697257179dc63c4fa8274ee2d91e576477ff71d9 (diff) | |
| parent | 62d89c648b182412d6377308932d1199fae0fe8e (diff) | |
Merge pull request #9846 from idryzhov/lib-zebra-netns
lib: move zebra-only netns stuff to zebra
Diffstat (limited to 'zebra/zebra_netns_notify.c')
| -rw-r--r-- | zebra/zebra_netns_notify.c | 22 | 
1 files changed, 17 insertions, 5 deletions
diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 2d25801590..0d260ad639 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -66,6 +66,18 @@ static int zebra_ns_continue_read(struct zebra_netns_info *zns_info,  				  int stop_retry);  static int zebra_ns_notify_read(struct thread *t); +static struct vrf *vrf_handler_create(struct vty *vty, const char *vrfname) +{ +	if (strlen(vrfname) > VRF_NAMSIZ) { +		flog_warn(EC_LIB_VRF_LENGTH, +			  "%% VRF name %s invalid: length exceeds %d bytes", +			  vrfname, VRF_NAMSIZ); +		return NULL; +	} + +	return vrf_get(VRF_UNKNOWN, vrfname); +} +  static void zebra_ns_notify_create_context_from_entry_name(const char *name)  {  	char *netnspath = ns_netns_pathname(NULL, name); @@ -91,7 +103,8 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name)  			vrf->name, netnspath);  		return;  	} -	if (vrf_handler_create(NULL, name, &vrf) != CMD_SUCCESS) { +	vrf = vrf_handler_create(NULL, name); +	if (!vrf) {  		flog_warn(EC_ZEBRA_NS_VRF_CREATION_FAILED,  			  "NS notify : failed to create VRF %s", name);  		ns_map_nsid_with_external(ns_id, false); @@ -108,10 +121,9 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name)  	}  	frr_with_privs(&zserv_privs) { -		ret = vrf_netns_handler_create(NULL, vrf, netnspath, -					       ns_id_external, -					       ns_id, -					       ns_id_relative); +		ret = zebra_vrf_netns_handler_create(NULL, vrf, netnspath, +						     ns_id_external, ns_id, +						     ns_id_relative);  	}  	if (ret != CMD_SUCCESS) {  		flog_warn(EC_ZEBRA_NS_VRF_CREATION_FAILED,  | 
