Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 1 | /* |
| 2 | ************************************************************************** |
Gareth Williams | d5618a8 | 2015-05-20 11:13:32 +0100 | [diff] [blame] | 3 | * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all copies. |
| 7 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 8 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 9 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 10 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 11 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 12 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
| 13 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 14 | ************************************************************************** |
| 15 | */ |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 16 | #include <linux/version.h> |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 17 | #include <linux/module.h> |
Murat Sezgin | f2b9453 | 2014-12-05 14:53:53 -0800 | [diff] [blame] | 18 | #include <linux/of.h> |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 19 | #include <linux/debugfs.h> |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 20 | #include <linux/inet.h> |
| 21 | #include <linux/etherdevice.h> |
| 22 | #include <net/netfilter/nf_conntrack.h> |
| 23 | #include <net/ip.h> |
| 24 | #include <net/ipv6.h> |
| 25 | /* |
| 26 | * Debug output levels |
| 27 | * 0 = OFF |
| 28 | * 1 = ASSERTS / ERRORS |
| 29 | * 2 = 1 + WARN |
| 30 | * 3 = 2 + INFO |
| 31 | * 4 = 3 + TRACE |
| 32 | */ |
| 33 | #define DEBUG_LEVEL ECM_INIT_DEBUG_LEVEL |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 34 | |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 35 | #include "ecm_types.h" |
| 36 | #include "ecm_db_types.h" |
| 37 | #include "ecm_state.h" |
| 38 | #include "ecm_tracker.h" |
| 39 | #include "ecm_classifier.h" |
| 40 | #include "ecm_front_end_types.h" |
Tushar Mathur | d38cacd | 2015-07-28 12:19:10 +0530 | [diff] [blame] | 41 | #include "ecm_db.h" |
Murat Sezgin | 8d916a1 | 2015-03-18 15:56:50 -0700 | [diff] [blame] | 42 | #include "ecm_front_end_ipv4.h" |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 43 | #ifdef ECM_IPV6_ENABLE |
| 44 | #include "ecm_front_end_ipv6.h" |
| 45 | #endif |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 46 | #include "ecm_front_end_common.h" |
Murat Sezgin | 8d916a1 | 2015-03-18 15:56:50 -0700 | [diff] [blame] | 47 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 48 | struct dentry *ecm_dentry; /* Dentry object for top level ecm debugfs directory */ |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 49 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 50 | extern int ecm_db_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 51 | extern void ecm_db_connection_defunct_all(void); |
| 52 | extern void ecm_db_exit(void); |
| 53 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 54 | extern int ecm_classifier_default_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 55 | extern void ecm_classifier_default_exit(void); |
| 56 | |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 57 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 58 | extern int ecm_classifier_nl_rules_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 59 | extern void ecm_classifier_nl_rules_exit(void); |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 60 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 61 | |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 62 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 63 | extern int ecm_classifier_hyfi_rules_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 64 | extern void ecm_classifier_hyfi_rules_exit(void); |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 65 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 66 | |
| 67 | extern int ecm_interface_init(void); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 68 | extern void ecm_interface_exit(void); |
| 69 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 70 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 71 | extern int ecm_classifier_dscp_init(struct dentry *dentry); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 72 | extern void ecm_classifier_dscp_exit(void); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 73 | #endif |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 74 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 75 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 76 | extern int ecm_state_init(struct dentry *dentry); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 77 | extern void ecm_state_exit(void); |
| 78 | #endif |
| 79 | |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 80 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 81 | extern int ecm_classifier_pcc_init(struct dentry *dentry); |
| 82 | extern void ecm_classifier_pcc_exit(void); |
| 83 | #endif |
| 84 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 85 | /* |
| 86 | * ecm_init() |
| 87 | */ |
| 88 | static int __init ecm_init(void) |
| 89 | { |
| 90 | int ret; |
Murat Sezgin | f2b9453 | 2014-12-05 14:53:53 -0800 | [diff] [blame] | 91 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 92 | printk(KERN_INFO "ECM init\n"); |
| 93 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 94 | ecm_dentry = debugfs_create_dir("ecm", NULL); |
| 95 | if (!ecm_dentry) { |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 96 | DEBUG_ERROR("Failed to create ecm directory in debugfs\n"); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 97 | return -1; |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 98 | } |
| 99 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 100 | ret = ecm_db_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 101 | if (0 != ret) { |
| 102 | goto err_db; |
| 103 | } |
| 104 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 105 | ret = ecm_classifier_default_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 106 | if (0 != ret) { |
| 107 | goto err_cls_default; |
| 108 | } |
| 109 | |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 110 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 111 | ret = ecm_classifier_nl_rules_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 112 | if (0 != ret) { |
| 113 | goto err_cls_nl; |
| 114 | } |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 115 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 116 | |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 117 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 118 | ret = ecm_classifier_hyfi_rules_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 119 | if (0 != ret) { |
| 120 | goto err_cls_hyfi; |
| 121 | } |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 122 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 123 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 124 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 125 | ret = ecm_classifier_dscp_init(ecm_dentry); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 126 | if (0 != ret) { |
| 127 | goto err_cls_dscp; |
| 128 | } |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 129 | #endif |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 130 | |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 131 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 132 | ret = ecm_classifier_pcc_init(ecm_dentry); |
| 133 | if (0 != ret) { |
| 134 | goto err_cls_pcc; |
| 135 | } |
| 136 | #endif |
| 137 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 138 | ret = ecm_interface_init(); |
| 139 | if (0 != ret) { |
| 140 | goto err_iface; |
| 141 | } |
| 142 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 143 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 144 | ret = ecm_front_end_bond_notifier_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 145 | if (0 != ret) { |
| 146 | goto err_bond; |
| 147 | } |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 148 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 149 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 150 | ret = ecm_front_end_ipv4_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 151 | if (0 != ret) { |
| 152 | goto err_fe_ipv4; |
| 153 | } |
| 154 | |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 155 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 156 | ret = ecm_front_end_ipv6_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 157 | if (0 != ret) { |
| 158 | goto err_fe_ipv6; |
| 159 | } |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 160 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 161 | |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 162 | ret = ecm_front_end_conntrack_notifier_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 163 | if (0 != ret) { |
| 164 | goto err_ct; |
| 165 | } |
| 166 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 167 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 168 | ret = ecm_state_init(ecm_dentry); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 169 | if (0 != ret) { |
| 170 | goto err_state; |
| 171 | } |
| 172 | #endif |
| 173 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 174 | printk(KERN_INFO "ECM init complete\n"); |
| 175 | return 0; |
| 176 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 177 | #ifdef ECM_STATE_OUTPUT_ENABLE |
| 178 | err_state: |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 179 | ecm_front_end_conntrack_notifier_exit(); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 180 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 181 | err_ct: |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 182 | #ifdef ECM_IPV6_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 183 | ecm_front_end_ipv6_exit(); |
| 184 | err_fe_ipv6: |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 185 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 186 | ecm_front_end_ipv4_exit(); |
| 187 | err_fe_ipv4: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 188 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 189 | ecm_front_end_bond_notifier_exit(); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 190 | err_bond: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 191 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 192 | ecm_interface_exit(); |
| 193 | err_iface: |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 194 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 195 | ecm_classifier_pcc_exit(); |
| 196 | err_cls_pcc: |
| 197 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 198 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 199 | ecm_classifier_dscp_exit(); |
| 200 | err_cls_dscp: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 201 | #endif |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 202 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 203 | ecm_classifier_hyfi_rules_exit(); |
| 204 | err_cls_hyfi: |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 205 | #endif |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 206 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 207 | ecm_classifier_nl_rules_exit(); |
| 208 | err_cls_nl: |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 209 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 210 | ecm_classifier_default_exit(); |
| 211 | err_cls_default: |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 212 | ecm_db_exit(); |
| 213 | err_db: |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 214 | debugfs_remove_recursive(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 215 | |
| 216 | printk(KERN_INFO "ECM init failed: %d\n", ret); |
| 217 | return ret; |
| 218 | } |
| 219 | |
| 220 | /* |
| 221 | * ecm_exit() |
| 222 | */ |
| 223 | static void __exit ecm_exit(void) |
| 224 | { |
| 225 | printk(KERN_INFO "ECM exit\n"); |
| 226 | |
| 227 | /* call stop on anything that requires a prepare-to-exit signal */ |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 228 | DEBUG_INFO("stop conntrack notifier\n"); |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 229 | ecm_front_end_conntrack_notifier_stop(1); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 230 | DEBUG_INFO("stop front_end_ipv4\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 231 | ecm_front_end_ipv4_stop(1); |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 232 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 233 | DEBUG_INFO("stop front_end_ipv6\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 234 | ecm_front_end_ipv6_stop(1); |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 235 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 236 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 237 | DEBUG_INFO("stop bond notifier\n"); |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 238 | ecm_front_end_bond_notifier_stop(1); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 239 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 240 | DEBUG_INFO("defunct all db connections\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 241 | ecm_db_connection_defunct_all(); |
| 242 | |
| 243 | /* now call exit on each module */ |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 244 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 245 | DEBUG_INFO("stop state\n"); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 246 | ecm_state_exit(); |
| 247 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 248 | DEBUG_INFO("exit conntrack notifier\n"); |
Murat Sezgin | 5f13849 | 2015-06-11 15:18:27 -0700 | [diff] [blame] | 249 | ecm_front_end_conntrack_notifier_exit(); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 250 | DEBUG_INFO("exit front_end_ipv4\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 251 | ecm_front_end_ipv4_exit(); |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 252 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 253 | DEBUG_INFO("exit front_end_ipv6\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 254 | ecm_front_end_ipv6_exit(); |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 255 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 256 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 257 | DEBUG_INFO("exit bond notifier\n"); |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 258 | ecm_front_end_bond_notifier_exit(); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 259 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 260 | DEBUG_INFO("exit interface\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 261 | ecm_interface_exit(); |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 262 | |
| 263 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 264 | DEBUG_INFO("exit pcc classifier\n"); |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 265 | ecm_classifier_pcc_exit(); |
| 266 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 267 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 268 | DEBUG_INFO("exit dscp classifier\n"); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 269 | ecm_classifier_dscp_exit(); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 270 | #endif |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 271 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 272 | DEBUG_INFO("exit hyfi classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 273 | ecm_classifier_hyfi_rules_exit(); |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 274 | #endif |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 275 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 276 | DEBUG_INFO("exit nl classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 277 | ecm_classifier_nl_rules_exit(); |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 278 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 279 | DEBUG_INFO("exit default classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 280 | ecm_classifier_default_exit(); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 281 | DEBUG_INFO("exit db\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 282 | ecm_db_exit(); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 283 | |
| 284 | if (ecm_dentry != NULL) { |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 285 | DEBUG_INFO("remove ecm debugfs\n"); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 286 | debugfs_remove_recursive(ecm_dentry); |
| 287 | } |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 288 | |
| 289 | printk(KERN_INFO "ECM exit complete\n"); |
| 290 | } |
| 291 | |
| 292 | module_init(ecm_init) |
| 293 | module_exit(ecm_exit) |
| 294 | |
| 295 | MODULE_AUTHOR("Qualcomm Atheros, Inc."); |
| 296 | MODULE_DESCRIPTION("ECM Core"); |
| 297 | #ifdef MODULE_LICENSE |
| 298 | MODULE_LICENSE("Dual BSD/GPL"); |
| 299 | #endif |
| 300 | |