summaryrefslogtreecommitdiff
path: root/tipc/bearer.c
blob: 05dabe696de1e6b952b971d04b2dd31ab4e75693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
/*
 * bearer.c	TIPC bearer functionality.
 *
 *		This program is free software; you can redistribute it and/or
 *		modify it under the terms of the GNU General Public License
 *		as published by the Free Software Foundation; either version
 *		2 of the License, or (at your option) any later version.
 *
 * Authors:	Richard Alpe <richard.alpe@ericsson.com>
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>

#include <linux/tipc_netlink.h>
#include <linux/tipc.h>
#include <linux/genetlink.h>

#include <libmnl/libmnl.h>
#include <sys/socket.h>

#include "cmdl.h"
#include "msg.h"
#include "bearer.h"

static void _print_bearer_opts(void)
{
	fprintf(stderr,
		"OPTIONS\n"
		" priority              - Bearer link priority\n"
		" tolerance             - Bearer link tolerance\n"
		" window                - Bearer link window\n");
}

static void _print_bearer_media(void)
{
	fprintf(stderr,
		"\nMEDIA\n"
		" udp                   - User Datagram Protocol\n"
		" ib                    - Infiniband\n"
		" eth                   - Ethernet\n");
}

static void cmd_bearer_enable_l2_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr,
		"Usage: %s bearer enable media %s device DEVICE [OPTIONS]\n"
		"\nOPTIONS\n"
		" domain DOMAIN         - Discovery domain\n"
		" priority PRIORITY     - Bearer priority\n",
		cmdl->argv[0], media);
}

static void cmd_bearer_enable_udp_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr,
		"Usage: %s bearer enable media %s name NAME localip IP [OPTIONS]\n"
		"\nOPTIONS\n"
		" domain DOMAIN         - Discovery domain\n"
		" priority PRIORITY     - Bearer priority\n"
		" localport PORT        - Local UDP port (default 6118)\n"
		" remoteip IP           - Remote IP address\n"
		" remoteport IP         - Remote UDP port (default 6118)\n",
		cmdl->argv[0], media);
}

static int get_netid_cb(const struct nlmsghdr *nlh, void *data)
{
	struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
	struct nlattr *info[TIPC_NLA_MAX + 1] = {};
	struct nlattr *attrs[TIPC_NLA_NET_MAX + 1] = {};
	int *netid = (int*)data;

	mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
	if (!info[TIPC_NLA_NET])
		return MNL_CB_ERROR;
	mnl_attr_parse_nested(info[TIPC_NLA_NET], parse_attrs, attrs);
	if (!attrs[TIPC_NLA_NET_ID])
		return MNL_CB_ERROR;
	*netid = mnl_attr_get_u32(attrs[TIPC_NLA_NET_ID]);

	return MNL_CB_OK;
}

static int generate_multicast(short af, char *buf, int bufsize)
{
	int netid;
	char mnl_msg[MNL_SOCKET_BUFFER_SIZE];
	struct nlmsghdr *nlh;

	if (!(nlh = msg_init(mnl_msg, TIPC_NL_NET_GET))) {
		fprintf(stderr, "error, message initialization failed\n");
		return -1;
	}
	if (msg_dumpit(nlh, get_netid_cb, &netid)) {
		fprintf(stderr, "error, failed to fetch TIPC network id from kernel\n");
		return -EINVAL;
	}
	if (af == AF_INET)
		snprintf(buf, bufsize, "228.0.%u.%u", (netid>>8) & 0xFF, netid & 0xFF);
	else
		snprintf(buf, bufsize, "ff02::%u", netid);

	return 0;
}

static int nl_add_udp_enable_opts(struct nlmsghdr *nlh, struct opt *opts,
				  struct cmdl *cmdl)
{
	int err;
	struct opt *opt;
	struct nlattr *nest;
	char buf[INET6_ADDRSTRLEN];
	char *locport = "6118";
	char *remport = "6118";
	char *locip = NULL;
	char *remip = NULL;
	struct addrinfo *loc = NULL;
	struct addrinfo *rem = NULL;
	struct addrinfo hints = {
		.ai_family = AF_UNSPEC,
		.ai_socktype = SOCK_DGRAM
	};

	if (!(opt = get_opt(opts, "localip"))) {
		fprintf(stderr, "error, udp bearer localip missing\n");
		cmd_bearer_enable_udp_help(cmdl, "udp");
		return -EINVAL;
	}
	locip = opt->val;

	if ((opt = get_opt(opts, "remoteip")))
		remip = opt->val;

	if ((opt = get_opt(opts, "localport")))
		locport = opt->val;

	if ((opt = get_opt(opts, "remoteport")))
		remport = opt->val;

	if ((err = getaddrinfo(locip, locport, &hints, &loc))) {
		fprintf(stderr, "UDP local address error: %s\n",
			gai_strerror(err));
		return err;
	}

	if (!remip) {
		if (generate_multicast(loc->ai_family, buf, sizeof(buf))) {
			fprintf(stderr, "Failed to generate multicast address\n");
			return -EINVAL;
		}
		remip = buf;
	}

	if ((err = getaddrinfo(remip, remport, &hints, &rem))) {
		fprintf(stderr, "UDP remote address error: %s\n",
			gai_strerror(err));
		freeaddrinfo(loc);
		return err;
	}

	if (rem->ai_family != loc->ai_family) {
		fprintf(stderr, "UDP local and remote AF mismatch\n");
		return -EINVAL;
	}

	nest = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER_UDP_OPTS);
	mnl_attr_put(nlh, TIPC_NLA_UDP_LOCAL, loc->ai_addrlen, loc->ai_addr);
	mnl_attr_put(nlh, TIPC_NLA_UDP_REMOTE, rem->ai_addrlen, rem->ai_addr);
	mnl_attr_nest_end(nlh, nest);

	freeaddrinfo(rem);
	freeaddrinfo(loc);

	return 0;
}

static int nl_add_bearer_name(struct nlmsghdr *nlh, const struct cmd *cmd,
			   struct cmdl *cmdl, struct opt *opts,
			   struct tipc_sup_media sup_media[])
{
	char id[TIPC_MAX_BEARER_NAME];
	char *media;
	char *identifier;
	struct opt *opt;
	struct tipc_sup_media *entry;

	if (!(opt = get_opt(opts, "media"))) {
		if (help_flag)
			(cmd->help)(cmdl);
		else
			fprintf(stderr, "error, missing bearer media\n");
		return -EINVAL;
	}
	media = opt->val;

	for (entry = sup_media; entry->media; entry++) {
		if (strcmp(entry->media, media))
			continue;

		if (!(opt = get_opt(opts, entry->identifier))) {
			if (help_flag)
				(entry->help)(cmdl, media);
			else
				fprintf(stderr, "error, missing bearer %s\n",
						entry->identifier);
			return -EINVAL;
		}

		identifier = opt->val;
		snprintf(id, sizeof(id), "%s:%s", media, identifier);
		mnl_attr_put_strz(nlh, TIPC_NLA_BEARER_NAME, id);

		return 0;
	}

	fprintf(stderr, "error, invalid media type %s\n", media);

	return -EINVAL;
}

static void cmd_bearer_enable_help(struct cmdl *cmdl)
{
	fprintf(stderr,
		"Usage: %s bearer enable [OPTIONS] media MEDIA ARGS...\n\n"
		"OPTIONS\n"
		" domain DOMAIN         - Discovery domain\n"
		" priority PRIORITY     - Bearer priority\n",
		cmdl->argv[0]);
	_print_bearer_media();
}

static int cmd_bearer_enable(struct nlmsghdr *nlh, const struct cmd *cmd,
			     struct cmdl *cmdl, void *data)
{
	int err;
	struct opt *opt;
	struct nlattr *nest;
	char buf[MNL_SOCKET_BUFFER_SIZE];
	struct opt opts[] = {
		{ "device",		NULL },
		{ "domain",		NULL },
		{ "localip",		NULL },
		{ "localport",		NULL },
		{ "media",		NULL },
		{ "name",		NULL },
		{ "priority",		NULL },
		{ "remoteip",		NULL },
		{ "remoteport",		NULL },
		{ NULL }
	};
	struct tipc_sup_media sup_media[] = {
		{ "udp",	"name",		cmd_bearer_enable_udp_help},
		{ "eth",	"device",	cmd_bearer_enable_l2_help },
		{ "ib",		"device",	cmd_bearer_enable_l2_help },
		{ NULL, },
	};

	if (parse_opts(opts, cmdl) < 0) {
		if (help_flag)
			(cmd->help)(cmdl);
		return -EINVAL;
	}

	if (!(nlh = msg_init(buf, TIPC_NL_BEARER_ENABLE))) {
		fprintf(stderr, "error: message initialisation failed\n");
		return -1;
	}
	nest = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);

	if ((opt = get_opt(opts, "domain")))
		mnl_attr_put_u32(nlh, TIPC_NLA_BEARER_DOMAIN, atoi(opt->val));

	if ((opt = get_opt(opts, "priority"))) {
		struct nlattr *props;

		props = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER_PROP);
		mnl_attr_put_u32(nlh, TIPC_NLA_PROP_PRIO, atoi(opt->val));
		mnl_attr_nest_end(nlh, props);
	}

	err = nl_add_bearer_name(nlh, cmd, cmdl, opts, sup_media);
	if (err)
		return err;

	opt = get_opt(opts, "media");
	if (strcmp(opt->val, "udp") == 0) {
		err = nl_add_udp_enable_opts(nlh, opts, cmdl);
		if (err)
			return err;
	}
	mnl_attr_nest_end(nlh, nest);

	return msg_doit(nlh, NULL, NULL);
}

static void cmd_bearer_disable_l2_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr, "Usage: %s bearer disable media %s device DEVICE\n",
		cmdl->argv[0], media);
}

static void cmd_bearer_disable_udp_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr, "Usage: %s bearer disable media %s name NAME\n",
		cmdl->argv[0], media);
}

static void cmd_bearer_disable_help(struct cmdl *cmdl)
{
	fprintf(stderr, "Usage: %s bearer disable media MEDIA ARGS...\n",
		cmdl->argv[0]);
	_print_bearer_media();
}

static int cmd_bearer_disable(struct nlmsghdr *nlh, const struct cmd *cmd,
			      struct cmdl *cmdl, void *data)
{
	int err;
	char buf[MNL_SOCKET_BUFFER_SIZE];
	struct nlattr *nest;
	struct opt opts[] = {
		{ "device",		NULL },
		{ "name",		NULL },
		{ "media",		NULL },
		{ NULL }
	};
	struct tipc_sup_media sup_media[] = {
		{ "udp",	"name",		cmd_bearer_disable_udp_help},
		{ "eth",	"device",	cmd_bearer_disable_l2_help },
		{ "ib",		"device",	cmd_bearer_disable_l2_help },
		{ NULL, },
	};

	if (parse_opts(opts, cmdl) < 0) {
		if (help_flag)
			(cmd->help)(cmdl);
		return -EINVAL;
	}

	if (!(nlh = msg_init(buf, TIPC_NL_BEARER_DISABLE))) {
		fprintf(stderr, "error, message initialisation failed\n");
		return -1;
	}

	nest = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);
	err = nl_add_bearer_name(nlh, cmd, cmdl, opts, sup_media);
	if (err)
		return err;
	mnl_attr_nest_end(nlh, nest);

	return msg_doit(nlh, NULL, NULL);

}

static void cmd_bearer_set_help(struct cmdl *cmdl)
{
	fprintf(stderr, "Usage: %s bearer set OPTION media MEDIA ARGS...\n",
		cmdl->argv[0]);
	_print_bearer_opts();
	_print_bearer_media();
}

static void cmd_bearer_set_udp_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr, "Usage: %s bearer set OPTION media %s name NAME\n\n",
		cmdl->argv[0], media);
	_print_bearer_opts();
}

static void cmd_bearer_set_l2_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr,
		"Usage: %s bearer set [OPTION]... media %s device DEVICE\n",
		cmdl->argv[0], media);
	_print_bearer_opts();
}

static int cmd_bearer_set_prop(struct nlmsghdr *nlh, const struct cmd *cmd,
			 struct cmdl *cmdl, void *data)
{
	int err;
	int val;
	int prop;
	char buf[MNL_SOCKET_BUFFER_SIZE];
	struct nlattr *props;
	struct nlattr *attrs;
	struct opt opts[] = {
		{ "device",		NULL },
		{ "media",		NULL },
		{ "name",		NULL },
		{ NULL }
	};
	struct tipc_sup_media sup_media[] = {
		{ "udp",	"name",		cmd_bearer_set_udp_help},
		{ "eth",	"device",	cmd_bearer_set_l2_help },
		{ "ib",		"device",	cmd_bearer_set_l2_help },
		{ NULL, },
	};

	if (strcmp(cmd->cmd, "priority") == 0)
		prop = TIPC_NLA_PROP_PRIO;
	else if ((strcmp(cmd->cmd, "tolerance") == 0))
		prop = TIPC_NLA_PROP_TOL;
	else if ((strcmp(cmd->cmd, "window") == 0))
		prop = TIPC_NLA_PROP_WIN;
	else
		return -EINVAL;

	if (cmdl->optind >= cmdl->argc) {
		fprintf(stderr, "error, missing value\n");
		return -EINVAL;
	}
	val = atoi(shift_cmdl(cmdl));

	if (parse_opts(opts, cmdl) < 0)
		return -EINVAL;

	if (!(nlh = msg_init(buf, TIPC_NL_BEARER_SET))) {
		fprintf(stderr, "error, message initialisation failed\n");
		return -1;
	}
	attrs = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);

	props = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER_PROP);
	mnl_attr_put_u32(nlh, prop, val);
	mnl_attr_nest_end(nlh, props);

	err = nl_add_bearer_name(nlh, cmd, cmdl, opts, sup_media);
	if (err)
		return err;

	mnl_attr_nest_end(nlh, attrs);

	return msg_doit(nlh, NULL, NULL);
}

static int cmd_bearer_set(struct nlmsghdr *nlh, const struct cmd *cmd,
			  struct cmdl *cmdl, void *data)
{
	const struct cmd cmds[] = {
		{ "priority",	cmd_bearer_set_prop,	cmd_bearer_set_help },
		{ "tolerance",	cmd_bearer_set_prop,	cmd_bearer_set_help },
		{ "window",	cmd_bearer_set_prop,	cmd_bearer_set_help },
		{ NULL }
	};

	return run_cmd(nlh, cmd, cmds, cmdl, NULL);
}

static void cmd_bearer_get_help(struct cmdl *cmdl)
{
	fprintf(stderr, "Usage: %s bearer get OPTION media MEDIA ARGS...\n",
		cmdl->argv[0]);
	_print_bearer_opts();
	_print_bearer_media();
}

static void cmd_bearer_get_udp_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr, "Usage: %s bearer get OPTION media %s name NAME\n\n",
		cmdl->argv[0], media);
	_print_bearer_opts();
}

static void cmd_bearer_get_l2_help(struct cmdl *cmdl, char *media)
{
	fprintf(stderr,
		"Usage: %s bearer get OPTION media %s device DEVICE\n",
		cmdl->argv[0], media);
	_print_bearer_opts();
}

static int bearer_get_cb(const struct nlmsghdr *nlh, void *data)
{
	int *prop = data;
	struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
	struct nlattr *info[TIPC_NLA_MAX + 1] = {};
	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {};
	struct nlattr *props[TIPC_NLA_PROP_MAX + 1] = {};

	mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
	if (!info[TIPC_NLA_BEARER])
		return MNL_CB_ERROR;

	mnl_attr_parse_nested(info[TIPC_NLA_BEARER], parse_attrs, attrs);
	if (!attrs[TIPC_NLA_BEARER_PROP])
		return MNL_CB_ERROR;

	mnl_attr_parse_nested(attrs[TIPC_NLA_BEARER_PROP], parse_attrs, props);
	if (!props[*prop])
		return MNL_CB_ERROR;

	printf("%u\n", mnl_attr_get_u32(props[*prop]));

	return MNL_CB_OK;
}

static int cmd_bearer_get_prop(struct nlmsghdr *nlh, const struct cmd *cmd,
			       struct cmdl *cmdl, void *data)
{
	int err;
	int prop;
	char buf[MNL_SOCKET_BUFFER_SIZE];
	struct nlattr *attrs;
	struct opt opts[] = {
		{ "device",		NULL },
		{ "media",		NULL },
		{ "name",		NULL },
		{ NULL }
	};
	struct tipc_sup_media sup_media[] = {
		{ "udp",	"name",		cmd_bearer_get_udp_help},
		{ "eth",	"device",	cmd_bearer_get_l2_help },
		{ "ib",		"device",	cmd_bearer_get_l2_help },
		{ NULL, },
	};

	if (strcmp(cmd->cmd, "priority") == 0)
		prop = TIPC_NLA_PROP_PRIO;
	else if ((strcmp(cmd->cmd, "tolerance") == 0))
		prop = TIPC_NLA_PROP_TOL;
	else if ((strcmp(cmd->cmd, "window") == 0))
		prop = TIPC_NLA_PROP_WIN;
	else
		return -EINVAL;

	if (parse_opts(opts, cmdl) < 0)
		return -EINVAL;

	if (!(nlh = msg_init(buf, TIPC_NL_BEARER_GET))) {
		fprintf(stderr, "error, message initialisation failed\n");
		return -1;
	}

	attrs = mnl_attr_nest_start(nlh, TIPC_NLA_BEARER);
	err = nl_add_bearer_name(nlh, cmd, cmdl, opts, sup_media);
	if (err)
		return err;
	mnl_attr_nest_end(nlh, attrs);

	return msg_doit(nlh, bearer_get_cb, &prop);
}

static int cmd_bearer_get(struct nlmsghdr *nlh, const struct cmd *cmd,
			  struct cmdl *cmdl, void *data)
{
	const struct cmd cmds[] = {
		{ "priority",	cmd_bearer_get_prop,	cmd_bearer_get_help },
		{ "tolerance",	cmd_bearer_get_prop,	cmd_bearer_get_help },
		{ "window",	cmd_bearer_get_prop,	cmd_bearer_get_help },
		{ NULL }
	};

	return run_cmd(nlh, cmd, cmds, cmdl, NULL);
}

static int bearer_list_cb(const struct nlmsghdr *nlh, void *data)
{
	struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
	struct nlattr *info[TIPC_NLA_MAX + 1] = {};
	struct nlattr *attrs[TIPC_NLA_BEARER_MAX + 1] = {};

	mnl_attr_parse(nlh, sizeof(*genl), parse_attrs, info);
	if (!info[TIPC_NLA_BEARER]) {
		fprintf(stderr, "No bearer in netlink response\n");
		return MNL_CB_ERROR;
	}

	mnl_attr_parse_nested(info[TIPC_NLA_BEARER], parse_attrs, attrs);
	if (!attrs[TIPC_NLA_BEARER_NAME]) {
		fprintf(stderr, "Bearer name missing in netlink response\n");
		return MNL_CB_ERROR;
	}

	printf("%s\n", mnl_attr_get_str(attrs[TIPC_NLA_BEARER_NAME]));

	return MNL_CB_OK;
}

static int cmd_bearer_list(struct nlmsghdr *nlh, const struct cmd *cmd,
			   struct cmdl *cmdl, void *data)
{
	char buf[MNL_SOCKET_BUFFER_SIZE];

	if (help_flag) {
		fprintf(stderr, "Usage: %s bearer list\n", cmdl->argv[0]);
		return -EINVAL;
	}

	if (!(nlh = msg_init(buf, TIPC_NL_BEARER_GET))) {
		fprintf(stderr, "error, message initialisation failed\n");
		return -1;
	}

	return msg_dumpit(nlh, bearer_list_cb, NULL);
}

void cmd_bearer_help(struct cmdl *cmdl)
{
	fprintf(stderr,
		"Usage: %s bearer COMMAND [ARGS] ...\n"
		"\n"
		"COMMANDS\n"
		" enable                - Enable a bearer\n"
		" disable               - Disable a bearer\n"
		" set                   - Set various bearer properties\n"
		" get                   - Get various bearer properties\n"
		" list                  - List bearers\n", cmdl->argv[0]);
}

int cmd_bearer(struct nlmsghdr *nlh, const struct cmd *cmd, struct cmdl *cmdl,
	       void *data)
{
	const struct cmd cmds[] = {
		{ "disable",	cmd_bearer_disable,	cmd_bearer_disable_help },
		{ "enable",	cmd_bearer_enable,	cmd_bearer_enable_help },
		{ "get",	cmd_bearer_get,		cmd_bearer_get_help },
		{ "list",	cmd_bearer_list,	NULL },
		{ "set",	cmd_bearer_set,		cmd_bearer_set_help },
		{ NULL }
	};

	return run_cmd(nlh, cmd, cmds, cmdl, NULL);
}