+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* VRF functions.
* Copyright (C) 2014 6WIND S.A.
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
static void vrf_terminate_single(struct vrf *vrf)
{
/* Clear configured flag and invoke delete. */
+ vrf_disable(vrf);
UNSET_FLAG(vrf->status, VRF_CONFIGURED);
if_terminate(vrf);
vrf_delete(vrf);
/* Finally terminate default VRF */
vrf = vrf_lookup_by_id(VRF_DEFAULT);
- vrf_terminate_single(vrf);
+ if (vrf)
+ vrf_terminate_single(vrf);
}
int vrf_socket(int domain, int type, int protocol, vrf_id_t vrf_id,
case VRF_BACKEND_NETNS:
case VRF_BACKEND_VRF_LITE:
break;
- default:
+ case VRF_BACKEND_MAX:
return -1;
}
snprintf(xpath_list, sizeof(xpath_list), FRR_VRF_KEY_XPATH, vrfname);
nb_cli_enqueue_change(vty, xpath_list, NB_OP_CREATE, NULL);
- ret = nb_cli_apply_changes_clear_pending(vty, xpath_list);
+ ret = nb_cli_apply_changes_clear_pending(vty, "%s", xpath_list);
if (ret == CMD_SUCCESS) {
VTY_PUSH_XPATH(VRF_NODE, xpath_list);
vrf = vrf_lookup_by_name(vrfname);
struct vrf *vrfp = (struct vrf *)args->list_entry;
if (vrfp->status == VRF_ACTIVE)
- return yang_data_new_bool(
- args->xpath, vrfp->status == VRF_ACTIVE ? true : false);
+ return yang_data_new_bool(args->xpath, true);
return NULL;
}