Changeset 961:d95cd3ca9e8d in freeDiameter for libfdcore
- Timestamp:
- Mar 7, 2013, 4:09:54 AM (11 years ago)
- Branch:
- default
- Parents:
- 960:f39fa6cd86e0 (diff), 933:04f590da5821 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Location:
- libfdcore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/cnxctx.c
r928 r961 229 229 230 230 if (TRACE_BOOL(INFO)) { 231 fd_log_debug("%s : accepted new client [", fd_cnx_getid(serv));232 sSA_DUMP_NODE( &ss, NI_NUMERICHOST );233 fd_log_debug(" ].\n");231 char buf[1024]; 232 sSA_DUMP_NODE( buf, sizeof(buf), &ss, NI_NUMERICHOST ); 233 fd_log_debug("%s : accepted new client [%s].\n", fd_cnx_getid(serv), buf); 234 234 } 235 235 … … 312 312 313 313 if (TRACE_BOOL(INFO)) { 314 fd_log_debug("Connection established to server '");315 sSA_DUMP_NODE_SERV( sa, NI_NUMERICSERV);316 fd_log_debug(" ' (TCP:%d).\n", sock);314 char buf[1024]; 315 sSA_DUMP_NODE_SERV( buf, sizeof(buf), sa, NI_NUMERICSERV); 316 fd_log_debug("Connection established to server '%s' (TCP:%d).\n", buf, sock); 317 317 } 318 318 … … 404 404 405 405 if (TRACE_BOOL(INFO)) { 406 fd_log_debug("Connection established to server '");407 sSA_DUMP_NODE_SERV( &primary, NI_NUMERICSERV);408 fd_log_debug(" ' (SCTP:%d, %d/%d streams).\n", sock, cnx->cc_sctp_para.str_in, cnx->cc_sctp_para.str_out);406 char buf[1024]; 407 sSA_DUMP_NODE_SERV( buf, sizeof(buf), &primary, NI_NUMERICSERV); 408 fd_log_debug("Connection established to server '%s' (SCTP:%d, %d/%d streams).\n", buf, sock, cnx->cc_sctp_para.str_in, cnx->cc_sctp_para.str_out); 409 409 } 410 410 -
libfdcore/cnxctx.c
r946 r961 3 3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * 4 4 * * 5 * Copyright (c) 201 2, WIDE Project and NICT *5 * Copyright (c) 2013, WIDE Project and NICT * 6 6 * All rights reserved. * 7 7 * * … … 561 561 continue; 562 562 563 if (cur->ifa_addr == NULL) /* may happen with ppp interfaces */ 564 continue; 565 563 566 if (fd_g_config->cnf_flags.no_ip4 && (cur->ifa_addr->sa_family == AF_INET)) 564 567 continue; -
libfdcore/core.c
r928 r961 226 226 227 227 /* Parse the freeDiameter.conf configuration file, load the extensions */ 228 int fd_core_parseconf(c har * conffile)228 int fd_core_parseconf(const char * conffile) 229 229 { 230 230 TRACE_ENTRY("%p", conffile); -
libfdcore/core.c
r947 r961 3 3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * 4 4 * * 5 * Copyright (c) 201 2, WIDE Project and NICT *5 * Copyright (c) 2013, WIDE Project and NICT * 6 6 * All rights reserved. * 7 7 * * -
libfdcore/fdd.l
r950 r961 3 3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * 4 4 * * 5 * Copyright (c) 201 1, WIDE Project and NICT *5 * Copyright (c) 2013, WIDE Project and NICT * 6 6 * All rights reserved. * 7 7 * * … … 67 67 /* %option noinput ? */ 68 68 #define YY_NO_INPUT 69 70 /* Additional for files inclusion */ 71 #include <glob.h> 72 #include <string.h> 73 74 #define MAX_NESTED_CONF_FILES 5 75 76 struct nested_conffiles_t { 77 YY_BUFFER_STATE parent_level_state; 78 glob_t filelist; 79 int current_file; 80 } nested_conffiles[MAX_NESTED_CONF_FILES]; 81 82 int current_nested_level = 0; 83 84 int globerrfct(const char *epath, int eerrno) 85 { 86 TRACE_DEBUG_ERROR("Failed to scan %s: %s\n", epath, strerror(eerrno)); 87 return 1; 88 } 89 69 90 %} 70 91 … … 73 94 %option nounput 74 95 96 %x in_include 97 75 98 /* Quoted string. Multilines do not match. */ 76 99 qstring \"[^\"\n]*\" 77 100 78 101 %% 79 80 102 <*>\n { 81 103 /* Update the line count */ … … 87 109 <*>([[:space:]]{-}[\n])+ ; /* Eat all spaces, not new lines */ 88 110 <*>#.*$ ; /* Eat all comments */ 111 112 113 include BEGIN(in_include); 114 /* Following an "include" keyword */ 115 <in_include>{ 116 {qstring} { /* Name of the file to include. This is directly sent to glob. */ 117 int globerror=0; 118 char * buf = strdup(yytext+1); 119 if (buf[yyleng-2] != '"') 120 { 121 TRACE_DEBUG_ERROR("Unterminated string: %s\n", yytext); 122 return LEX_ERROR; 123 } 124 buf[yyleng-2] = '\0'; 125 126 if (current_nested_level >= MAX_NESTED_CONF_FILES) 127 { 128 TRACE_DEBUG_ERROR("Too many recursion levels in configuration files includes\n"); 129 return LEX_ERROR; 130 } 131 132 /* glob the include */ 133 globerror = glob(buf, GLOB_ERR, globerrfct, &nested_conffiles[current_nested_level].filelist); 134 135 if (globerror == GLOB_NOSPACE) 136 { 137 TRACE_DEBUG_ERROR("Not enough memory to parse include directive.\n"); 138 return LEX_ERROR; 139 } 140 if (globerror == GLOB_ABORTED) 141 { 142 TRACE_DEBUG_ERROR("An error was encountered in include directive.\n"); 143 return LEX_ERROR; 144 } 145 if (globerror == GLOB_NOMATCH) 146 { 147 globfree(&nested_conffiles[current_nested_level].filelist); 148 goto nomatch; 149 } 150 if (globerror) 151 { 152 TRACE_DEBUG_ERROR("Unexpected error in glob (%d).\n", globerror); 153 return LEX_ERROR; 154 } 155 156 /* We have a list of files to include. */ 157 158 /* save the current buffer for returning when this include has been parsed */ 159 nested_conffiles[current_nested_level].parent_level_state = YY_CURRENT_BUFFER; 160 161 /* Start with the first match */ 162 nested_conffiles[current_nested_level].current_file = 0; 163 164 yyin = fopen( nested_conffiles[current_nested_level].filelist.gl_pathv[0], "r" ); 165 166 if ( ! yyin ) 167 { 168 TRACE_DEBUG_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[0], strerror(errno)); 169 return LEX_ERROR; 170 } 171 172 yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE )); 173 174 /* In case of recursive includes */ 175 current_nested_level++; 176 177 nomatch: 178 BEGIN(INITIAL); 179 } 180 } 181 182 <<EOF>> { 183 if (current_nested_level == 0) 184 { 185 /* We are at the end of parsing */ 186 yyterminate(); 187 } 188 189 /* Otherwise we are doing an include statement */ 190 --current_nested_level; 191 yy_delete_buffer(YY_CURRENT_BUFFER); 192 193 /* Go to next file, if any */ 194 nested_conffiles[current_nested_level].current_file++; 195 if ( nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file] == NULL ) 196 { 197 /* We have finished with this list of includes */ 198 globfree(&nested_conffiles[current_nested_level].filelist); 199 yy_switch_to_buffer(nested_conffiles[current_nested_level].parent_level_state); 200 } 201 else 202 { 203 /* Proceed to next included file */ 204 yyin = fopen( nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file], "r" ); 205 206 if ( ! yyin ) 207 { 208 TRACE_DEBUG_ERROR("Error in %s: %s", nested_conffiles[current_nested_level].filelist.gl_pathv[nested_conffiles[current_nested_level].current_file], strerror(errno)); 209 return LEX_ERROR; 210 } 211 212 yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE )); 213 214 /* In case of recursive includes */ 215 current_nested_level++; 216 } 217 218 } 89 219 90 220 {qstring} { -
libfdcore/fdd.y
r950 r961 3 3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * 4 4 * * 5 * Copyright (c) 201 2, WIDE Project and NICT *5 * Copyright (c) 2013, WIDE Project and NICT * 6 6 * All rights reserved. * 7 7 * * -
libfdcore/peers.c
r933 r961 91 91 92 92 /* Add a new peer entry */ 93 int fd_peer_add ( struct peer_info * info, c har * orig_dbg, void (*cb)(struct peer_info *, void *), void * cb_data )93 int fd_peer_add ( struct peer_info * info, const char * orig_dbg, void (*cb)(struct peer_info *, void *), void * cb_data ) 94 94 { 95 95 struct fd_peer *p = NULL; -
libfdcore/peers.c
r950 r961 3 3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * 4 4 * * 5 * Copyright (c) 201 2, WIDE Project and NICT *5 * Copyright (c) 2013, WIDE Project and NICT * 6 6 * All rights reserved. * 7 7 * * … … 515 515 peer->p_flags.pf_delete = 1; 516 516 517 #ifndef DISABLE_PEER_EXPIRY 517 518 /* Set this peer to expire on inactivity */ 518 519 peer->p_hdr.info.config.pic_flags.exp = PI_EXP_INACTIVE; 519 520 peer->p_hdr.info.config.pic_lft = 3600; /* 1 hour without any message 520 521 -- RFC3539 states that this must not be inferior to BRINGDOWN_INTERVAL = 5 minutes */ 522 521 523 CHECK_FCT_DO( ret = fd_p_expi_update( peer ), goto out ); 522 524 #endif /* DISABLE_PEER_EXPIRY */ 523 525 524 526 /* Insert the new peer in the list (the PSM will take care of setting the expiry after validation) */ -
libfdcore/sctp.c
r928 r961 909 909 } 910 910 if (TRACE_BOOL(SCTP_LEVEL)) { 911 char buf[1024]; 912 sSA_DUMP_NODE_SERV(buf, sizeof(buf), &status.sstat_primary.spinfo_address, NI_NUMERICHOST | NI_NUMERICSERV ); 911 913 fd_log_debug( "SCTP_STATUS : sstat_state : %i\n" , status.sstat_state); 912 914 fd_log_debug( " sstat_rwnd : %u\n" , status.sstat_rwnd); … … 916 918 fd_log_debug( " sstat_outstrms : %hu\n", status.sstat_outstrms); 917 919 fd_log_debug( " sstat_fragmentation_point : %u\n" , status.sstat_fragmentation_point); 918 fd_log_debug( " sstat_primary.spinfo_address : "); 919 sSA_DUMP_NODE_SERV(&status.sstat_primary.spinfo_address, NI_NUMERICHOST | NI_NUMERICSERV ); 920 fd_log_debug( "\n" ); 920 fd_log_debug( " sstat_primary.spinfo_address : %s\n" , buf); 921 921 fd_log_debug( " sstat_primary.spinfo_state : %d\n" , status.sstat_primary.spinfo_state); 922 922 fd_log_debug( " sstat_primary.spinfo_cwnd : %u\n" , status.sstat_primary.spinfo_cwnd); -
libfdcore/sctp.c
r950 r961 3 3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * 4 4 * * 5 * Copyright (c) 201 2, WIDE Project and NICT *5 * Copyright (c) 2013, WIDE Project and NICT * 6 6 * All rights reserved. * 7 7 * *
Note: See TracChangeset
for help on using the changeset viewer.