G2 IPV6 now uses port 9011

pull/14/head
Tom Early 7 years ago
parent 5ae57a9faa
commit 6acf502b64

@ -282,6 +282,8 @@ bool CQnetGateway::ReadConfig(char *cfgFile)
path.assign("gateway_");
cfg.GetValue(path+"ip", estr, g2_external.ip, 7, 64);
cfg.GetValue(path+"port", estr, g2_external.port, 1024, 65535);
cfg.GetValue(path+"ipv6_ip", estr, g2_ipv6_external.ip, 7, 64);
cfg.GetValue(path+"ipv6_port", estr, g2_ipv6_external.port, 1024, 65535);
cfg.GetValue(path+"header_regen", estr, GATEWAY_HEADER_REGEN);
cfg.GetValue(path+"send_qrgs_maps", estr, GATEWAY_SEND_QRGS_MAP);
cfg.GetValue(path+"gate2link", estr, gate2link, 1, FILENAME_MAX);
@ -341,25 +343,25 @@ bool CQnetGateway::ReadConfig(char *cfgFile)
}
// Create ports
int CQnetGateway::open_port(const SPORTIP &pip, int family)
int CQnetGateway::open_port(const SPORTIP *pip, int family)
{
CSockAddress sin(family, pip.port, pip.ip.c_str());
CSockAddress sin(family, pip->port, pip->ip.c_str());
int sock = socket(family, SOCK_DGRAM, 0);
if (0 > sock) {
printf("Failed to create socket on %s:%d, errno=%d, %s\n", pip.ip.c_str(), pip.port, errno, strerror(errno));
printf("Failed to create socket on %s:%d, errno=%d, %s\n", pip->ip.c_str(), pip->port, errno, strerror(errno));
return -1;
}
fcntl(sock, F_SETFL, O_NONBLOCK);
int reuse = 1;
if (::setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) == -1) {
printf("Cannot set the UDP socket (port %u) option, err: %d, %s\n", pip.port, errno, strerror(errno));
return -1;
}
//int reuse = 1;
//if (::setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&reuse, sizeof(reuse)) == -1) {
// printf("Cannot set the UDP socket (port %u) option, err: %d, %s\n", pip->port, errno, strerror(errno));
// return -1;
//}
if (bind(sock, sin.GetPointer(), sizeof(struct sockaddr_storage)) != 0) {
printf("Failed to bind %s:%d, errno=%d, %s\n", pip.ip.c_str(), pip.port, errno, strerror(errno));
printf("Failed to bind %s:%d, errno=%d, %s\n", pip->ip.c_str(), pip->port, errno, strerror(errno));
close(sock);
return -1;
}
@ -2481,22 +2483,25 @@ bool CQnetGateway::Init(char *cfgfile)
}
/* udp port 40000 must open first */
if (ii[0]) {
g2_sock[0] = open_port(g2_external, af_family[0]);
SPORTIP *pip = (AF_INET == af_family[0]) ? &g2_external : & g2_ipv6_external;
g2_sock[0] = open_port(pip, af_family[0]);
if (0 > g2_sock[0]) {
printf("Can't open %s:%d for %s\n", g2_external.ip.c_str(), g2_external.port, ircddb[i].ip.c_str());
printf("Can't open %s:%d for %s\n", pip->ip.c_str(), pip->port, ircddb[i].ip.c_str());
return true;
}
if (ii[1] && (af_family[0] != af_family[1])) { // we only need to open a second port if the family for the irc server is different!
g2_sock[1] = open_port(g2_external, af_family[1]);
if (ii[1] && (af_family[0] != af_family[1])) { // we only need to open a second port if the family for the irc servers are different!
SPORTIP *pip = (AF_INET == af_family[1]) ? &g2_external : & g2_ipv6_external;
g2_sock[1] = open_port(pip, af_family[1]);
if (0 > g2_sock[1]) {
printf("Can't open %s:%d for %s\n", g2_external.ip.c_str(), g2_external.port, ircddb[1].ip.c_str());
printf("Can't open %s:%d for %s\n", pip->ip.c_str(), pip->port, ircddb[1].ip.c_str());
return true;
}
}
} else if (ii[1]) {
g2_sock[1] = open_port(g2_external, af_family[1]);
SPORTIP *pip = (AF_INET == af_family[1]) ? &g2_external : & g2_ipv6_external;
g2_sock[1] = open_port(pip, af_family[1]);
if (0 > g2_sock[1]) {
printf("Can't open %s:%d for %s\n", g2_external.ip.c_str(), g2_external.port, ircddb[1].ip.c_str());
printf("Can't open %s:%d for %s\n", pip->ip.c_str(), pip->port, ircddb[1].ip.c_str());
return true;
}
}

@ -91,7 +91,7 @@ private:
bool ABC_grp[3] = { false, false, false };
bool C_seen[3] = { false, false, false };
SPORTIP g2_external, ircddb[2];
SPORTIP g2_external, g2_ipv6_external, ircddb[2];
CUnixDgramReader Link2Gate, Modem2Gate;
CUnixDgramWriter Gate2Link, Gate2Modem[3];
@ -160,7 +160,7 @@ private:
bool VoicePacketIsSync(const unsigned char *text);
void AddFDSet(int &max, int newfd, fd_set *set);
int open_port(const SPORTIP &pip, int family);
int open_port(const SPORTIP *pip, int family);
void calcPFCS(unsigned char *packet, int len);
void GetIRCDataThread(int i);
int get_yrcall_rptr_from_cache(const int i, const std::string &call, std::string &arearp_cs, std::string &zonerp_cs, char *mod, std::string &ip, char RoU);

@ -45,22 +45,24 @@ ircddb1_password_d='' # not needed for rr.openquad.net
#
# GATEWAY
#
gateway_header_regen_d=true # regenerate headers from incoming data
gateway_send_qrgs_maps_d=true # send frequency, offset, coordinates and url to irc-server
gateway_ip_d='ANY_PORT' # the g2 port
gateway_port_d=40000 # don't change
gateway_gate2link_d='gate2link' # Unix sockets between qngateway and QnetLink
gateway_link2gate_d='link2gate' # all Unix sockets are on the file system, but hidden from view
gateway_modem2gate_d='modem2gate' # Unix Sockets between the modem(s) and the gateway (1 in, 3 out)
gateway_header_regen_d=true # regenerate headers from incoming data
gateway_send_qrgs_maps_d=true # send frequency, offset, coordinates and url to irc-server
gateway_ip_d='ANY_PORT' # the g2 port
gateway_port_d=40000 # don't change
gateway_ipv6_ip_d='ANY_PORT'
gateway_ipv6_port_d=9011 # IANA-approved DStar rouing port
gateway_gate2link_d='gate2link' # Unix sockets between qngateway and QnetLink
gateway_link2gate_d='link2gate' # all Unix sockets are on the file system, but hidden from view
gateway_modem2gate_d='modem2gate' # Unix Sockets between the modem(s) and the gateway (1 in, 3 out)
gateway_gate2modema_d='gate2modema'
gateway_gate2modemb_d='gate2modemb'
gateway_gate2modemc_d='gate2modemc'
gateway_latitude_d=0 # you can leave this unspecified for a mobile rig
gateway_longitude_d=0 # like the latitude
gateway_desc1_d='' # maximum of 20 characters, most special symbols are not allowed
gateway_desc2_d='' # just like desc1
gateway_latitude_d=0 # you can leave this unspecified for a mobile rig
gateway_longitude_d=0 # like the latitude
gateway_desc1_d='' # maximum of 20 characters, most special symbols are not allowed
gateway_desc2_d='' # just like desc1
gateway_url_d='github.com/n7tae/QnetGateway' # 80 characters max
gateway_find_route_d='' # CSV list of route(s) to load on boot-up (prevents the "not in cache" message)
gateway_find_route_d='' # CSV list of route(s) to load on boot-up (prevents the "not in cache" message)
##########################################################################################################################
#

Loading…
Cancel
Save

Powered by TurnKey Linux.