mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-15 09:20:52 +08:00
Merge branch 'gitee-master' into gitlab-upstream
This commit is contained in:
commit
9b9a4971ec
@ -384,7 +384,7 @@ ACL_IFCONF *acl_get_ifaddrs()
|
|||||||
IP_ADAPTER_INFO info_temp, *infos, *info;
|
IP_ADAPTER_INFO info_temp, *infos, *info;
|
||||||
ACL_IFCONF *ifconf;
|
ACL_IFCONF *ifconf;
|
||||||
ULONG len = 0;
|
ULONG len = 0;
|
||||||
int j;
|
int j, has_local = 0;
|
||||||
|
|
||||||
if (GetAdaptersInfo(&info_temp, &len) != ERROR_BUFFER_OVERFLOW) {
|
if (GetAdaptersInfo(&info_temp, &len) != ERROR_BUFFER_OVERFLOW) {
|
||||||
acl_msg_error("%s(%d): GetAdaptersInfo eror(%s)",
|
acl_msg_error("%s(%d): GetAdaptersInfo eror(%s)",
|
||||||
@ -400,7 +400,7 @@ ACL_IFCONF *acl_get_ifaddrs()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ifconf = ifconf_create((int) (len / sizeof(IP_ADAPTER_INFO) + 1));
|
ifconf = ifconf_create((int) (len / sizeof(IP_ADAPTER_INFO) + 2));
|
||||||
|
|
||||||
for (info = infos, j = 0; info != NULL; info = info->Next) {
|
for (info = infos, j = 0; info != NULL; info = info->Next) {
|
||||||
if (info->Type == MIB_IF_TYPE_LOOPBACK)
|
if (info->Type == MIB_IF_TYPE_LOOPBACK)
|
||||||
@ -414,6 +414,8 @@ ACL_IFCONF *acl_get_ifaddrs()
|
|||||||
SAFE_COPY(ifconf->addrs[j].desc, info->Description);
|
SAFE_COPY(ifconf->addrs[j].desc, info->Description);
|
||||||
SAFE_COPY(ifconf->addrs[j].addr,
|
SAFE_COPY(ifconf->addrs[j].addr,
|
||||||
info->IpAddressList.IpAddress.String);
|
info->IpAddressList.IpAddress.String);
|
||||||
|
if (!strcmp(ifconf->addrs[j].addr, "127.0.0.1"))
|
||||||
|
has_local = 1;
|
||||||
|
|
||||||
ifconf->addrs[j].saddr.in.sin_addr.s_addr
|
ifconf->addrs[j].saddr.in.sin_addr.s_addr
|
||||||
= inet_addr(ifconf->addrs[j].addr);
|
= inet_addr(ifconf->addrs[j].addr);
|
||||||
@ -425,6 +427,19 @@ ACL_IFCONF *acl_get_ifaddrs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!has_local) {
|
||||||
|
if (j == ifconf->length) {
|
||||||
|
ifconf->length *= 2;
|
||||||
|
ifconf->addrs = (ACL_IFADDR*) acl_myrealloc(
|
||||||
|
ifconf->addrs, ifconf->length * sizeof(ACL_IFADDR));
|
||||||
|
}
|
||||||
|
|
||||||
|
SAFE_COPY(ifconf->addrs[j].name, "localhost");
|
||||||
|
SAFE_COPY(ifconf->addrs[j].desc, "localhost");
|
||||||
|
SAFE_COPY(ifconf->addrs[j].addr, "127.0.0.1");
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
|
||||||
acl_myfree(infos);
|
acl_myfree(infos);
|
||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
@ -730,10 +745,11 @@ static char *get_addr(const char *addr, const char *path)
|
|||||||
|
|
||||||
ACL_ARGV *acl_search_addrs(const char *patterns, const char *unix_path)
|
ACL_ARGV *acl_search_addrs(const char *patterns, const char *unix_path)
|
||||||
{
|
{
|
||||||
ACL_IFCONF *ifconf = acl_ifconf_search(patterns);
|
ACL_IFCONF *ifconf;
|
||||||
ACL_ITER iter;
|
ACL_ITER iter;
|
||||||
ACL_ARGV *addrs;
|
ACL_ARGV *addrs;
|
||||||
|
|
||||||
|
ifconf = acl_ifconf_search(patterns);
|
||||||
if (ifconf == NULL) {
|
if (ifconf == NULL) {
|
||||||
acl_msg_error("%s(%d): acl_ifconf_search null",
|
acl_msg_error("%s(%d): acl_ifconf_search null",
|
||||||
__FUNCTION__, __LINE__);
|
__FUNCTION__, __LINE__);
|
||||||
|
@ -65,7 +65,7 @@ static void usage(const char* procname) {
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int ch;
|
int ch;
|
||||||
bool readable = false;
|
bool readable = false;
|
||||||
acl::string addr = "0.0.0.0:9000";
|
acl::string addr = "0.0.0.0|9000";
|
||||||
acl::string event_type("kernel");
|
acl::string event_type("kernel");
|
||||||
|
|
||||||
acl::acl_cpp_init();
|
acl::acl_cpp_init();
|
||||||
|
@ -90,7 +90,11 @@ int main(int argc, char *argv[])
|
|||||||
mf.set_cfg_bool(var_conf_bool_tab);
|
mf.set_cfg_bool(var_conf_bool_tab);
|
||||||
|
|
||||||
if (argc >= 2 && strcasecmp(argv[1], "alone") == 0) {
|
if (argc >= 2 && strcasecmp(argv[1], "alone") == 0) {
|
||||||
|
//const char* addr = "127.0.0.1|8088";
|
||||||
const char* addr = "0.0.0.0|8088";
|
const char* addr = "0.0.0.0|8088";
|
||||||
|
//const char* addr = "*.*.*.*|8088";
|
||||||
|
//const char* addr = "192.168.*.*|8088";
|
||||||
|
//const char* addr = "|8088";
|
||||||
|
|
||||||
printf("listen: %s\r\n", addr);
|
printf("listen: %s\r\n", addr);
|
||||||
acl::log::stdout_open(true);
|
acl::log::stdout_open(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user