projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rearrange structures to better fit valgrind's memory leak heuristics.
[openvswitch]
/
utilities
/
ovs-vsctl.c
diff --git
a/utilities/ovs-vsctl.c
b/utilities/ovs-vsctl.c
index a2af2f669b93a68bdd35f0ecd7d013cd2bb50b21..d752a547d1bb9d11956e1ef63caa61fd22fd9df0 100644
(file)
--- a/
utilities/ovs-vsctl.c
+++ b/
utilities/ovs-vsctl.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2011
, 2012
Nicira Networks.
*
* 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.
@@
-41,7
+41,7
@@
#include "stream-ssl.h"
#include "sset.h"
#include "svec.h"
#include "stream-ssl.h"
#include "sset.h"
#include "svec.h"
-#include "
vswitchd
/vswitch-idl.h"
+#include "
lib
/vswitch-idl.h"
#include "table.h"
#include "timeval.h"
#include "util.h"
#include "table.h"
#include "timeval.h"
#include "util.h"
@@
-489,7
+489,7
@@
Bridge commands:\n\
add-br BRIDGE PARENT VLAN create new fake BRIDGE in PARENT on VLAN\n\
del-br BRIDGE delete BRIDGE and all of its ports\n\
list-br print the names of all the bridges\n\
add-br BRIDGE PARENT VLAN create new fake BRIDGE in PARENT on VLAN\n\
del-br BRIDGE delete BRIDGE and all of its ports\n\
list-br print the names of all the bridges\n\
- br-exists BRIDGE
test whether BRIDGE exists
\n\
+ br-exists BRIDGE
exit 2 if BRIDGE does not exist
\n\
br-to-vlan BRIDGE print the VLAN which BRIDGE is on\n\
br-to-parent BRIDGE print the parent of BRIDGE\n\
br-set-external-id BRIDGE KEY VALUE set KEY on BRIDGE to VALUE\n\
br-to-vlan BRIDGE print the VLAN which BRIDGE is on\n\
br-to-parent BRIDGE print the parent of BRIDGE\n\
br-set-external-id BRIDGE KEY VALUE set KEY on BRIDGE to VALUE\n\
@@
-612,8
+612,13
@@
struct vsctl_bridge {
struct ovsrec_controller **ctrl;
char *fail_mode;
size_t n_ctrl;
struct ovsrec_controller **ctrl;
char *fail_mode;
size_t n_ctrl;
- struct vsctl_bridge *parent;
- int vlan;
+
+ /* VLAN ("fake") bridge support.
+ *
+ * Use 'parent != NULL' to detect a fake bridge, because 'vlan' can be 0
+ * in either case. */
+ struct vsctl_bridge *parent; /* Real bridge, or NULL. */
+ int vlan; /* VLAN VID (0...4095), or 0. */
};
struct vsctl_port {
};
struct vsctl_port {
@@
-704,7
+709,7
@@
port_is_fake_bridge(const struct ovsrec_port *port_cfg)
{
return (port_cfg->fake_bridge
&& port_cfg->tag
{
return (port_cfg->fake_bridge
&& port_cfg->tag
- && *port_cfg->tag >=
1
&& *port_cfg->tag <= 4095);
+ && *port_cfg->tag >=
0
&& *port_cfg->tag <= 4095);
}
static struct vsctl_bridge *
}
static struct vsctl_bridge *
@@
-841,7
+846,7
@@
get_info(struct vsctl_context *ctx, struct vsctl_info *info)
port = xmalloc(sizeof *port);
port->port_cfg = port_cfg;
if (port_cfg->tag
port = xmalloc(sizeof *port);
port->port_cfg = port_cfg;
if (port_cfg->tag
- && *port_cfg->tag >=
1
&& *port_cfg->tag <= 4095) {
+ && *port_cfg->tag >=
0
&& *port_cfg->tag <= 4095) {
port->bridge = find_vlan_bridge(info, br, *port_cfg->tag);
if (!port->bridge) {
port->bridge = br;
port->bridge = find_vlan_bridge(info, br, *port_cfg->tag);
if (!port->bridge) {
port->bridge = br;
@@
-1329,8
+1334,8
@@
cmd_add_br(struct vsctl_context *ctx)
} else if (ctx->argc == 4) {
parent_name = ctx->argv[2];
vlan = atoi(ctx->argv[3]);
} else if (ctx->argc == 4) {
parent_name = ctx->argv[2];
vlan = atoi(ctx->argv[3]);
- if (vlan <
1
|| vlan > 4095) {
- vsctl_fatal("%s: vlan must be between
1
and 4095", ctx->argv[0]);
+ if (vlan <
0
|| vlan > 4095) {
+ vsctl_fatal("%s: vlan must be between
0
and 4095", ctx->argv[0]);
}
} else {
vsctl_fatal("'%s' command takes exactly 1 or 3 arguments",
}
} else {
vsctl_fatal("'%s' command takes exactly 1 or 3 arguments",
@@
-1365,6
+1370,7
@@
cmd_add_br(struct vsctl_context *ctx)
br_name, parent_name, vlan, br_name, br->vlan);
}
}
br_name, parent_name, vlan, br_name, br->vlan);
}
}
+ free_info(&info);
return;
}
}
return;
}
}
@@
-1397,7
+1403,7
@@
cmd_add_br(struct vsctl_context *ctx)
int64_t tag = vlan;
parent = find_bridge(&info, parent_name, false);
int64_t tag = vlan;
parent = find_bridge(&info, parent_name, false);
- if (parent && parent->
vlan
) {
+ if (parent && parent->
parent
) {
vsctl_fatal("cannot create bridge with fake bridge as parent");
}
if (!parent) {
vsctl_fatal("cannot create bridge with fake bridge as parent");
}
if (!parent) {
@@
-1725,6
+1731,7
@@
add_port(struct vsctl_context *ctx,
svec_destroy(&want_names);
svec_destroy(&have_names);
svec_destroy(&want_names);
svec_destroy(&have_names);
+ free_info(&info);
return;
}
return;
}
@@
-1750,7
+1757,7
@@
add_port(struct vsctl_context *ctx,
ovsrec_port_set_bond_fake_iface(port, fake_iface);
free(ifaces);
ovsrec_port_set_bond_fake_iface(port, fake_iface);
free(ifaces);
- if (bridge->
vlan
) {
+ if (bridge->
parent
) {
int64_t tag = bridge->vlan;
ovsrec_port_set_tag(port, &tag, 1);
}
int64_t tag = bridge->vlan;
ovsrec_port_set_tag(port, &tag, 1);
}
@@
-2340,6
+2347,10
@@
static const struct vsctl_table_class tables[] = {
&ovsrec_bridge_col_sflow},
{NULL, NULL, NULL}}},
&ovsrec_bridge_col_sflow},
{NULL, NULL, NULL}}},
+ {&ovsrec_table_flow_table,
+ {{&ovsrec_table_flow_table, &ovsrec_flow_table_col_name, NULL},
+ {NULL, NULL, NULL}}},
+
{NULL, {{NULL, NULL, NULL}, {NULL, NULL, NULL}}}
};
{NULL, {{NULL, NULL, NULL}, {NULL, NULL, NULL}}}
};
@@
-3531,6
+3542,7
@@
is_condition_satisfied(const struct vsctl_table_class *table,
}
ovsdb_atom_destroy(&want_key, column->type.key.type);
}
ovsdb_atom_destroy(&want_key, column->type.key.type);
+ ovsdb_datum_destroy(&b, &type);
} else {
struct ovsdb_datum want_datum;
} else {
struct ovsdb_datum want_datum;