From d4564b62496d84efc1d35ddae51bea03bc3b2339 Mon Sep 17 00:00:00 2001 From: wangyu- Date: Wed, 25 Jul 2018 05:10:16 -0500 Subject: [PATCH] fixed ipv6 in -r --- common.cpp | 6 +++--- common.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common.cpp b/common.cpp index 46a4d08..93ad6c7 100644 --- a/common.cpp +++ b/common.cpp @@ -881,7 +881,7 @@ int create_fifo(char * file) #endif } - +/* int new_listen_socket(int &fd,u32_t ip,int port) { fd =socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -939,7 +939,7 @@ int new_connected_socket(int &fd,u32_t ip,int port) } return 0; } - +*/ int new_listen_socket2(int &fd,address_t &addr) { fd =socket(addr.get_type(), SOCK_DGRAM, IPPROTO_UDP); @@ -960,7 +960,7 @@ int new_listen_socket2(int &fd,address_t &addr) } int new_connected_socket2(int &fd,address_t &addr) { - fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + fd = socket(addr.get_type(), SOCK_DGRAM, IPPROTO_UDP); if (fd < 0) { mylog(log_warn, "[%s]create udp_fd error\n", addr.get_str()); return -1; diff --git a/common.h b/common.h index 3d03384..1708ece 100644 --- a/common.h +++ b/common.h @@ -233,6 +233,7 @@ struct address_t //TODO scope id { memset(&inner,0,sizeof(inner)); } + /* int from_ip_port(u32_t ip, int port) { clear(); @@ -240,7 +241,7 @@ struct address_t //TODO scope id inner.ipv4.sin_port=htons(port); inner.ipv4.sin_addr.s_addr=ip; return 0; - } + }*/ int from_ip_port_new(int type, void * ip, int port) { @@ -253,7 +254,7 @@ struct address_t //TODO scope id } else if(type==AF_INET6) { - inner.ipv6.sin6_family=AF_INET; + inner.ipv6.sin6_family=AF_INET6; inner.ipv6.sin6_port=htons(port); inner.ipv6.sin6_addr=*((in6_addr*)ip); }