]> git.proxmox.com Git - mirror_ovs.git/blame - lib/dummy.c
ipf: Avoid accessing to a freed rp.
[mirror_ovs.git] / lib / dummy.c
CommitLineData
614c4892 1/*
8420c7ad 2 * Copyright (c) 2010, 2011, 2012, 2013, 2015 Nicira, Inc.
614c4892
BP
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <config.h>
614c4892 18#include "dummy.h"
8420c7ad
BP
19#include <string.h>
20#include "util.h"
614c4892
BP
21
22/* Enables support for "dummy" network devices and dpifs, which are useful for
23 * testing. A client program might call this function if it is designed
24 * specifically for testing or the user enables it on the command line.
25 *
8420c7ad
BP
26 * 'arg' is parsed to determine the override level (see the definition of enum
27 * dummy_level).
0cbfe35d 28 *
614c4892
BP
29 * There is no strong reason why dummy devices shouldn't always be enabled. */
30void
8420c7ad 31dummy_enable(const char *arg)
614c4892 32{
8420c7ad
BP
33 enum dummy_level level;
34
35 if (!arg || !arg[0]) {
36 level = DUMMY_OVERRIDE_NONE;
37 } else if (!strcmp(arg, "system")) {
38 level = DUMMY_OVERRIDE_SYSTEM;
39 } else if (!strcmp(arg, "override")) {
40 level = DUMMY_OVERRIDE_ALL;
41 } else {
42 ovs_fatal(0, "%s: unknown dummy level", arg);
43 }
44
45 netdev_dummy_register(level);
46 dpif_dummy_register(level);
fbac791a 47 timeval_dummy_register();
d4abaff5 48 ofpact_dummy_enable();
614c4892 49}
0cbfe35d 50