blob: 9e4c865a9cc0fc41dbba830b756d6175e0c824cf [file] [log] [blame]
Matthias Schiffer09748a22016-05-09 18:41:08 +02001/* Copyright (C) 2016 B.A.T.M.A.N. contributors:
2 *
3 * Matthias Schiffer
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public
7 * License as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "netlink.h"
19#include "main.h"
20
21#include <linux/genetlink.h>
22#include <linux/init.h>
23#include <linux/printk.h>
24#include <net/genetlink.h>
25#include <uapi/linux/batman_adv.h>
26
27static struct genl_family batadv_netlink_family = {
28 .id = GENL_ID_GENERATE,
29 .hdrsize = 0,
30 .name = BATADV_NL_NAME,
31 .version = 1,
32 .maxattr = BATADV_ATTR_MAX,
33};
34
35static struct genl_ops batadv_netlink_ops[] = {
36};
37
38/**
39 * batadv_netlink_register - register batadv genl netlink family
40 */
41void __init batadv_netlink_register(void)
42{
43 int ret;
44
45 ret = genl_register_family_with_ops(&batadv_netlink_family,
46 batadv_netlink_ops);
47 if (ret)
48 pr_warn("unable to register netlink family");
49}
50
51/**
52 * batadv_netlink_unregister - unregister batadv genl netlink family
53 */
54void batadv_netlink_unregister(void)
55{
56 genl_unregister_family(&batadv_netlink_family);
57}