Navigation



Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/fdd.y

    r20 r24  
    212212listenon:               LISTENON '=' QSTRING ';'
    213213                        {
    214                                 struct fd_endpoint * ep;
    215214                                struct addrinfo hints, *ai;
    216215                                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;
    223216                               
    224217                                memset(&hints, 0, sizeof(hints));
    225218                                hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
    226219                                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);
    230223                                free($3);
    231                                 freeaddrinfo(ai);
    232                                 fd_list_insert_before(&conf->cnf_endpoints, &ep->chain);
    233224                        }
    234225                        ;
     
    336327                                /* Now destroy any content in the structure */
    337328                                free(fddpi.pi_diamid);
     329                                free(fddpi.pi_sec_data.priority);
    338330                                while (!FD_IS_LIST_EMPTY(&fddpi.pi_endpoints)) {
    339331                                        struct fd_list * li = fddpi.pi_endpoints.next;
     
    415407                                fddpi.pi_port = (uint16_t)$4;
    416408                        }
    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                         }
    423409                        | peerparams TCTIMER '=' INTEGER ';'
    424410                        {
    425411                                fddpi.pi_tctimer = $4;
    426412                        }
     413                        | peerparams TLS_PRIO '=' QSTRING ';'
     414                        {
     415                                fddpi.pi_sec_data.priority = $4;
     416                        }
    427417                        | peerparams TWTIMER '=' INTEGER ';'
    428418                        {
     
    431421                        | peerparams CONNTO '=' QSTRING ';'
    432422                        {
    433                                 struct fd_endpoint * ep;
    434423                                struct addrinfo hints, *ai;
    435424                                int ret;
     425                                int disc = 0;
    436426                               
    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;
    442427                                memset(&hints, 0, sizeof(hints));
    443428                                hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST;
     
    445430                                if (ret == EAI_NONAME) {
    446431                                        /* The name was maybe not numeric, try again */
    447                                         ep->meta.disc = 1;
     432                                        disc = EP_FL_DISC;
    448433                                        hints.ai_flags &= ~ AI_NUMERICHOST;
    449434                                        ret = getaddrinfo($4, NULL, &hints, &ai);
    450435                                }
    451                                 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); free(ep); YYERROR; }
     436                                if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; }
    452437                               
    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 );
    454439                                free($4);
    455440                                freeaddrinfo(ai);
    456                                 fd_list_insert_before(&fddpi.pi_endpoints, &ep->chain);
    457441                        }
    458442                        ;
Note: See TracChangeset for help on using the changeset viewer.