git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto-dpif: Use sequence number to wake up main thread for
[sliver-openvswitch.git]
/
lib
/
vlandev.c
diff --git
a/lib/vlandev.c
b/lib/vlandev.c
index
5f58f10
..
d2f5a37
100644
(file)
--- a/
lib/vlandev.c
+++ b/
lib/vlandev.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2011, 2013 Nicira, Inc.
+ * Copyright (c) 2011, 2013
, 2014
Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-26,6
+26,7
@@
#include "dummy.h"
#include "hash.h"
#include "shash.h"
#include "dummy.h"
#include "hash.h"
#include "shash.h"
+#include "socket-util.h"
#include "vlog.h"
VLOG_DEFINE_THIS_MODULE(vlandev);
#include "vlog.h"
VLOG_DEFINE_THIS_MODULE(vlandev);
@@
-37,7
+38,7
@@
struct vlandev_class {
int (*vd_del)(const char *vlan_dev);
};
int (*vd_del)(const char *vlan_dev);
};
-#ifdef
LINUX_DATAPATH
+#ifdef
__linux__
static const struct vlandev_class vlandev_linux_class;
#endif
static const struct vlandev_class vlandev_stub_class;
static const struct vlandev_class vlandev_linux_class;
#endif
static const struct vlandev_class vlandev_stub_class;
@@
-60,7
+61,7
@@
static const struct vlandev_class *
vlandev_get_class(void)
{
if (!vd_class) {
vlandev_get_class(void)
{
if (!vd_class) {
-#if
def LINUX_DATAPATH
+#if
__linux__
vd_class = &vlandev_linux_class;
#else
vd_class = &vlandev_stub_class;
vd_class = &vlandev_linux_class;
#else
vd_class = &vlandev_stub_class;
@@
-160,7
+161,7
@@
vlandev_get_name(const char *real_dev_name, int vid)
\f
/* The Linux vlandev implementation. */
\f
/* The Linux vlandev implementation. */
-#ifdef
LINUX_DATAPATH
+#ifdef
__linux__
#include "rtnetlink-link.h"
#include <linux/if_vlan.h>
#include <linux/sockios.h>
#include "rtnetlink-link.h"
#include <linux/if_vlan.h>
#include <linux/sockios.h>
@@
-220,8
+221,7
@@
vlandev_linux_refresh(void)
char vlan_dev[16], real_dev[16];
int vid;
char vlan_dev[16], real_dev[16];
int vid;
- if (sscanf(line, "%15[^ |] | %d | %15s",
- vlan_dev, &vid, real_dev) == 3) {
+ if (ovs_scan(line, "%15[^ |] | %d | %15s", vlan_dev, &vid, real_dev)) {
vlandev_add__(vlan_dev, real_dev, vid);
}
}
vlandev_add__(vlan_dev, real_dev, vid);
}
}
@@
-237,17
+237,11
@@
do_vlan_ioctl(const char *netdev_name, struct vlan_ioctl_args *via,
{
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
int error;
{
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
int error;
- int sock;
via->cmd = cmd;
ovs_strlcpy(via->device1, netdev_name, sizeof via->device1);
via->cmd = cmd;
ovs_strlcpy(via->device1, netdev_name, sizeof via->device1);
- sock = netdev_linux_get_af_inet_sock();
- if (sock < 0) {
- return -sock;
- }
-
- error = ioctl(sock, SIOCSIFVLAN, via) < 0 ? errno : 0;
+ error = af_inet_ioctl(SIOCSIFVLAN, via);
if (error) {
VLOG_WARN_RL(&rl, "%s: VLAN ioctl %s failed (%s)",
netdev_name, cmd_name, ovs_strerror(error));
if (error) {
VLOG_WARN_RL(&rl, "%s: VLAN ioctl %s failed (%s)",
netdev_name, cmd_name, ovs_strerror(error));
@@
-308,7
+302,7
@@
vlandev_stub_del(const char *vlan_dev OVS_UNUSED)
return EOPNOTSUPP;
}
return EOPNOTSUPP;
}
-static const struct vlandev_class vlandev_stub_class = {
+static const struct vlandev_class
OVS_UNUSED
vlandev_stub_class = {
NULL, /* vd_refresh */
vlandev_stub_add,
vlandev_stub_del
NULL, /* vd_refresh */
vlandev_stub_add,
vlandev_stub_del
@@
-380,7
+374,7
@@
static int
vlandev_del__(const char *vlan_dev)
{
struct shash_node *vd_node = shash_find(&vlan_devs, vlan_dev);
vlandev_del__(const char *vlan_dev)
{
struct shash_node *vd_node = shash_find(&vlan_devs, vlan_dev);
- if (
!
vd_node) {
+ if (vd_node) {
struct vlan_dev *vd = vd_node->data;
struct vlan_real_dev *vrd = vd->real_dev;
struct vlan_dev *vd = vd_node->data;
struct vlan_real_dev *vrd = vd->real_dev;