Changes in freeDiameter/fdd.y [20:277ec00d793e:24:bd83ce9328ed] in freeDiameter
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/fdd.y
r20 r24 212 212 listenon: LISTENON '=' QSTRING ';' 213 213 { 214 struct fd_endpoint * ep;215 214 struct addrinfo hints, *ai; 216 215 int ret; 217 218 CHECK_MALLOC_DO( ep = malloc(sizeof(struct fd_endpoint)),219 { yyerror (&yylloc, conf, "Out of memory"); YYERROR; } );220 memset(ep, 0, sizeof(struct fd_endpoint));221 fd_list_init(&ep->chain, NULL);222 ep->meta.conf = 1;223 216 224 217 memset(&hints, 0, sizeof(hints)); 225 218 hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; 226 219 ret = getaddrinfo($3, NULL, &hints, &ai); 227 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); free(ep);YYERROR; }228 ASSERT( ai->ai_addrlen <= sizeof(sSS));229 memcpy(&ep->ss, ai->ai_addr, ai->ai_addrlen);220 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; } 221 CHECK_FCT_DO( fd_ep_add_merge( &conf->cnf_endpoints, ai->ai_addr, ai->ai_addrlen, EP_FL_CONF ), YYERROR ); 222 freeaddrinfo(ai); 230 223 free($3); 231 freeaddrinfo(ai);232 fd_list_insert_before(&conf->cnf_endpoints, &ep->chain);233 224 } 234 225 ; … … 336 327 /* Now destroy any content in the structure */ 337 328 free(fddpi.pi_diamid); 329 free(fddpi.pi_sec_data.priority); 338 330 while (!FD_IS_LIST_EMPTY(&fddpi.pi_endpoints)) { 339 331 struct fd_list * li = fddpi.pi_endpoints.next; … … 415 407 fddpi.pi_port = (uint16_t)$4; 416 408 } 417 | peerparams SCTPSTREAMS '=' INTEGER ';'418 {419 CHECK_PARAMS_DO( ($4 > 0) && ($4 < 1<<16),420 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } );421 fddpi.pi_streams = (uint16_t)$4;422 }423 409 | peerparams TCTIMER '=' INTEGER ';' 424 410 { 425 411 fddpi.pi_tctimer = $4; 426 412 } 413 | peerparams TLS_PRIO '=' QSTRING ';' 414 { 415 fddpi.pi_sec_data.priority = $4; 416 } 427 417 | peerparams TWTIMER '=' INTEGER ';' 428 418 { … … 431 421 | peerparams CONNTO '=' QSTRING ';' 432 422 { 433 struct fd_endpoint * ep;434 423 struct addrinfo hints, *ai; 435 424 int ret; 425 int disc = 0; 436 426 437 CHECK_MALLOC_DO( ep = malloc(sizeof(struct fd_endpoint)),438 { yyerror (&yylloc, conf, "Out of memory"); YYERROR; } );439 memset(ep, 0, sizeof(struct fd_endpoint));440 fd_list_init(&ep->chain, NULL);441 ep->meta.conf = 1;442 427 memset(&hints, 0, sizeof(hints)); 443 428 hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST; … … 445 430 if (ret == EAI_NONAME) { 446 431 /* The name was maybe not numeric, try again */ 447 ep->meta.disc = 1;432 disc = EP_FL_DISC; 448 433 hints.ai_flags &= ~ AI_NUMERICHOST; 449 434 ret = getaddrinfo($4, NULL, &hints, &ai); 450 435 } 451 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); free(ep);YYERROR; }436 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; } 452 437 453 memcpy(&ep->ss, ai->ai_addr, ai->ai_addrlen);438 CHECK_FCT_DO( fd_ep_add_merge( &fddpi.pi_endpoints, ai->ai_addr, ai->ai_addrlen, EP_FL_CONF | disc ), YYERROR ); 454 439 free($4); 455 440 freeaddrinfo(ai); 456 fd_list_insert_before(&fddpi.pi_endpoints, &ep->chain);457 441 } 458 442 ;
Note: See TracChangeset
for help on using the changeset viewer.