mirror of
https://github.com/openvswitch/ovs
synced 2025-10-21 14:49:41 +00:00
The -O and -F options interact, so that it's possible to select only flow formats that are not supported on a given OpenFlow version. It seems best to report these problems up front rather than failing in a more mysterious way later. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Simon Horman <horms@verge.net.au>
43 lines
953 B
C
43 lines
953 B
C
#include <config.h>
|
|
#include "ofp-util.h"
|
|
#include "ofp-version-opt.h"
|
|
#include "vlog.h"
|
|
#include "dynamic-string.h"
|
|
|
|
VLOG_DEFINE_THIS_MODULE(ofp_version);
|
|
|
|
static uint32_t allowed_versions = 0;
|
|
|
|
uint32_t
|
|
get_allowed_ofp_versions(void)
|
|
{
|
|
return allowed_versions ? allowed_versions : OFPUTIL_DEFAULT_VERSIONS;
|
|
}
|
|
|
|
void
|
|
set_allowed_ofp_versions(const char *string)
|
|
{
|
|
allowed_versions = ofputil_versions_from_string(string);
|
|
}
|
|
|
|
void
|
|
mask_allowed_ofp_versions(uint32_t bitmap)
|
|
{
|
|
allowed_versions &= bitmap;
|
|
}
|
|
|
|
void
|
|
ofp_version_usage(void)
|
|
{
|
|
struct ds msg = DS_EMPTY_INITIALIZER;
|
|
|
|
ofputil_format_version_bitmap_names(&msg, OFPUTIL_DEFAULT_VERSIONS);
|
|
printf(
|
|
"\nOpen Flow Version options:\n"
|
|
" -V, --version display version information\n"
|
|
" -O, --protocols set allowed Open Flow versions\n"
|
|
" (default: %s)\n",
|
|
ds_cstr(&msg));
|
|
ds_destroy(&msg);
|
|
}
|