Changeset 23:db6c40b8b307 in freeDiameter for freeDiameter/fdd.y
- Timestamp:
- Oct 20, 2009, 5:30:20 PM (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/fdd.y
r22 r23 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, 1, 0, 0, 0 ), 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 ; … … 430 421 | peerparams CONNTO '=' QSTRING ';' 431 422 { 432 struct fd_endpoint * ep;433 423 struct addrinfo hints, *ai; 434 424 int ret; 425 int disc = 0; 435 426 436 CHECK_MALLOC_DO( ep = malloc(sizeof(struct fd_endpoint)),437 { yyerror (&yylloc, conf, "Out of memory"); YYERROR; } );438 memset(ep, 0, sizeof(struct fd_endpoint));439 fd_list_init(&ep->chain, NULL);440 ep->meta.conf = 1;441 427 memset(&hints, 0, sizeof(hints)); 442 428 hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST; … … 444 430 if (ret == EAI_NONAME) { 445 431 /* The name was maybe not numeric, try again */ 446 ep->meta.disc = 1;432 disc = 1; 447 433 hints.ai_flags &= ~ AI_NUMERICHOST; 448 434 ret = getaddrinfo($4, NULL, &hints, &ai); 449 435 } 450 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); free(ep);YYERROR; }436 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; } 451 437 452 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, 1, disc, 0, 0 ), YYERROR ); 453 439 free($4); 454 440 freeaddrinfo(ai); 455 fd_list_insert_before(&fddpi.pi_endpoints, &ep->chain);456 441 } 457 442 ;
Note: See TracChangeset
for help on using the changeset viewer.