#include "netdev.h"
#include "netdev-vport.h"
#include "ofpbuf.h"
+#include "openvswitch/tunnel.h"
#include "poll-loop.h"
#include "rtnetlink.h"
+#include "rtnetlink-link.h"
#include "shash.h"
#include "svec.h"
#include "util.h"
static int create_minor(const char *name, int minor, struct dpif **dpifp);
static int open_minor(int minor, struct dpif **dpifp);
static int make_openvswitch_device(int minor, char **fnp);
-static void dpif_linux_port_changed(const struct rtnetlink_change *,
+static void dpif_linux_port_changed(const struct rtnetlink_link_change *,
void *dpif);
static struct dpif_linux *
dpif_linux_close(struct dpif *dpif_)
{
struct dpif_linux *dpif = dpif_linux_cast(dpif_);
- rtnetlink_notifier_unregister(&dpif->port_notifier);
+ rtnetlink_link_notifier_unregister(&dpif->port_notifier);
shash_destroy(&dpif->changed_ports);
free(dpif->local_ifname);
close(dpif->fd);
}
static void
-translate_vport_type_to_netdev_type(char *type, size_t size)
+translate_vport_type_to_netdev_type(struct odp_port *port)
{
+ char *type = port->type;
+
if (!strcmp(type, "netdev")) {
- ovs_strlcpy(type, "system", size);
+ ovs_strlcpy(type, "system", sizeof port->type);
+ } else if (!strcmp(type, "gre")) {
+ const struct tnl_port_config *config;
+
+ config = (struct tnl_port_config *)port->config;
+ if (config->flags & TNL_F_IPSEC) {
+ ovs_strlcpy(type, "ipsec_gre", sizeof port->type);
+ }
}
}
static void
-translate_netdev_type_to_vport_type(char *type, size_t size)
+translate_netdev_type_to_vport_type(struct odp_port *port)
{
+ char *type = port->type;
+
if (!strcmp(type, "system")) {
- ovs_strlcpy(type, "netdev", size);
+ ovs_strlcpy(type, "netdev", sizeof port->type);
+ } else if (!strcmp(type, "ipsec_gre")) {
+ ovs_strlcpy(type, "gre", sizeof port->type);
}
}
memset(&port, 0, sizeof port);
strncpy(port.devname, name, sizeof port.devname);
strncpy(port.type, type, sizeof port.type);
- translate_netdev_type_to_vport_type(port.type, sizeof port.type);
netdev_vport_get_config(netdev, port.config);
+ translate_netdev_type_to_vport_type(&port);
error = do_ioctl(dpif, ODP_VPORT_ATTACH, &port);
if (!error) {
{
int error = do_ioctl(dpif, ODP_VPORT_QUERY, port);
if (!error) {
- translate_vport_type_to_netdev_type(port->type, sizeof port->type);
+ translate_vport_type_to_netdev_type(port);
}
return error;
}
for (i = 0; i < pv.n_ports; i++) {
struct odp_port *port = &pv.ports[i];
- translate_vport_type_to_netdev_type(port->type, sizeof port->type);
+ translate_vport_type_to_netdev_type(port);
}
return pv.n_ports;
}
if (!shash_is_empty(&dpif->changed_ports) || dpif->change_error) {
poll_immediate_wake();
} else {
- rtnetlink_notifier_wait();
+ rtnetlink_link_notifier_wait();
}
}
static int
dpif_linux_execute(struct dpif *dpif_,
- const union odp_action actions[], int n_actions,
+ const struct nlattr *actions, size_t actions_len,
const struct ofpbuf *buf)
{
struct odp_execute execute;
memset(&execute, 0, sizeof execute);
- execute.actions = (union odp_action *) actions;
- execute.n_actions = n_actions;
+ execute.actions = (struct nlattr *) actions;
+ execute.actions_len = actions_len;
execute.data = buf->data;
execute.length = buf->size;
return do_ioctl(dpif_, ODP_EXECUTE, &execute);
fd = open(fn, O_RDONLY | O_NONBLOCK);
if (fd >= 0) {
struct dpif_linux *dpif = xmalloc(sizeof *dpif);
- error = rtnetlink_notifier_register(&dpif->port_notifier,
- dpif_linux_port_changed, dpif);
+ error = rtnetlink_link_notifier_register(&dpif->port_notifier,
+ dpif_linux_port_changed,
+ dpif);
if (!error) {
char *name;
}
static void
-dpif_linux_port_changed(const struct rtnetlink_change *change, void *dpif_)
+dpif_linux_port_changed(const struct rtnetlink_link_change *change,
+ void *dpif_)
{
struct dpif_linux *dpif = dpif_;