Merge branch 'master' of http://git.syqiq.tech/jeka/utun2
This commit is contained in:
commit
8a59b51b49
2 files changed
+12
-7
No files matched your search
+11
-7
@@ -293,15 +293,19 @@ static int parse_global(const char *key, const char *value, struct global_config
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (strcmp(key, "control_ip") == 0) {
|
if (strcmp(key, "control_ip") == 0) {
|
||||||
// Store for later processing with control_port
|
// Store control_ip for later processing with control_port
|
||||||
return 0; // We'll handle this when we see control_port
|
strncpy(global->control_ip, value, sizeof(global->control_ip) - 1);
|
||||||
|
global->control_ip[sizeof(global->control_ip) - 1] = '\0';
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
if (strcmp(key, "control_port") == 0) {
|
if (strcmp(key, "control_port") == 0) {
|
||||||
// This is tricky - we need to get control_ip from previous parsing
|
// Use control_ip from config, fallback to localhost if not set
|
||||||
// For now, we'll use a simple approach
|
char control_ip[MAX_ADDR_LEN];
|
||||||
struct global_config temp_global = *global;
|
if (global->control_ip[0] != '\0') {
|
||||||
// Assume we stored control_ip somewhere or use default
|
strncpy(control_ip, global->control_ip, sizeof(control_ip) - 1);
|
||||||
char control_ip[MAX_ADDR_LEN] = "127.0.0.1"; // Default
|
} else {
|
||||||
|
strcpy(control_ip, "127.0.0.1");
|
||||||
|
}
|
||||||
char port_str[16];
|
char port_str[16];
|
||||||
snprintf(port_str, sizeof(port_str), "%s", value);
|
snprintf(port_str, sizeof(port_str), "%s", value);
|
||||||
parse_sockaddr(control_ip, port_str, &global->control_sock);
|
parse_sockaddr(control_ip, port_str, &global->control_sock);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ struct global_config {
|
|||||||
struct IP tun_ip;
|
struct IP tun_ip;
|
||||||
int mtu;
|
int mtu;
|
||||||
struct sockaddr_storage control_sock;
|
struct sockaddr_storage control_sock;
|
||||||
|
char control_ip[MAX_ADDR_LEN]; // Control server IP address
|
||||||
int net_debug;
|
int net_debug;
|
||||||
|
|
||||||
// Debug and logging configuration
|
// Debug and logging configuration
|
||||||
|
|||||||
Reference in new issue
Block a user