mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 01:51:26 +00:00
netdev implementation for FreeBSD
This patch adds new netdev classes that implement "system" and "tap" devices on FreeBSD using the libpcap library. This enables the use of the "netdev" datapath_type of Open vSwitch on FreeBSD. Signed-off-by: Gaetano Catalli <gaetano.catalli@gmail.com> Signed-off-by: Ed Maste <emaste@adaranet.com> Signed-off-by: Giuseppe Lettieri <g.lettieri@iet.unipi.it> Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
parent
22dd5cecef
commit
f6eb6b2025
@ -1,9 +1,9 @@
|
||||
How to Install Open vSwitch on Linux
|
||||
====================================
|
||||
How to Install Open vSwitch on Linux and FreeBSD
|
||||
================================================
|
||||
|
||||
This document describes how to build and install Open vSwitch on a
|
||||
generic Linux host. If you want to install Open vSwitch on a Citrix
|
||||
XenServer, see INSTALL.XenServer instead.
|
||||
generic Linux or FreeBSD host. If you want to install Open vSwitch on
|
||||
a Citrix XenServer, see INSTALL.XenServer instead.
|
||||
|
||||
This version of Open vSwitch may be built manually with "configure"
|
||||
and "make", as described below. You may also build Debian packages by
|
||||
@ -29,9 +29,9 @@ you will need the following software:
|
||||
libssl is installed, then Open vSwitch will automatically build
|
||||
with support for it.
|
||||
|
||||
To compile the kernel module, you must also install the following. If
|
||||
you cannot build or install the kernel module, you may use the
|
||||
userspace-only implementation, at a cost in performance. The
|
||||
To compile the kernel module on Linux, you must also install the
|
||||
following. If you cannot build or install the kernel module, you may
|
||||
use the userspace-only implementation, at a cost in performance. The
|
||||
userspace implementation may also lack some features. Refer to
|
||||
INSTALL.userspace for more information.
|
||||
|
||||
@ -119,14 +119,14 @@ following software:
|
||||
- libssl compatible with the libssl used for build, if OpenSSL was
|
||||
used for the build.
|
||||
|
||||
- The Linux kernel version configured as part of the build.
|
||||
- On Linux, the same kernel version configured as part of the build.
|
||||
|
||||
- For optional support of ingress policing, the "tc" program from
|
||||
iproute2 (part of all major distributions and available at
|
||||
- For optional support of ingress policing on Linux, the "tc" program
|
||||
from iproute2 (part of all major distributions and available at
|
||||
http://www.linux-foundation.org/en/Net:Iproute2).
|
||||
|
||||
You should ensure that /dev/urandom exists. To support TAP devices,
|
||||
you must also ensure that /dev/net/tun exists.
|
||||
On Linux you should ensure that /dev/urandom exists. To support TAP
|
||||
devices, you must also ensure that /dev/net/tun exists.
|
||||
|
||||
To run the ovsdbmonitor tool, the machine must also have the following
|
||||
software:
|
||||
@ -144,13 +144,13 @@ software:
|
||||
(On Debian "lenny" the above can be installed with "apt-get install
|
||||
python-json python-qt4 python-zopeinterface python-twisted-conch".)
|
||||
|
||||
Building and Installing Open vSwitch for Linux
|
||||
==============================================
|
||||
Building and Installing Open vSwitch for Linux or FreeBSD
|
||||
=========================================================
|
||||
|
||||
Once you have installed all the prerequisites listed above in the Base
|
||||
Prerequisites section, follow the procedure below to build.
|
||||
|
||||
1. If you pulled the sources directly from an Open vSwitch Git tree,
|
||||
1. If you pulled the sources directly from an Open vSwitch Git tree,
|
||||
run boot.sh in the top source directory:
|
||||
|
||||
% ./boot.sh
|
||||
@ -191,10 +191,13 @@ Prerequisites section, follow the procedure below to build.
|
||||
additional environment variables. For a full list, invoke
|
||||
configure with the --help option.
|
||||
|
||||
3. Run make in the top source directory:
|
||||
3. Run make in the top source directory:
|
||||
|
||||
% make
|
||||
|
||||
On FreeBSD you may need to use GNU make (gmake) or NetBSD make
|
||||
(bmake) instead of the native make.
|
||||
|
||||
For improved warnings if you installed "sparse" (see
|
||||
"Prerequisites"), add C=1 to the "make" command line.
|
||||
|
||||
@ -322,7 +325,7 @@ also upgrade the database schema:
|
||||
- If there is no important data in your database, then you may
|
||||
delete the database file and recreate it with ovsdb-tool,
|
||||
following the instructions under "Building and Installing Open
|
||||
vSwitch for Linux".
|
||||
vSwitch for Linux or FreeBSD".
|
||||
|
||||
- If you want to preserve the contents of your database, back it
|
||||
up first, then use "ovsdb-tool convert" to upgrade it, e.g.:
|
||||
@ -330,7 +333,7 @@ also upgrade the database schema:
|
||||
% ovsdb-tool convert /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
|
||||
|
||||
4. Start the Open vSwitch daemons as described under "Building and
|
||||
Installing Open vSwitch for Linux" above.
|
||||
Installing Open vSwitch for Linux or FreeBSD" above.
|
||||
|
||||
Bug Reporting
|
||||
-------------
|
@ -3,12 +3,12 @@
|
||||
|
||||
This document describes how to use Open vSwitch with the Kernel-based
|
||||
Virtual Machine (KVM). This document assumes that you have read and
|
||||
followed INSTALL.Linux to get Open vSwitch setup on your Linux system.
|
||||
followed INSTALL to get Open vSwitch setup on your Linux system.
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
First, follow the setup instructions in INSTALL.Linux to get a working
|
||||
First, follow the setup instructions in INSTALL to get a working
|
||||
Open vSwitch installation.
|
||||
|
||||
KVM uses tunctl to handle various bridging modes, which you can
|
||||
@ -43,7 +43,7 @@ switch='br0'
|
||||
ovs-vsctl del-port ${switch} $1
|
||||
--------------------------------------------------------------------
|
||||
|
||||
At the end of INSTALL.Linux, it describes basic usage of creating
|
||||
At the end of INSTALL, it describes basic usage of creating
|
||||
bridges and ports. If you haven't already, create a bridge named
|
||||
br0 with the following command:
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
This document describes how to use Open vSwitch with Libvirt 0.9.11 or
|
||||
later. The Open vSwitch support in Libvirt 0.9.11 eliminates the need to
|
||||
use OVS Linux Bridge compatibility layer (brcompatd) and interface up/down
|
||||
scripts. This document assumes that you followed INSTALL.Linux or installed
|
||||
scripts. This document assumes that you followed INSTALL or installed
|
||||
Open vSwitch from distribution packaging such as a .deb or .rpm. The Open
|
||||
vSwitch support is included by default in Libvirt 0.9.11. Consult
|
||||
www.libvirt.org for instructions on how to build the latest Libvirt, if your
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
This document describes how to build and install Open vSwitch on a Red
|
||||
Hat Enterprise Linux (RHEL) host. If you want to install Open vSwitch
|
||||
on a generic Linux host, see INSTALL.Linux instead.
|
||||
on a generic Linux host, see INSTALL instead.
|
||||
|
||||
We have tested these instructions with RHEL 5.6 and RHEL 6.0.
|
||||
|
||||
|
@ -7,8 +7,8 @@ with OpenSSL. SSL support ensures integrity and confidentiality of
|
||||
the OpenFlow connections, increasing network security.
|
||||
|
||||
This file explains how to configure an Open vSwitch to connect to an
|
||||
OpenFlow controller over SSL. Refer to INSTALL.Linux for instructions
|
||||
on building Open vSwitch with SSL support.
|
||||
OpenFlow controller over SSL. Refer to INSTALL for instructions on
|
||||
building Open vSwitch with SSL support.
|
||||
|
||||
Open vSwitch uses TLS version 1.0 or later (TLSv1), as specified by
|
||||
RFC 2246, which is very similar to SSL version 3.0. TLSv1 was
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
This document describes how to build and install Open vSwitch on a
|
||||
Citrix XenServer host. If you want to install Open vSwitch on a
|
||||
generic Linux host, see INSTALL.Linux instead.
|
||||
generic Linux or BSD host, see INSTALL instead.
|
||||
|
||||
These instructions have been tested with XenServer 5.6 FP1.
|
||||
|
||||
@ -19,8 +19,8 @@ RPMs for Citrix XenServer is the DDK VM available from Citrix.
|
||||
./configure; make dist" in the Git tree. You cannot run this in
|
||||
the DDK VM, because it lacks tools that are necessary to bootstrap
|
||||
the Open vSwitch distribution. Instead, you must run this on a
|
||||
machine that has the tools listed in INSTALL.Linux as prerequisites
|
||||
for building from a Git tree.
|
||||
machine that has the tools listed in INSTALL as prerequisites for
|
||||
building from a Git tree.
|
||||
|
||||
2. Copy the distribution tarball into /usr/src/redhat/SOURCES inside
|
||||
the DDK VM.
|
||||
|
@ -25,7 +25,7 @@ that the Open vSwitch kernel modules are loaded before the Linux
|
||||
kernel bridge module.
|
||||
|
||||
1. Build, install, and start up the Open vSwitch kernel modules and
|
||||
userspace programs as described in INSTALL.Linux.
|
||||
userspace programs as described in INSTALL.
|
||||
|
||||
It is important to run "make install", because some Open vSwitch
|
||||
programs expect to find files in locations selected at installation
|
||||
|
@ -17,7 +17,7 @@ Building and Installing
|
||||
-----------------------
|
||||
|
||||
The requirements and procedure for building, installing, and
|
||||
configuring Open vSwitch are the same as those given in INSTALL.Linux.
|
||||
configuring Open vSwitch are the same as those given in INSTALL.
|
||||
You may omit configuring, building, and installing the kernel module,
|
||||
and the related requirements.
|
||||
|
||||
@ -31,6 +31,10 @@ The tun device must also exist as /dev/net/tun. If it does not exist,
|
||||
then create /dev/net (if necessary) with "mkdir /dev/net", then create
|
||||
/dev/net/tun with "mknod /dev/net/tun c 10 200".
|
||||
|
||||
On FreeBSD, the userspace switch additionally requires the kernel
|
||||
tap(4) driver to be available, either built into the kernel or loaded
|
||||
as a module.
|
||||
|
||||
Using the Userspace Datapath with ovs-vswitchd
|
||||
----------------------------------------------
|
||||
|
||||
|
@ -42,9 +42,9 @@ EXTRA_DIST = \
|
||||
CodingStyle \
|
||||
DESIGN \
|
||||
FAQ \
|
||||
INSTALL \
|
||||
INSTALL.KVM \
|
||||
INSTALL.Libvirt \
|
||||
INSTALL.Linux \
|
||||
INSTALL.RHEL \
|
||||
INSTALL.SSL \
|
||||
INSTALL.XenServer \
|
||||
|
2
NEWS
2
NEWS
@ -1,5 +1,7 @@
|
||||
post-v1.8.0
|
||||
------------------------
|
||||
- FreeBSD is now a supported platform, thanks to code contributions from
|
||||
Gaetano Catalli, Ed Maste, and Giuseppe Lettieri.
|
||||
- ovs-bugtool: New --ovs option to report only OVS related information.
|
||||
- New %t and %T log escapes to identify the subprogram within a
|
||||
cooperating group of processes or threads that emitted a log message.
|
||||
|
3
NOTICE
3
NOTICE
@ -4,6 +4,9 @@ available at http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
Open vSwitch
|
||||
Copyright (c) 2007, 2008, 2009, 2010, 2011 Nicira, Inc.
|
||||
|
||||
Open vSwitch BSD port
|
||||
Copyright (c) 2011 Gaetano Catalli
|
||||
|
||||
Apache Portable Runtime
|
||||
Copyright 2008 The Apache Software Foundation.
|
||||
|
||||
|
4
README
4
README
@ -88,7 +88,7 @@ Open vSwitch also provides some tools:
|
||||
What other documentation is available?
|
||||
--------------------------------------
|
||||
|
||||
To install Open vSwitch on a regular Linux machine, read INSTALL.Linux.
|
||||
To install Open vSwitch on a regular Linux machine, read INSTALL.
|
||||
|
||||
For answers to common questions, read FAQ.
|
||||
|
||||
@ -101,7 +101,7 @@ or resource pool, read INSTALL.XenServer.
|
||||
To build RPMs for installing Open vSwitch on a Red Hat Enterprise
|
||||
Linux host, read INSTALL.RHEL.
|
||||
|
||||
To use Open vSwitch with KVM on Linux, read INSTALL.Linux, then
|
||||
To use Open vSwitch with KVM on Linux, read INSTALL, then
|
||||
INSTALL.KVM.
|
||||
|
||||
To use Open vSwitch with Libvirt, read INSTALL.Libvirt.
|
||||
|
@ -288,7 +288,7 @@ AC_DEFUN([OVS_CHECK_IF_PACKET],
|
||||
[Define to 1 if net/if_packet.h is available.])
|
||||
fi])
|
||||
|
||||
dnl Checks for net/if_dl.h
|
||||
dnl Checks for net/if_dl.h.
|
||||
AC_DEFUN([OVS_CHECK_IF_DL],
|
||||
[AC_CHECK_HEADER([net/if_dl.h],
|
||||
[HAVE_IF_DL=yes],
|
||||
|
@ -41,6 +41,7 @@ AC_SYS_LARGEFILE
|
||||
AC_SEARCH_LIBS([pow], [m])
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||
AC_SEARCH_LIBS([timer_create], [rt])
|
||||
AC_SEARCH_LIBS([pcap_open_live], [pcap])
|
||||
|
||||
OVS_CHECK_COVERAGE
|
||||
OVS_CHECK_NDEBUG
|
||||
|
1
debian/copyright.in
vendored
1
debian/copyright.in
vendored
@ -12,6 +12,7 @@ Upstream Copyright Holders:
|
||||
Copyright (c) 2010 Jean Tourrilhes - HP-Labs.
|
||||
Copyright (c) 2008,2009,2010 Citrix Systems, Inc.
|
||||
and authors listed above.
|
||||
Copyright (c) 2011 Gaetano Catalli
|
||||
|
||||
License:
|
||||
|
||||
|
@ -244,6 +244,9 @@ endif
|
||||
|
||||
if HAVE_IF_DL
|
||||
lib_libopenvswitch_a_SOURCES += \
|
||||
lib/netdev-bsd.c \
|
||||
lib/rtbsd.c \
|
||||
lib/rtbsd.h \
|
||||
lib/route-table-bsd.c
|
||||
endif
|
||||
|
||||
|
1485
lib/netdev-bsd.c
Normal file
1485
lib/netdev-bsd.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -596,6 +596,9 @@ const struct netdev_class *netdev_lookup_provider(const char *type);
|
||||
extern const struct netdev_class netdev_linux_class;
|
||||
extern const struct netdev_class netdev_internal_class;
|
||||
extern const struct netdev_class netdev_tap_class;
|
||||
#ifdef __FreeBSD__
|
||||
extern const struct netdev_class netdev_bsd_class;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -80,6 +80,10 @@ netdev_initialize(void)
|
||||
netdev_register_provider(&netdev_internal_class);
|
||||
netdev_register_provider(&netdev_tap_class);
|
||||
netdev_vport_register();
|
||||
#endif
|
||||
#ifdef __FreeBSD__
|
||||
netdev_register_provider(&netdev_tap_class);
|
||||
netdev_register_provider(&netdev_bsd_class);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#ifndef ROUTE_TABLE_H
|
||||
#define ROUTE_TABLE_H 1
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
167
lib/rtbsd.c
Normal file
167
lib/rtbsd.c
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Gaetano Catalli.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include "coverage.h"
|
||||
#include "socket-util.h"
|
||||
#include "poll-loop.h"
|
||||
#include "vlog.h"
|
||||
#include "rtbsd.h"
|
||||
|
||||
VLOG_DEFINE_THIS_MODULE(rtbsd);
|
||||
COVERAGE_DEFINE(rtbsd_changed);
|
||||
|
||||
/* PF_ROUTE socket. */
|
||||
static int notify_sock = -1;
|
||||
|
||||
/* All registered notifiers. */
|
||||
static struct list all_notifiers = LIST_INITIALIZER(&all_notifiers);
|
||||
|
||||
static void rtbsd_report_change(const struct if_msghdr *);
|
||||
static void rtbsd_report_notify_error(void);
|
||||
|
||||
/* Registers 'cb' to be called with auxiliary data 'aux' with network device
|
||||
* change notifications. The notifier is stored in 'notifier', which the
|
||||
* caller must not modify or free.
|
||||
*
|
||||
* Returns 0 if successful, otherwise a positive errno value. */
|
||||
int
|
||||
rtbsd_notifier_register(struct rtbsd_notifier *notifier,
|
||||
rtbsd_notify_func *cb, void *aux)
|
||||
{
|
||||
if (notify_sock < 0) {
|
||||
int error;
|
||||
notify_sock = socket(PF_ROUTE, SOCK_RAW, 0);
|
||||
if (notify_sock < 0) {
|
||||
VLOG_WARN("could not create PF_ROUTE socket: %s",
|
||||
strerror(errno));
|
||||
return errno;
|
||||
}
|
||||
error = set_nonblocking(notify_sock);
|
||||
if (error) {
|
||||
VLOG_WARN("error set_nonblocking PF_ROUTE socket: %s",
|
||||
strerror(error));
|
||||
return error;
|
||||
}
|
||||
} else {
|
||||
/* Catch up on notification work so that the new notifier won't
|
||||
* receive any stale notifications. XXX*/
|
||||
rtbsd_notifier_run();
|
||||
}
|
||||
|
||||
list_push_back(&all_notifiers, ¬ifier->node);
|
||||
notifier->cb = cb;
|
||||
notifier->aux = aux;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Cancels notification on 'notifier', which must have previously been
|
||||
* registered with rtbsd_notifier_register(). */
|
||||
void
|
||||
rtbsd_notifier_unregister(struct rtbsd_notifier *notifier)
|
||||
{
|
||||
list_remove(¬ifier->node);
|
||||
if (list_is_empty(&all_notifiers)) {
|
||||
close(notify_sock);
|
||||
notify_sock = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Calls all of the registered notifiers, passing along any as-yet-unreported
|
||||
* netdev change events. */
|
||||
void
|
||||
rtbsd_notifier_run(void)
|
||||
{
|
||||
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
|
||||
struct if_msghdr msg;
|
||||
if (notify_sock < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
int retval;
|
||||
|
||||
msg.ifm_type = RTM_IFINFO;
|
||||
msg.ifm_version = RTM_VERSION; //XXX check if necessary
|
||||
|
||||
/* read from PF_ROUTE socket */
|
||||
retval = read(notify_sock, (char *)&msg, sizeof(msg));
|
||||
if (retval >= 0) {
|
||||
/* received packet from PF_ROUTE socket
|
||||
* XXX check for bad packets */
|
||||
if (msg.ifm_type == RTM_IFINFO) {
|
||||
rtbsd_report_change(&msg);
|
||||
}
|
||||
} else if (errno == EAGAIN) {
|
||||
return;
|
||||
} else {
|
||||
if (errno == ENOBUFS) {
|
||||
VLOG_WARN_RL(&rl, "PF_ROUTE receive buffer overflowed");
|
||||
} else {
|
||||
VLOG_WARN_RL(&rl, "error reading PF_ROUTE socket: %s",
|
||||
strerror(errno));
|
||||
}
|
||||
rtbsd_report_notify_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Causes poll_block() to wake up when network device change notifications are
|
||||
* ready. */
|
||||
void
|
||||
rtbsd_notifier_wait(void)
|
||||
{
|
||||
if (notify_sock >= 0) {
|
||||
poll_fd_wait(notify_sock, POLLIN);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
rtbsd_report_change(const struct if_msghdr *msg)
|
||||
{
|
||||
struct rtbsd_notifier *notifier;
|
||||
struct rtbsd_change change;
|
||||
|
||||
COVERAGE_INC(rtbsd_changed);
|
||||
|
||||
change.msg_type = msg->ifm_type; //XXX
|
||||
change.if_index = msg->ifm_index;
|
||||
if_indextoname(msg->ifm_index, change.if_name);
|
||||
change.master_ifindex = 0; //XXX
|
||||
|
||||
LIST_FOR_EACH (notifier, node, &all_notifiers) {
|
||||
notifier->cb(&change, notifier->aux);
|
||||
}
|
||||
}
|
||||
|
||||
/* If an error occurs the notifiers' callbacks are called with NULL changes */
|
||||
static void
|
||||
rtbsd_report_notify_error(void)
|
||||
{
|
||||
struct rtbsd_notifier *notifier;
|
||||
|
||||
LIST_FOR_EACH (notifier, node, &all_notifiers) {
|
||||
notifier->cb(NULL, notifier->aux);
|
||||
}
|
||||
}
|
58
lib/rtbsd.h
Normal file
58
lib/rtbsd.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Gaetano Catalli.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef RTBSD_H
|
||||
#define RTBSD_H 1
|
||||
|
||||
#include "list.h"
|
||||
|
||||
/*
|
||||
* A digested version of a message received from a PF_ROUTE socket which
|
||||
* indicates that a network device has been created or destroyed or changed.
|
||||
*/
|
||||
struct rtbsd_change {
|
||||
/* Copied from struct if_msghdr. */
|
||||
int msg_type; /* e.g. XXX. */
|
||||
|
||||
/* Copied from struct if_msghdr. */
|
||||
int if_index; /* Index of network device. */
|
||||
|
||||
char if_name[IF_NAMESIZE]; /* Name of network device. */
|
||||
int master_ifindex; /* Ifindex of datapath master (0 if none). */
|
||||
};
|
||||
|
||||
/*
|
||||
* Function called to report that a netdev has changed. 'change' describes the
|
||||
* specific change. It may be null if the buffer of change information
|
||||
* overflowed, in which case the function must assume that every device may
|
||||
* have changed. 'aux' is as specified in the call to
|
||||
* rtbsd_notifier_register().
|
||||
*/
|
||||
typedef void rtbsd_notify_func(const struct rtbsd_change *, void *aux);
|
||||
|
||||
struct rtbsd_notifier {
|
||||
struct list node;
|
||||
rtbsd_notify_func *cb;
|
||||
void *aux;
|
||||
};
|
||||
|
||||
int rtbsd_notifier_register(struct rtbsd_notifier *,
|
||||
rtbsd_notify_func *, void *aux);
|
||||
void rtbsd_notifier_unregister(struct rtbsd_notifier *);
|
||||
void rtbsd_notifier_run(void);
|
||||
void rtbsd_notifier_wait(void);
|
||||
|
||||
#endif /* rtbsd.h */
|
@ -18,6 +18,7 @@
|
||||
#include <config.h>
|
||||
#include "ofproto-dpif-sflow.h"
|
||||
#include <inttypes.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <stdlib.h>
|
||||
#include "collectors.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user