aboutsummaryrefslogtreecommitdiff
path: root/vswitchd/ovs-brcompatd.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-07-30 13:45:52 -0700
committerBen Pfaff <blp@nicira.com>2009-08-07 15:05:47 -0700
commit7f42c1d707c65befb9d92bebae069e4f4b0be1fb (patch)
tree0596567bd825d182c529c74cc6555e3fd628af30 /vswitchd/ovs-brcompatd.c
parentc338e47fbef2ce1354acbd9f521196dea3fe93f5 (diff)
brcompatd: Make parse_command() parse commands without dp arguments.
The BRCTL_GET_BRIDGES ioctl is going to move to userspace, but that ioctl doesn't provide a bridge name as argument, so we need to support that.
Diffstat (limited to 'vswitchd/ovs-brcompatd.c')
-rw-r--r--vswitchd/ovs-brcompatd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c
index 9254c588..99e9c803 100644
--- a/vswitchd/ovs-brcompatd.c
+++ b/vswitchd/ovs-brcompatd.c
@@ -413,7 +413,7 @@ parse_command(struct ofpbuf *buffer, uint32_t *seq, const char **br_name,
const char **port_name, uint64_t *count, uint64_t *skip)
{
static const struct nl_policy policy[] = {
- [BRC_GENL_A_DP_NAME] = { .type = NL_A_STRING },
+ [BRC_GENL_A_DP_NAME] = { .type = NL_A_STRING, .optional = true },
[BRC_GENL_A_PORT_NAME] = { .type = NL_A_STRING, .optional = true },
[BRC_GENL_A_FDB_COUNT] = { .type = NL_A_U64, .optional = true },
[BRC_GENL_A_FDB_SKIP] = { .type = NL_A_U64, .optional = true },
@@ -422,6 +422,7 @@ parse_command(struct ofpbuf *buffer, uint32_t *seq, const char **br_name,
if (!nl_policy_parse(buffer, NLMSG_HDRLEN + GENL_HDRLEN, policy,
attrs, ARRAY_SIZE(policy))
+ || (br_name && !attrs[BRC_GENL_A_DP_NAME])
|| (port_name && !attrs[BRC_GENL_A_PORT_NAME])
|| (count && !attrs[BRC_GENL_A_FDB_COUNT])
|| (skip && !attrs[BRC_GENL_A_FDB_SKIP])) {
@@ -429,7 +430,9 @@ parse_command(struct ofpbuf *buffer, uint32_t *seq, const char **br_name,
}
*seq = ((struct nlmsghdr *) buffer->data)->nlmsg_seq;
- *br_name = nl_attr_get_string(attrs[BRC_GENL_A_DP_NAME]);
+ if (br_name) {
+ *br_name = nl_attr_get_string(attrs[BRC_GENL_A_DP_NAME]);
+ }
if (port_name) {
*port_name = nl_attr_get_string(attrs[BRC_GENL_A_PORT_NAME]);
}