]> git.proxmox.com Git - mirror_ovs.git/blame - datapath/compat.h
ovs-ofctl: Fix memory leak in ofctl_packet_out().
[mirror_ovs.git] / datapath / compat.h
CommitLineData
9cb8d24d 1/*
e23775f2 2 * Copyright (c) 2007-2015 Nicira, Inc.
9cb8d24d 3 *
a9a29d22
JG
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
9cb8d24d
JG
17 */
18
19#ifndef COMPAT_H
20#define COMPAT_H 1
21
6c5d24af
PS
22#include <linux/in.h>
23#include <linux/in_route.h>
9cb8d24d 24#include <linux/netlink.h>
595e069a 25#include <net/ip.h>
6c5d24af
PS
26#include <net/route.h>
27#include <net/xfrm.h>
73b09aff 28#include <net/netfilter/ipv6/nf_defrag_ipv6.h>
6c5d24af 29
8063e095
PS
30/* Even though vanilla 3.10 kernel has grp->id, RHEL 7 kernel is missing
31 * this field. */
13dd4a97 32#ifdef HAVE_GENL_MULTICAST_GROUP_WITH_ID
cb25142c 33#define GROUP_ID(grp) ((grp)->id)
13dd4a97
JS
34#else
35#define GROUP_ID(grp) 0
14002a59
PS
36#endif
37
e4e04c3b
JS
38#ifdef HAVE_NF_IPV6_OPS_FRAGMENT
39static inline int __init ip6_output_init(void) { return 0; }
40static inline void ip6_output_exit(void) { }
41#else
73b09aff
JS
42int __init ip6_output_init(void);
43void ip6_output_exit(void);
e4e04c3b 44#endif
73b09aff 45
595e069a
JS
46static inline int __init compat_init(void)
47{
73b09aff
JS
48 int err;
49
50 err = ipfrag_init();
51 if (err)
52 return err;
53
54 err = nf_ct_frag6_init();
55 if (err)
56 goto error_ipfrag_exit;
57
58 err = ip6_output_init();
59 if (err)
60 goto error_frag6_exit;
61
62 return 0;
63
64error_frag6_exit:
65 nf_ct_frag6_cleanup();
66error_ipfrag_exit:
67 rpl_ipfrag_fini();
68 return err;
595e069a
JS
69}
70static inline void compat_exit(void)
71{
73b09aff
JS
72 ip6_output_exit();
73 nf_ct_frag6_cleanup();
595e069a
JS
74 rpl_ipfrag_fini();
75}
595e069a 76
9cb8d24d 77#endif /* compat.h */