Navigation


Changeset 378:41e3c2a3721c in freeDiameter for freeDiameter/server.c


Ignore:
Timestamp:
Jul 5, 2010, 4:21:22 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Replaced old mechanism to discover local addresses by a call to getifaddrs, lot cleaner!
Should close #4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/server.c

    r258 r378  
    270270                CHECK_POSIX( pthread_create( &s->thr, NULL, serv_th, s ) );
    271271               
    272                 /* Retrieve the list of endpoints if it was empty */
    273                 if (empty_conf_ep) {
    274                         (void) fd_cnx_getendpoints(s->conn, &fd_g_config->cnf_endpoints, NULL);
    275                         if (TRACE_BOOL(FULL)){
    276                                 fd_log_debug("  Local server address(es) :\n");
    277                                 fd_ep_dump( 5, &fd_g_config->cnf_endpoints );
    278                         }
    279                 }
    280                
    281272                /* Create the server on secure port */
    282273                CHECK_MALLOC( s = new_serv(IPPROTO_SCTP, 1) );
     
    344335        }
    345336       
     337        /* Now, if we still have not got the list of local adresses, try to read it from the kernel directly */
     338        if (FD_IS_LIST_EMPTY(&fd_g_config->cnf_endpoints)) {
     339                CHECK_FCT(fd_cnx_get_local_eps(&fd_g_config->cnf_endpoints));
     340                if (FD_IS_LIST_EMPTY(&fd_g_config->cnf_endpoints)) {
     341                        TRACE_DEBUG(INFO, "Unable to find the addresses of the local system. Please use \"ListenOn\" parameter in the configuration.");
     342                        return EINVAL;
     343                }
     344        }
     345        if (TRACE_BOOL(FULL)){
     346                fd_log_debug("  Local server address(es) :\n");
     347                fd_ep_dump( 5, &fd_g_config->cnf_endpoints );
     348        }
    346349        return 0;
    347350}
Note: See TracChangeset for help on using the changeset viewer.