Navigation


Changeset 1122:d4371b7aa0ff in freeDiameter for libfdcore


Ignore:
Timestamp:
May 14, 2013, 7:01:31 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

New CMake option: ADDRESS_AVP_INCLUDE_PORT. Turn off for standard Host-IP-Address AVPs

Location:
libfdcore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/endpoints.c

    r1119 r1122  
    9494                        return 0;
    9595        }
    96 
     96       
    9797        /* remove the ACCEPTALL flag */
    9898        flags &= ~EP_ACCEPTALL;
     
    135135                        break;
    136136                }
    137                 if (*ep_port < *port)
    138                         continue;
     137                if (*ep_port < *port) {
     138                        cmp = -1;
     139                        continue;
     140                }
    139141                if (*ep_port > *port)
    140142                        cmp = 1;
     
    217219        while ((li_out != list) && (li_ex != exclude_list)) {
    218220                int cmp;
    219 
     221                in_port_t * port_out, *port_ex;
     222               
    220223                out = (struct fd_endpoint *)li_out;
    221224                ex = (struct fd_endpoint *)li_ex;
     
    235238                        case AF_INET:
    236239                                cmp = memcmp(&out->sin.sin_addr, &ex->sin.sin_addr, sizeof(struct in_addr));
     240                                port_out = &out->sin.sin_port;
     241                                port_ex = &ex->sin.sin_port;
    237242                                break;
    238243                        case AF_INET6:
    239244                                cmp = memcmp(&out->sin6.sin6_addr, &ex->sin6.sin6_addr, sizeof(struct in6_addr));
     245                                port_out = &out->sin6.sin6_port;
     246                                port_ex = &ex->sin6.sin6_port;
    240247                                break;
    241248                        default:
     
    250257                        li_ex = li_ex->next;
    251258                        continue;
     259                }
     260               
     261                if (port_out && (*port_out != 0) && (*port_ex != 0)) {
     262                        if (*port_out < *port_ex) {
     263                                li_out = li_out->next;
     264                                continue;
     265                        }
     266                        if (*port_out > *port_ex) {
     267                                li_ex = li_ex->next;
     268                                continue;
     269                        }
    252270                }
    253271       
     
    298316        }
    299317       
    300         CHECK_MALLOC_DO( fd_sa_dump_node_serv( FD_DUMP_STD_PARAMS, &ep->sa, NI_NUMERICHOST | NI_NUMERICSERV ), return NULL);
     318        CHECK_MALLOC_DO( fd_sa_dump( FD_DUMP_STD_PARAMS, &ep->sa, NI_NUMERICHOST | NI_NUMERICSERV ), return NULL);
    301319        CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{%s%s%s%s%s}",
    302320                                (ep->flags & EP_FL_CONF)        ? "C" : "-",
  • libfdcore/p_ce.c

    r1119 r1122  
    110110        for (li = fd_g_config->cnf_endpoints.next; li != &fd_g_config->cnf_endpoints; li = li->next) {
    111111                struct fd_endpoint * ep = (struct fd_endpoint *)li;
    112                
    113112                CHECK_FCT( fd_msg_avp_new ( dictobj, 0, &avp ) );
    114113                CHECK_FCT( fd_msg_avp_value_encode ( &ep->ss, avp ) );
  • libfdcore/server.c

    r1113 r1122  
    342342        int empty_conf_ep = FD_IS_LIST_EMPTY(&fd_g_config->cnf_endpoints);
    343343       
     344        struct fd_list filter_list = FD_LIST_INITIALIZER(filter_list);
     345       
    344346        /* SCTP */
    345347        if (!fd_g_config->cnf_flags.no_sctp) {
     
    447449        }
    448450       
     451        /* we will filter this list and create endpoints with port information */
     452        #ifdef ADDRESS_AVP_INCLUDE_PORT
     453        fd_list_move_end(&filter_list, &fd_g_config->cnf_endpoints);
     454        while (!FD_IS_LIST_EMPTY(&filter_list)) {
     455                struct fd_endpoint * ep = (struct fd_endpoint *)filter_list.next;
     456                in_port_t * port = NULL;
     457                fd_list_unlink(&ep->chain);
     458               
     459                switch( ep->sa.sa_family ) {
     460                case AF_INET: port = &ep->sin.sin_port; break;
     461                case AF_INET6: port = &ep->sin6.sin6_port; break;
     462                }
     463               
     464                if (port) {
     465                        if (fd_g_config->cnf_port) {
     466                                *port = htons(fd_g_config->cnf_port);
     467                                CHECK_FCT(fd_ep_add_merge( &fd_g_config->cnf_endpoints, &ep->sa, sSAlen(&ep->sa), ep->flags ));
     468                        }
     469                        if (fd_g_config->cnf_port_tls) {
     470                                *port = htons(fd_g_config->cnf_port_tls);
     471                                CHECK_FCT(fd_ep_add_merge( &fd_g_config->cnf_endpoints, &ep->sa, sSAlen(&ep->sa), ep->flags ));
     472                        }
     473                }
     474                free(ep);
     475        }
     476        #endif /* ADDRESS_AVP_INCLUDE_PORT */
     477       
    449478        {
    450479                char * buf = NULL;
  • libfdcore/tcp.c

    r1085 r1122  
    138138        pthread_cleanup_push(fd_cleanup_socket, &s);
    139139       
    140         LOG_D( "Attempting TCP connection to %s...", fd_sa_dump_node(&buf, &len, NULL, sa, NI_NUMERICHOST | NI_NUMERICSERV)?:"<error>" );
     140        LOG_D( "Attempting TCP connection to %s...", fd_sa_dump(&buf, &len, NULL, sa, NI_NUMERICHOST | NI_NUMERICSERV)?:"<error>" );
    141141        free(buf);
    142142       
Note: See TracChangeset for help on using the changeset viewer.