Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 1 | /* |
| 2 | ************************************************************************** |
Murat Sezgin | df98fce | 2016-08-26 17:56:39 -0700 | [diff] [blame] | 3 | * Copyright (c) 2014-2016, 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 | df98fce | 2016-08-26 17:56:39 -0700 | [diff] [blame] | 47 | #include "ecm_conntrack_notifier.h" |
Murat Sezgin | 8d916a1 | 2015-03-18 15:56:50 -0700 | [diff] [blame] | 48 | |
Xiaoping Fan | 86e55cb | 2016-08-24 17:27:32 -0700 | [diff] [blame] | 49 | int front_end_selection; |
| 50 | module_param(front_end_selection, int, 0); |
| 51 | MODULE_PARM_DESC(front_end_selection, "Select front end for ECM"); |
| 52 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 53 | struct dentry *ecm_dentry; /* Dentry object for top level ecm debugfs directory */ |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 54 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 55 | extern int ecm_db_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 56 | extern void ecm_db_connection_defunct_all(void); |
| 57 | extern void ecm_db_exit(void); |
| 58 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 59 | extern int ecm_classifier_default_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 60 | extern void ecm_classifier_default_exit(void); |
| 61 | |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 62 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 63 | extern int ecm_classifier_nl_rules_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 64 | extern void ecm_classifier_nl_rules_exit(void); |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 65 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 66 | |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 67 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 68 | extern int ecm_classifier_hyfi_rules_init(struct dentry *dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 69 | extern void ecm_classifier_hyfi_rules_exit(void); |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 70 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 71 | |
| 72 | extern int ecm_interface_init(void); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 73 | extern void ecm_interface_exit(void); |
| 74 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 75 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 76 | extern int ecm_classifier_dscp_init(struct dentry *dentry); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 77 | extern void ecm_classifier_dscp_exit(void); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 78 | #endif |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 79 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 80 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 81 | extern int ecm_state_init(struct dentry *dentry); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 82 | extern void ecm_state_exit(void); |
| 83 | #endif |
| 84 | |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 85 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 86 | extern int ecm_classifier_pcc_init(struct dentry *dentry); |
| 87 | extern void ecm_classifier_pcc_exit(void); |
| 88 | #endif |
| 89 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 90 | /* |
| 91 | * ecm_init() |
| 92 | */ |
| 93 | static int __init ecm_init(void) |
| 94 | { |
| 95 | int ret; |
Murat Sezgin | f2b9453 | 2014-12-05 14:53:53 -0800 | [diff] [blame] | 96 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 97 | printk(KERN_INFO "ECM init\n"); |
| 98 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 99 | ecm_dentry = debugfs_create_dir("ecm", NULL); |
| 100 | if (!ecm_dentry) { |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 101 | DEBUG_ERROR("Failed to create ecm directory in debugfs\n"); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 102 | return -1; |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 103 | } |
| 104 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 105 | ret = ecm_db_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 106 | if (0 != ret) { |
| 107 | goto err_db; |
| 108 | } |
| 109 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 110 | ret = ecm_classifier_default_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 111 | if (0 != ret) { |
| 112 | goto err_cls_default; |
| 113 | } |
| 114 | |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 115 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 116 | ret = ecm_classifier_nl_rules_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 117 | if (0 != ret) { |
| 118 | goto err_cls_nl; |
| 119 | } |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 120 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 121 | |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 122 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 123 | ret = ecm_classifier_hyfi_rules_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 124 | if (0 != ret) { |
| 125 | goto err_cls_hyfi; |
| 126 | } |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 127 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 128 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 129 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 130 | ret = ecm_classifier_dscp_init(ecm_dentry); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 131 | if (0 != ret) { |
| 132 | goto err_cls_dscp; |
| 133 | } |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 134 | #endif |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 135 | |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 136 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 137 | ret = ecm_classifier_pcc_init(ecm_dentry); |
| 138 | if (0 != ret) { |
| 139 | goto err_cls_pcc; |
| 140 | } |
| 141 | #endif |
| 142 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 143 | ret = ecm_interface_init(); |
| 144 | if (0 != ret) { |
| 145 | goto err_iface; |
| 146 | } |
| 147 | |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 148 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 149 | ret = ecm_front_end_bond_notifier_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 150 | if (0 != ret) { |
| 151 | goto err_bond; |
| 152 | } |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 153 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 154 | |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 155 | ret = ecm_front_end_ipv4_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 156 | if (0 != ret) { |
| 157 | goto err_fe_ipv4; |
| 158 | } |
| 159 | |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 160 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 161 | ret = ecm_front_end_ipv6_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 162 | if (0 != ret) { |
| 163 | goto err_fe_ipv6; |
| 164 | } |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 165 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 166 | |
Murat Sezgin | df98fce | 2016-08-26 17:56:39 -0700 | [diff] [blame] | 167 | ret = ecm_conntrack_notifier_init(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 168 | if (0 != ret) { |
| 169 | goto err_ct; |
| 170 | } |
| 171 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 172 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 173 | ret = ecm_state_init(ecm_dentry); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 174 | if (0 != ret) { |
| 175 | goto err_state; |
| 176 | } |
| 177 | #endif |
| 178 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 179 | printk(KERN_INFO "ECM init complete\n"); |
| 180 | return 0; |
| 181 | |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 182 | #ifdef ECM_STATE_OUTPUT_ENABLE |
| 183 | err_state: |
Murat Sezgin | df98fce | 2016-08-26 17:56:39 -0700 | [diff] [blame] | 184 | ecm_conntrack_notifier_exit(); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 185 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 186 | err_ct: |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 187 | #ifdef ECM_IPV6_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 188 | ecm_front_end_ipv6_exit(); |
| 189 | err_fe_ipv6: |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 190 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 191 | ecm_front_end_ipv4_exit(); |
| 192 | err_fe_ipv4: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 193 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 194 | ecm_front_end_bond_notifier_exit(); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 195 | err_bond: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 196 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 197 | ecm_interface_exit(); |
| 198 | err_iface: |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 199 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
| 200 | ecm_classifier_pcc_exit(); |
| 201 | err_cls_pcc: |
| 202 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 203 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 204 | ecm_classifier_dscp_exit(); |
| 205 | err_cls_dscp: |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 206 | #endif |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 207 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 208 | ecm_classifier_hyfi_rules_exit(); |
| 209 | err_cls_hyfi: |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 210 | #endif |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 211 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 212 | ecm_classifier_nl_rules_exit(); |
| 213 | err_cls_nl: |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 214 | #endif |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 215 | ecm_classifier_default_exit(); |
| 216 | err_cls_default: |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 217 | ecm_db_exit(); |
| 218 | err_db: |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 219 | debugfs_remove_recursive(ecm_dentry); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 220 | |
| 221 | printk(KERN_INFO "ECM init failed: %d\n", ret); |
| 222 | return ret; |
| 223 | } |
| 224 | |
| 225 | /* |
| 226 | * ecm_exit() |
| 227 | */ |
| 228 | static void __exit ecm_exit(void) |
| 229 | { |
| 230 | printk(KERN_INFO "ECM exit\n"); |
| 231 | |
| 232 | /* call stop on anything that requires a prepare-to-exit signal */ |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 233 | DEBUG_INFO("stop conntrack notifier\n"); |
Murat Sezgin | df98fce | 2016-08-26 17:56:39 -0700 | [diff] [blame] | 234 | ecm_conntrack_notifier_stop(1); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 235 | DEBUG_INFO("stop front_end_ipv4\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 236 | ecm_front_end_ipv4_stop(1); |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 237 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 238 | DEBUG_INFO("stop front_end_ipv6\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 239 | ecm_front_end_ipv6_stop(1); |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 240 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 241 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 242 | DEBUG_INFO("stop bond notifier\n"); |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 243 | ecm_front_end_bond_notifier_stop(1); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 244 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 245 | DEBUG_INFO("defunct all db connections\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 246 | ecm_db_connection_defunct_all(); |
| 247 | |
| 248 | /* now call exit on each module */ |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 249 | #ifdef ECM_STATE_OUTPUT_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 250 | DEBUG_INFO("stop state\n"); |
Gareth Williams | f98d419 | 2015-03-11 16:55:41 +0000 | [diff] [blame] | 251 | ecm_state_exit(); |
| 252 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 253 | DEBUG_INFO("exit conntrack notifier\n"); |
Murat Sezgin | df98fce | 2016-08-26 17:56:39 -0700 | [diff] [blame] | 254 | ecm_conntrack_notifier_exit(); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 255 | DEBUG_INFO("exit front_end_ipv4\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 256 | ecm_front_end_ipv4_exit(); |
Gareth Williams | 8ac3429 | 2015-03-17 14:06:58 +0000 | [diff] [blame] | 257 | #ifdef ECM_IPV6_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 258 | DEBUG_INFO("exit front_end_ipv6\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 259 | ecm_front_end_ipv6_exit(); |
Murat Sezgin | 49465a4 | 2014-11-24 15:37:48 -0800 | [diff] [blame] | 260 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 261 | #ifdef ECM_INTERFACE_BOND_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 262 | DEBUG_INFO("exit bond notifier\n"); |
Murat Sezgin | 8e10a7c | 2015-06-11 15:49:24 -0700 | [diff] [blame] | 263 | ecm_front_end_bond_notifier_exit(); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 264 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 265 | DEBUG_INFO("exit interface\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 266 | ecm_interface_exit(); |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 267 | |
| 268 | #ifdef ECM_CLASSIFIER_PCC_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 269 | DEBUG_INFO("exit pcc classifier\n"); |
Gareth Williams | dcda9b9 | 2015-05-13 10:08:15 +0100 | [diff] [blame] | 270 | ecm_classifier_pcc_exit(); |
| 271 | #endif |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 272 | #ifdef ECM_CLASSIFIER_DSCP_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 273 | DEBUG_INFO("exit dscp classifier\n"); |
Gareth Williams | 4a02c9b | 2014-10-10 14:50:33 +0100 | [diff] [blame] | 274 | ecm_classifier_dscp_exit(); |
Murat Sezgin | b3731e8 | 2014-11-26 12:20:59 -0800 | [diff] [blame] | 275 | #endif |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 276 | #ifdef ECM_CLASSIFIER_HYFI_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 277 | DEBUG_INFO("exit hyfi classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 278 | ecm_classifier_hyfi_rules_exit(); |
Hai Shalom | 81f4e20 | 2014-06-04 09:30:27 -0700 | [diff] [blame] | 279 | #endif |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 280 | #ifdef ECM_CLASSIFIER_NL_ENABLE |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 281 | DEBUG_INFO("exit nl classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 282 | ecm_classifier_nl_rules_exit(); |
Murat Sezgin | aaaafb4 | 2014-11-24 17:02:05 -0800 | [diff] [blame] | 283 | #endif |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 284 | DEBUG_INFO("exit default classifier\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 285 | ecm_classifier_default_exit(); |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 286 | DEBUG_INFO("exit db\n"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 287 | ecm_db_exit(); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 288 | |
| 289 | if (ecm_dentry != NULL) { |
Murat Sezgin | 3ab259d | 2015-06-11 14:15:35 -0700 | [diff] [blame] | 290 | DEBUG_INFO("remove ecm debugfs\n"); |
Murat Sezgin | 908ecb3 | 2015-05-10 20:54:36 -0700 | [diff] [blame] | 291 | debugfs_remove_recursive(ecm_dentry); |
| 292 | } |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 293 | |
| 294 | printk(KERN_INFO "ECM exit complete\n"); |
| 295 | } |
| 296 | |
| 297 | module_init(ecm_init) |
| 298 | module_exit(ecm_exit) |
| 299 | |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 300 | MODULE_DESCRIPTION("ECM Core"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 301 | MODULE_LICENSE("Dual BSD/GPL"); |
Nicolas Costa | f46c33b | 2014-05-15 10:02:00 -0500 | [diff] [blame] | 302 | |