]>
git.proxmox.com Git - mirror_frr.git/blob - ripngd/ripng_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 "agg_table.h"
30 #include "northbound.h"
33 #include "ripngd/ripngd.h"
34 #include "ripngd/ripng_nb.h"
35 #include "ripngd/ripng_debug.h"
36 #include "ripngd/ripng_route.h"
39 * XPath: /frr-ripngd:clear-ripng-route
41 static void clear_ripng_route(struct ripng
*ripng
)
45 if (IS_RIPNG_DEBUG_EVENT
)
46 zlog_debug("Clearing all RIPng routes (VRF %s)",
49 /* Clear received RIPng routes */
50 for (rp
= agg_route_top(ripng
->table
); rp
; rp
= agg_route_next(rp
)) {
52 struct listnode
*listnode
;
53 struct ripng_info
*rinfo
;
59 for (ALL_LIST_ELEMENTS_RO(list
, listnode
, rinfo
)) {
60 if (!ripng_route_rte(rinfo
))
63 if (CHECK_FLAG(rinfo
->flags
, RIPNG_RTF_FIB
))
64 ripng_zebra_ipv6_delete(ripng
, rp
);
69 THREAD_OFF(rinfo
->t_timeout
);
70 THREAD_OFF(rinfo
->t_garbage_collect
);
71 listnode_delete(list
, rinfo
);
72 ripng_info_free(rinfo
);
75 if (list_isempty(list
)) {
83 int clear_ripng_route_rpc(struct nb_cb_rpc_args
*args
)
86 struct yang_data
*yang_vrf
;
88 yang_vrf
= yang_data_list_find(args
->input
, "%s/%s", args
->xpath
,
91 ripng
= ripng_lookup_by_vrf_name(yang_vrf
->value
);
93 clear_ripng_route(ripng
);
97 RB_FOREACH (vrf
, vrf_name_head
, &vrfs_by_name
) {
102 clear_ripng_route(ripng
);