mkdir -p %{buildroot}%{_unitdir}
cp inm-manager.service %{buildroot}%{_unitdir}/inm-manager.service
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
+ln -s ../inm-manager.service %{buildroot}%{_unitdir}/multi-user.target.wants/inm-manager.service
+
#log dump
mkdir -p %{buildroot}/opt/etc/dump.d/module.d
#udev rules for wlan module attach/detach event
%attr(644,root,root) %{_sysconfdir}/dbus-1/system.d/inm-manager.conf
%attr(644,root,root) %{_datadir}/dbus-1/system-services/net.inm_manager.service
%attr(644,root,root) %{_unitdir}/inm-manager.service
+%attr(644,root,root) %{_unitdir}/multi-user.target.wants/inm-manager.service
GatewayCheckInterval=1000
DnsCheckInterval=5000
OnlineCheckUrl=""
+
+[Monitoring]
+SupportIpConflictMonitoring=false
+SupportChannelInterferenceMonitoring=false
+SupportCongestionMonitoring=false
+SupportCommnanMonitoring=True
+SupportWpsMonitoring=True
+SupportDnsMonitoring=True
+SupportGatewayMonitoring=True
+SupportRtnlMonitoring=True
+SupportArpMonitoring=True
+SupportIfaceMonitoring=True
\ No newline at end of file
static inline void __init_ip_conflict_detect()
{
__INM_FUNC_ENTER__;
+
+ if (!check_monitoring_flag("SupportIpConflictMonitoring")) {
+ INM_LOGI("ip conflict monitoring not supported");
+ return;
+ }
+
if (ip_conflict_detection_init() != 0) {
INM_LOGW("ip conflict detection init failed");
__INM_FUNC_EXIT__;
ip_conflict_set_callback(IF_NAME_ETH, __ip_conflict_cb, NULL);
ip_conflict_set_callback(IF_NAME_WLAN, __ip_conflict_cb, NULL);
+
+
__INM_FUNC_EXIT__;
}
static inline void __init_arping()
{
__INM_FUNC_ENTER__;
+ if (!check_monitoring_flag("SupportArpMonitoring")) {
+ INM_LOGI("Airping monitoring not supported");
+ return;
+ }
+
if (inm_arping_init() != 0) {
INM_LOGW("arping init failed");
__INM_FUNC_EXIT__;
static inline void __init_dns_lookup()
{
__INM_FUNC_ENTER__;
+ if (!check_monitoring_flag("SupportDnsMonitoring")) {
+ INM_LOGI("Dns monitoring not supported");
+ return;
+ }
+
if (inm_dns_lookup_init() != 0) {
INM_LOGW("dns lookup init failed");
__INM_FUNC_EXIT__;
static inline void __init_iface_monitor()
{
__INM_FUNC_ENTER__;
+ if (!check_monitoring_flag("SupportIfaceMonitoring")) {
+ INM_LOGI("Interface monitoring not supported");
+ return;
+ }
+
if (inm_iface_mon_init() != 0) {
INM_LOGW("inm_iface_mon_init failed");
__INM_FUNC_EXIT__;
static inline void __init_channel_interference_monitor()
{
+ __INM_FUNC_ENTER__;
+
int ret = 0;
+ if (!check_monitoring_flag("SupportChannelInterferenceMonitoring")) {
+ INM_LOGI("Channel interference monitoring not supported");
+ return;
+ }
- __INM_FUNC_ENTER__;
ret = inm_channel_interference_monitor_start(__channel_interference_cb, NULL);
if (ret != INM_MANAGER_ERROR_NONE)
INM_LOGW("inm_channel_interference_monitor_start failed");
static inline void __init_congestion_mon()
{
+ __INM_FUNC_ENTER__;
+
int ret = 0;
+ if (!check_monitoring_flag("SupportCongestionMonitoring")) {
+ INM_LOGI("Congestion monitoring not supported");
+ return;
+ }
- __INM_FUNC_ENTER__;
ret = inm_congestion_mon_init();
if (ret != INM_MANAGER_ERROR_NONE) {
INM_LOGW("inm_congestion_mon_init failed");
int ret = 0;
__INM_FUNC_ENTER__;
+ if (!check_monitoring_flag("SupportRtnlMonitoring")) {
+ INM_LOGI("Rtnl not supported");
+ return;
+ }
ret = inm_rtnl_mon_init();
if (ret != INM_RTNL_ERROR_NONE) {
int ret = 0;
__INM_FUNC_ENTER__;
+ if (!check_monitoring_flag("SupportCommnanMonitoring")) {
+ INM_LOGI("Connman monitoring not supported");
+ return;
+ }
+
ret = inm_connman_init();
if (ret != 0) {
INM_LOGW("Init connman failed");
- __INM_FUNC_EXIT__;
+ __INM_FUNC_EXIT__;
return;
}
int ret = 0;
__INM_FUNC_ENTER__;
+ if (!check_monitoring_flag("SupportWpsMonitoring")) {
+ INM_LOGI("Wps supplicant monitoring not supported");
+ return;
+ }
+
ret = inm_supplicant_init();
if (ret != 0) {
INM_LOGW("Init supplicant failed");
return keyfile;
}
+
+gboolean check_monitoring_flag(const char *key)
+{
+ GKeyFile *keyfile = NULL;
+ gboolean is_supporting = TRUE;
+ keyfile = load_keyfile(INM_MANAGER_CONF);
+
+ if (keyfile != NULL) {
+ GError *error = NULL;
+ is_supporting = g_key_file_get_boolean(keyfile, "Monitoring", key, &error);
+ if (!error && is_supporting == FALSE) {
+ g_key_file_free(keyfile);
+ return FALSE;
+ }
+ g_clear_error(&error);
+ g_key_file_free(keyfile);
+ }
+ return TRUE;
+}