Navigation



Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/fdd.y

    r24 r20  
    212212listenon:               LISTENON '=' QSTRING ';'
    213213                        {
     214                                struct fd_endpoint * ep;
    214215                                struct addrinfo hints, *ai;
    215216                                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;
    216223                               
    217224                                memset(&hints, 0, sizeof(hints));
    218225                                hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
    219226                                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);
    222231                                freeaddrinfo(ai);
    223                                 free($3);
     232                                fd_list_insert_before(&conf->cnf_endpoints, &ep->chain);
    224233                        }
    225234                        ;
     
    327336                                /* Now destroy any content in the structure */
    328337                                free(fddpi.pi_diamid);
    329                                 free(fddpi.pi_sec_data.priority);
    330338                                while (!FD_IS_LIST_EMPTY(&fddpi.pi_endpoints)) {
    331339                                        struct fd_list * li = fddpi.pi_endpoints.next;
     
    407415                                fddpi.pi_port = (uint16_t)$4;
    408416                        }
     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                        }
    409423                        | peerparams TCTIMER '=' INTEGER ';'
    410424                        {
    411425                                fddpi.pi_tctimer = $4;
    412426                        }
    413                         | peerparams TLS_PRIO '=' QSTRING ';'
    414                         {
    415                                 fddpi.pi_sec_data.priority = $4;
    416                         }
    417427                        | peerparams TWTIMER '=' INTEGER ';'
    418428                        {
     
    421431                        | peerparams CONNTO '=' QSTRING ';'
    422432                        {
     433                                struct fd_endpoint * ep;
    423434                                struct addrinfo hints, *ai;
    424435                                int ret;
    425                                 int disc = 0;
    426436                               
     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;
    427442                                memset(&hints, 0, sizeof(hints));
    428443                                hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST;
     
    430445                                if (ret == EAI_NONAME) {
    431446                                        /* The name was maybe not numeric, try again */
    432                                         disc = EP_FL_DISC;
     447                                        ep->meta.disc = 1;
    433448                                        hints.ai_flags &= ~ AI_NUMERICHOST;
    434449                                        ret = getaddrinfo($4, NULL, &hints, &ai);
    435450                                }
    436                                 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; }
     451                                if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); free(ep); YYERROR; }
    437452                               
    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);
    439454                                free($4);
    440455                                freeaddrinfo(ai);
     456                                fd_list_insert_before(&fddpi.pi_endpoints, &ep->chain);
    441457                        }
    442458                        ;
Note: See TracChangeset for help on using the changeset viewer.