]> git.proxmox.com Git - mirror_ovs.git/blame_incremental - datapath/compat.h
compat: Use nla_parse deprecated functions
[mirror_ovs.git] / datapath / compat.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 2007-2015 Nicira, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 * 02110-1301, USA
17 */
18
19#ifndef COMPAT_H
20#define COMPAT_H 1
21
22#include <linux/in.h>
23#include <linux/in_route.h>
24#include <linux/netlink.h>
25#include <net/ip.h>
26#include <net/route.h>
27#include <net/xfrm.h>
28#include <net/netfilter/ipv6/nf_defrag_ipv6.h>
29#include <net/netfilter/nf_conntrack_count.h>
30
31/* Fix grsecurity patch compilation issue. */
32#ifdef CONSTIFY_PLUGIN
33#include <linux/cache.h>
34#undef __read_mostly
35#define __read_mostly
36#endif
37
38/* Even though vanilla 3.10 kernel has grp->id, RHEL 7 kernel is missing
39 * this field. */
40#ifdef HAVE_GENL_MULTICAST_GROUP_WITH_ID
41#define GROUP_ID(grp) ((grp)->id)
42#else
43#define GROUP_ID(grp) 0
44#endif
45
46#ifdef HAVE_NF_IPV6_OPS_FRAGMENT
47static inline int __init ip6_output_init(void) { return 0; }
48static inline void ip6_output_exit(void) { }
49#else
50int __init ip6_output_init(void);
51void ip6_output_exit(void);
52#endif
53
54static inline int __init compat_init(void)
55{
56 int err;
57
58 err = ipfrag_init();
59 if (err)
60 return err;
61
62 err = nf_ct_frag6_init();
63 if (err)
64 goto error_ipfrag_exit;
65
66 err = ip6_output_init();
67 if (err)
68 goto error_frag6_exit;
69
70 err = rpl_nf_conncount_modinit();
71 if (err)
72 goto error_nf_conncount_exit;
73
74 return 0;
75
76error_nf_conncount_exit:
77 rpl_nf_conncount_modexit();
78error_frag6_exit:
79 nf_ct_frag6_cleanup();
80error_ipfrag_exit:
81 rpl_ipfrag_fini();
82 return err;
83}
84static inline void compat_exit(void)
85{
86 rpl_nf_conncount_modexit();
87 ip6_output_exit();
88 nf_ct_frag6_cleanup();
89 rpl_ipfrag_fini();
90}
91
92#endif /* compat.h */