Author: wirtz Date: Wed May 25 18:43:24 2011 New Revision: 2588 Log: added data port as parameter of client daemon register packet used to not talk to the same ports on an IP that the server daemon runs on Modified: trunk/libpisa/packet.h trunk/pisacd/cdregister.c trunk/pisacd/pisacd.conf trunk/pisasd/sdregister.c Modified: trunk/libpisa/packet.h ============================================================================== --- trunk/libpisa/packet.h Wed May 25 16:07:01 2011 (r2587) +++ trunk/libpisa/packet.h Wed May 25 18:43:24 2011 (r2588) @@ -91,6 +91,7 @@ struct pisa_payload_register { struct in_addr local; uint16_t type; + uint16_t port; } __attribute__ ((packed)); /** Modified: trunk/pisacd/cdregister.c ============================================================================== --- trunk/pisacd/cdregister.c Wed May 25 16:07:01 2011 (r2587) +++ trunk/pisacd/cdregister.c Wed May 25 18:43:24 2011 (r2588) @@ -121,6 +121,7 @@ pend->data = reg; reg->type = htons(entry->type); + reg->port = htons(cd_cfg.port_data); if (entry->type == PISA_CONTYPE_SERVICE) { pisa_ipv4_copy(®->local, &cd_cfg.local_ipv4); Modified: trunk/pisacd/pisacd.conf ============================================================================== --- trunk/pisacd/pisacd.conf Wed May 25 16:07:01 2011 (r2587) +++ trunk/pisacd/pisacd.conf Wed May 25 18:43:24 2011 (r2588) @@ -4,8 +4,8 @@ debugtypemask = 16777215; # all debug output, bitmask 2^24-1 # These are the default ports -port_control = 5001; -port_data = 5002; +port_control = 7001; +port_data = 7002; # Time in seconds after that idle connections (except the relay connection) # are disconnected to save resources by no longer maintaining old connections. Modified: trunk/pisasd/sdregister.c ============================================================================== --- trunk/pisasd/sdregister.c Wed May 25 16:07:01 2011 (r2587) +++ trunk/pisasd/sdregister.c Wed May 25 18:43:24 2011 (r2588) @@ -58,13 +58,14 @@ */ static struct pisa_conmgr_entry *pisa_register_client_accept(struct sockaddr_in6 *addr, uint16_t type, - struct in_addr *client_ipv4) + struct in_addr *client_ipv4, + uint16_t data_port) { struct pisa_conmgr_entry *entry; struct timespec delay = {PISASD_HEARTBEAT_DELAY, 0}; entry = pisa_conmgr_add(sd_ctx.conlist, &addr->sin6_addr, ntohs(addr->sin6_port), type); - pisa_conmgr_connected(sd_ctx.conlist, entry, PISASD_DEFAULT_PORTNUM_DATA, client_ipv4); + pisa_conmgr_connected(sd_ctx.conlist, entry, data_port, client_ipv4); pisa_send_register_ack(entry); entry->status = PISA_CON_CONNECTED; @@ -89,6 +90,7 @@ struct pisa_hitlist_entry *con; struct in_addr client_ipv4; uint16_t type; + uint16_t data_port; inet_ntop(AF_INET6, &addr->sin6_addr, buffer, sizeof(buffer)); @@ -107,6 +109,7 @@ inet_ntop(AF_INET, &client_ipv4, ip_local, sizeof(ip_local)); type = ntohs(pkt->body.reg.type); + data_port = ntohs(pkt->body.reg.port); switch (type) { case PISA_CONTYPE_RELAY: con = pisa_hitlist_find(sd_cfg.hit_allowed, &addr->sin6_addr); @@ -121,8 +124,8 @@ return; } - e = pisa_register_client_accept(addr, type, &client_ipv4); - PISA_INFO("Accepted relay client %s as %s\n", buffer, ip_local); + e = pisa_register_client_accept(addr, type, &client_ipv4, data_port); + PISA_INFO("Accepted relay client %s as %s with port %d\n", buffer, ip_local, data_port); #ifdef CONFIG_PISA_LOGGING /* Save start of connection time and log the start of a new connection. */ e->start_time = time(NULL); @@ -130,14 +133,14 @@ #endif break; case PISA_CONTYPE_SERVICE: - e = pisa_register_client_accept(addr, type, &client_ipv4); + e = pisa_register_client_accept(addr, type, &client_ipv4, data_port); pisa_nat_add_mapping(sd_ctx.natlist, &client_ipv4, &pkt->body.reg.local, e, NULL); inet_ntop(AF_INET, &pkt->body.reg.local, ip_remote, sizeof(ip_remote)); - PISA_INFO("Accepted service client %s as %s with remote %s\n", buffer, ip_local, ip_remote); + PISA_INFO("Accepted service client %s as %s with remote %s and port %d\n", buffer, ip_local, ip_remote, data_port); break; case PISA_CONTYPE_LEGACY_ROUTER: - e = pisa_register_client_accept(addr, type, &client_ipv4); - PISA_INFO("Accepted legacy router client %s as %s\n", buffer, ip_local); + e = pisa_register_client_accept(addr, type, &client_ipv4, data_port); + PISA_INFO("Accepted legacy router client %s as %s with port %d\n", buffer, ip_local, data_port); break; default: PISA_ERROR("Ignored unknown type %i client %s\n", type, buffer); -- This is the pisa developer mailing list. Please also subscribe to the main pisa list at: //www.freelists.org/list/pisa