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