+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Main implementation file for interface to Forwarding Plane Manager.
*
* Copyright (C) 2012 by Open Source Routing.
* Copyright (C) 2012 by Internet Systems Consortium, Inc. ("ISC")
- *
- * 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>
len = zfpm_netlink_encode_route(cmd, dest, re, in_buf,
in_buf_len);
assert(fpm_msg_align(len) == len);
- *msg_type = FPM_MSG_TYPE_NETLINK;
#endif /* HAVE_NETLINK */
break;
- default:
+ case ZFPM_MSG_FORMAT_NONE:
break;
}
return 0;
}
+/*
+ * zfpm_trigger_remove
+ *
+ * The zebra code invokes this function to indicate that we should
+ * send an remove to the FPM about the given route_node.
+ */
+
+static int zfpm_trigger_remove(struct route_node *rn)
+{
+ rib_dest_t *dest;
+
+ if (!zfpm_conn_is_up())
+ return 0;
+
+ dest = rib_dest_from_rnode(rn);
+ if (!CHECK_FLAG(dest->flags, RIB_DEST_UPDATE_FPM))
+ return 0;
+
+ zfpm_debug("%pRN Removing from update queue shutting down", rn);
+
+ UNSET_FLAG(dest->flags, RIB_DEST_UPDATE_FPM);
+ TAILQ_REMOVE(&zfpm_g->dest_q, dest, fpm_q_entries);
+
+ return 0;
+}
+
/*
* Generate Key for FPM MAC info hash entry
*/
/*
* update fpm connection information
*/
-DEFUN ( fpm_remote_ip,
+DEFUN (fpm_remote_ip,
fpm_remote_ip_cmd,
- "fpm connection ip A.B.C.D port (1-65535)",
- "fpm connection remote ip and port\n"
- "Remote fpm server ip A.B.C.D\n"
- "Enter ip ")
+ "fpm connection ip A.B.C.D port (1-65535)",
+ "Forwarding Path Manager\n"
+ "Configure FPM connection\n"
+ "Connect to IPv4 address\n"
+ "Connect to IPv4 address\n"
+ "TCP port number\n"
+ "TCP port number\n")
{
in_addr_t fpm_server;
return CMD_SUCCESS;
}
-DEFUN ( no_fpm_remote_ip,
+DEFUN (no_fpm_remote_ip,
no_fpm_remote_ip_cmd,
- "no fpm connection ip A.B.C.D port (1-65535)",
- "fpm connection remote ip and port\n"
- "Connection\n"
- "Remote fpm server ip A.B.C.D\n"
- "Enter ip ")
+ "no fpm connection ip A.B.C.D port (1-65535)",
+ NO_STR
+ "Forwarding Path Manager\n"
+ "Remove configured FPM connection\n"
+ "Connect to IPv4 address\n"
+ "Connect to IPv4 address\n"
+ "TCP port number\n"
+ "TCP port number\n")
{
if (zfpm_g->fpm_server != inet_addr(argv[4]->arg)
|| zfpm_g->fpm_port != atoi(argv[6]->arg))
static int zebra_fpm_module_init(void)
{
hook_register(rib_update, zfpm_trigger_update);
+ hook_register(rib_shutdown, zfpm_trigger_remove);
hook_register(zebra_rmac_update, zfpm_trigger_rmac_update);
hook_register(frr_late_init, zfpm_init);
hook_register(frr_early_fini, zfpm_fini);