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
Merge branch 'master' of ssh://git.onelab.eu/git/sliver-openvswitch
[sliver-openvswitch.git]
/
utilities
/
ovs-ofctl.c
diff --git
a/utilities/ovs-ofctl.c
b/utilities/ovs-ofctl.c
index
26736bb
..
ec775c7
100644
(file)
--- a/
utilities/ovs-ofctl.c
+++ b/
utilities/ovs-ofctl.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012
, 2013
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.
@@
-357,8
+357,8
@@
open_vconn_socket(const char *name, struct vconn **vconnp)
char *vconn_name = xasprintf("unix:%s", name);
int error;
char *vconn_name = xasprintf("unix:%s", name);
int error;
- error = vconn_open(vconn_name, get_allowed_ofp_versions(),
vconnp
,
-
DSCP_DEFAULT
);
+ error = vconn_open(vconn_name, get_allowed_ofp_versions(),
DSCP_DEFAULT
,
+
vconnp
);
if (error && error != ENOENT) {
ovs_fatal(0, "%s: failed to open socket (%s)", name,
strerror(error));
if (error && error != ENOENT) {
ovs_fatal(0, "%s: failed to open socket (%s)", name,
strerror(error));
@@
-368,26
+368,28
@@
open_vconn_socket(const char *name, struct vconn **vconnp)
return error;
}
return error;
}
+enum open_target { MGMT, SNOOP };
+
static enum ofputil_protocol
static enum ofputil_protocol
-open_vconn__(const char *name,
const char *default_suffix
,
+open_vconn__(const char *name,
enum open_target target
,
struct vconn **vconnp)
{
struct vconn **vconnp)
{
+ const char *suffix = target == MGMT ? "mgmt" : "snoop";
char *datapath_name, *datapath_type, *socket_name;
enum ofputil_protocol protocol;
char *bridge_path;
int ofp_version;
int error;
char *datapath_name, *datapath_type, *socket_name;
enum ofputil_protocol protocol;
char *bridge_path;
int ofp_version;
int error;
- bridge_path = xasprintf("%s/%s.%s", ovs_rundir(), name,
default_
suffix);
+ bridge_path = xasprintf("%s/%s.%s", ovs_rundir(), name, suffix);
ofproto_parse_name(name, &datapath_name, &datapath_type);
ofproto_parse_name(name, &datapath_name, &datapath_type);
- socket_name = xasprintf("%s/%s.%s",
- ovs_rundir(), datapath_name, default_suffix);
+ socket_name = xasprintf("%s/%s.%s", ovs_rundir(), datapath_name, suffix);
free(datapath_name);
free(datapath_type);
if (strchr(name, ':')) {
free(datapath_name);
free(datapath_type);
if (strchr(name, ':')) {
- run(vconn_open
_block(name, get_allowed_ofp_versions()
, vconnp),
+ run(vconn_open
(name, get_allowed_ofp_versions(), DSCP_DEFAULT
, vconnp),
"connecting to %s", name);
} else if (!open_vconn_socket(name, vconnp)) {
/* Fall Through. */
"connecting to %s", name);
} else if (!open_vconn_socket(name, vconnp)) {
/* Fall Through. */
@@
-399,6
+401,10
@@
open_vconn__(const char *name, const char *default_suffix,
ovs_fatal(0, "%s is not a bridge or a socket", name);
}
ovs_fatal(0, "%s is not a bridge or a socket", name);
}
+ if (target == SNOOP) {
+ vconn_set_recv_any_version(*vconnp);
+ }
+
free(bridge_path);
free(socket_name);
free(bridge_path);
free(socket_name);
@@
-421,7
+427,7
@@
open_vconn__(const char *name, const char *default_suffix,
static enum ofputil_protocol
open_vconn(const char *name, struct vconn **vconnp)
{
static enum ofputil_protocol
open_vconn(const char *name, struct vconn **vconnp)
{
- return open_vconn__(name,
"mgmt"
, vconnp);
+ return open_vconn__(name,
MGMT
, vconnp);
}
static void
}
static void
@@
-1456,7
+1462,7
@@
ofctl_snoop(int argc OVS_UNUSED, char *argv[])
{
struct vconn *vconn;
{
struct vconn *vconn;
- open_vconn__(argv[1],
"snoop"
, &vconn);
+ open_vconn__(argv[1],
SNOOP
, &vconn);
monitor_vconn(vconn);
}
monitor_vconn(vconn);
}
@@
-2176,7
+2182,7
@@
ofctl_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms)
break;
}
}
break;
}
}
-
assert(IS_POW
2(protocol));
+
ovs_assert(is_pow
2(protocol));
printf("chosen protocol: %s\n", ofputil_protocol_to_string(protocol));
printf("chosen protocol: %s\n", ofputil_protocol_to_string(protocol));