summaryrefslogtreecommitdiff
path: root/access
diff options
context:
space:
mode:
author崔一鸣 <[email protected]>2018-12-09 22:25:34 +0800
committer崔一鸣 <[email protected]>2018-12-09 22:25:34 +0800
commit1e16fbaf51236ffcb6b0ed5e272c28c3ea8cb0e2 (patch)
tree1c724cc6daca9503d18d973b5da0730936ae0670 /access
parent218e00b13e68f327bf3a01a78989d47f2746f85a (diff)
添加systemd启动脚本
Diffstat (limited to 'access')
-rw-r--r--access/src/ip_mgr.cpp4
-rw-r--r--access/src/main.cpp12
-rw-r--r--access/src/nat.cpp2
-rw-r--r--access/src/vpn_monitor.cpp2
4 files changed, 13 insertions, 7 deletions
diff --git a/access/src/ip_mgr.cpp b/access/src/ip_mgr.cpp
index 82f78c3..0203803 100644
--- a/access/src/ip_mgr.cpp
+++ b/access/src/ip_mgr.cpp
@@ -142,9 +142,9 @@ static void Maat_user_policy_update_cb(int table_id, const char* table_line, voi
int do_log;
int action;
int service_id;
- printf("table line is %s\n", table_line);
+ //printf("table line is %s\n", table_line);
sscanf(table_line, "%d %d %s %s %s %d %d %d %d", &config_id, &group_id, user_type, user_name, translate_param, &do_log, &action, &service_id, &is_valid);
- printf("user name is %s\n", user_name);
+ //printf("user name is %s\n", user_name);
struct user_policy_htable_value *value = ALLOC(struct user_policy_htable_value, 1);
strncpy(value->user_name, user_name, MGW_SYMBOL_MAX);
value->group_id = group_id;
diff --git a/access/src/main.cpp b/access/src/main.cpp
index 9d2be8e..cfdd20a 100644
--- a/access/src/main.cpp
+++ b/access/src/main.cpp
@@ -250,11 +250,12 @@ static struct field_stat_handle * fs_init(const char *profile, void *logger)
}
-static struct mgw_handle * mgw_init()
+static struct mgw_handle * mgw_init(char *conf_path)
{
struct mgw_handle *_mgw_handle = ALLOC(struct mgw_handle, 1);
char *profile = ALLOC(char, MGW_SYMBOL_MAX);
- strncpy(profile, "./conf/mgw.conf", MGW_SYMBOL_MAX);
+ strncpy(profile, conf_path, MGW_SYMBOL_MAX);
+ printf("profile is %s\n", profile);
const char *section = "global";
//init srand
@@ -429,7 +430,12 @@ static void mgw_run(struct mgw_handle *handle)
int main(int argc, char* argv[])
{
- struct mgw_handle *handle = mgw_init();
+ char *conf_path = (char *)"./conf/mgw.conf";
+ if(argc > 1)
+ {
+ conf_path = argv[1];
+ }
+ struct mgw_handle *handle = mgw_init(conf_path);
mgw_run(handle);
mgw_destroy(handle);
}
diff --git a/access/src/nat.cpp b/access/src/nat.cpp
index 296c02f..1a175dc 100644
--- a/access/src/nat.cpp
+++ b/access/src/nat.cpp
@@ -333,10 +333,10 @@ static struct ip_port_pair * snat_value_get(struct nat_handle *handle, struct ip
cand_ip_detail = (struct ip_mgr_cand_ip_detail *)MESA_htable_search(handle->cand_ip_detail_htable, (const unsigned char *)(&cand_ip), sizeof(cand_ip));
FS_operate(fs_handle->handle, fs_handle->line_ip_detail, fs_handle->cloumn_queyr_num, FS_OP_ADD, 1);
char _ip[MGW_SYMBOL_MAX];
+ mgw_utils_inet_ntoa(cand_ip, _ip);
if(cand_ip_detail == NULL)
{
FS_operate(fs_handle->handle, fs_handle->line_ip_detail, fs_handle->cloumn_cache_miss, FS_OP_ADD, 1);
- mgw_utils_inet_ntoa(cand_ip, _ip);
MGW_LOG_ERROR(logger, "MESA_htable: table is %s, key %s not existed", "cand_ip_detail_htable", _ip);
continue;
}
diff --git a/access/src/vpn_monitor.cpp b/access/src/vpn_monitor.cpp
index 80e844f..2d43193 100644
--- a/access/src/vpn_monitor.cpp
+++ b/access/src/vpn_monitor.cpp
@@ -126,7 +126,7 @@ static void get_ip2user_by_vpncmd(struct vpn_monitor_handle *handle)
server_ip, server_port, server_passwd, hub_name, hub_passwd);
//get_iptables_cmd
- printf("get_iptables_cmd: %s\n", get_iptables_cmd);
+ //printf("get_iptables_cmd: %s\n", get_iptables_cmd);
FILE *get_iptables_fp = popen(get_iptables_cmd, "r");
if(get_iptables_fp == NULL)
{