]>
git.proxmox.com Git - mirror_frr.git/blob - ripd/rip_nb_rpcs.c
2 * Copyright (C) 2018 NetDEF, Inc.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "northbound.h"
32 #include "ripd/ripd.h"
33 #include "ripd/rip_nb.h"
34 #include "ripd/rip_debug.h"
35 #include "ripd/rip_interface.h"
38 * XPath: /frr-ripd:clear-rip-route
40 static void clear_rip_route(struct rip
*rip
)
42 struct route_node
*rp
;
44 if (IS_RIP_DEBUG_EVENT
)
45 zlog_debug("Clearing all RIP routes (VRF %s)", rip
->vrf_name
);
47 /* Clear received RIP routes */
48 for (rp
= route_top(rip
->table
); rp
; rp
= route_next(rp
)) {
50 struct listnode
*listnode
;
51 struct rip_info
*rinfo
;
57 for (ALL_LIST_ELEMENTS_RO(list
, listnode
, rinfo
)) {
58 if (!rip_route_rte(rinfo
))
61 if (CHECK_FLAG(rinfo
->flags
, RIP_RTF_FIB
))
62 rip_zebra_ipv4_delete(rip
, rp
);
67 RIP_TIMER_OFF(rinfo
->t_timeout
);
68 RIP_TIMER_OFF(rinfo
->t_garbage_collect
);
69 listnode_delete(list
, rinfo
);
73 if (list_isempty(list
)) {
76 route_unlock_node(rp
);
81 int clear_rip_route_rpc(struct nb_cb_rpc_args
*args
)
84 struct yang_data
*yang_vrf
;
86 yang_vrf
= yang_data_list_find(args
->input
, "%s/%s", args
->xpath
,
89 rip
= rip_lookup_by_vrf_name(yang_vrf
->value
);
95 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
100 clear_rip_route(rip
);