+// SPDX-License-Identifier: GPL-2.0-or-later
/* Kernel communication using netlink interface.
* Copyright (C) 1999 Kunihiro Ishiguro
- *
- * 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>
#include "table.h"
#include "memory.h"
#include "rib.h"
-#include "thread.h"
+#include "frrevent.h"
#include "privs.h"
#include "nexthop.h"
#include "vrf.h"
{RTN_XRESOLVE, "resolver"},
{0}};
-extern struct thread_master *master;
+extern struct event_loop *master;
extern struct zebra_privs_t zserv_privs;
return 0;
}
-static void kernel_read(struct thread *thread)
+static void kernel_read(struct event *thread)
{
- struct zebra_ns *zns = (struct zebra_ns *)THREAD_ARG(thread);
+ struct zebra_ns *zns = (struct zebra_ns *)EVENT_ARG(thread);
struct zebra_dplane_info dp_info;
/* Capture key info from ns struct */
netlink_parse_info(netlink_information_fetch, &zns->netlink, &dp_info,
5, false);
- thread_add_read(zrouter.master, kernel_read, zns, zns->netlink.sock,
- &zns->t_netlink);
+ event_add_read(zrouter.master, kernel_read, zns, zns->netlink.sock,
+ &zns->t_netlink);
}
/*
nl_msg_type_to_str(msg_type), msg_type,
err->msg.nlmsg_seq, err->msg.nlmsg_pid);
} else {
- if ((msg_type != RTM_GETNEXTHOP) || !startup)
+ if ((msg_type != RTM_GETNEXTHOP && msg_type != RTM_GETVLAN) ||
+ !startup)
flog_err(EC_ZEBRA_UNEXPECTED_MESSAGE,
"%s error: %s, type=%s(%u), seq=%u, pid=%u",
nl->name, safe_strerror(-errnum),
ret = setsockopt(zns->netlink.sock, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
&grp, sizeof(grp));
+ if (ret < 0)
+ zlog_notice(
+ "Registration for RTNLGRP_BRVLAN Membership failed : %d %s",
+ errno, safe_strerror(errno));
/*
* Let's tell the kernel that we want to receive extended
* ACKS over our command socket(s)
zns->t_netlink = NULL;
- thread_add_read(zrouter.master, kernel_read, zns,
- zns->netlink.sock, &zns->t_netlink);
+ event_add_read(zrouter.master, kernel_read, zns, zns->netlink.sock,
+ &zns->t_netlink);
rt_netlink_init();
}
void kernel_terminate(struct zebra_ns *zns, bool complete)
{
- THREAD_OFF(zns->t_netlink);
+ EVENT_OFF(zns->t_netlink);
kernel_nlsock_fini(&zns->netlink);