Пример #1
0
int main(int argc, char **argv)
{
	struct netns_entry *root;
	int netns_ok, err;

	arg_register_batch(options, ARRAY_SIZE(options));
	register_frontends();
	register_handlers();
	if ((err = arg_parse(argc, argv)))
		exit(err);

	if (!check_caps()) {
		fprintf(stderr, "Must be run under root (or with enough capabilities).\n");
		exit(1);
	}
	netns_ok = netns_switch_root();
	if (netns_ok > 0) {
		fprintf(stderr, "Cannot change to the root name space: %s\n", strerror(netns_ok));
		exit(1);
	}

	global_handler_init();
	if ((err = netns_list(&root, netns_ok == 0))) {
		fprintf(stderr, "ERROR: %s\n", strerror(err));
		exit(1);
	}
	if ((err = frontend_output(root))) {
		fprintf(stderr, "Invalid output format specified.\n");
		exit(1);
	}
	global_handler_cleanup(root);
	netns_list_free(root);

	return 0;
}
Пример #2
0
void handler_ovs_register(void)
{
	db = OVS_DB_DEFAULT;
	arg_register_batch(options, ARRAY_SIZE(options));
	global_handler_register(&gh_ovs);
}
Пример #3
0
void frontend_init(void)
{
	arg_register_batch(options, ARRAY_SIZE(options));
}