Navigation


Changeset 23:db6c40b8b307 in freeDiameter for freeDiameter/fdd.y


Ignore:
Timestamp:
Oct 20, 2009, 5:30:20 PM (15 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added some code in cnxctx.c mainly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/fdd.y

    r22 r23  
    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, 1, 0, 0, 0 ), YYERROR );
     222                                freeaddrinfo(ai);
    230223                                free($3);
    231                                 freeaddrinfo(ai);
    232                                 fd_list_insert_before(&conf->cnf_endpoints, &ep->chain);
    233224                        }
    234225                        ;
     
    430421                        | peerparams CONNTO '=' QSTRING ';'
    431422                        {
    432                                 struct fd_endpoint * ep;
    433423                                struct addrinfo hints, *ai;
    434424                                int ret;
     425                                int disc = 0;
    435426                               
    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;
    441427                                memset(&hints, 0, sizeof(hints));
    442428                                hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST;
     
    444430                                if (ret == EAI_NONAME) {
    445431                                        /* The name was maybe not numeric, try again */
    446                                         ep->meta.disc = 1;
     432                                        disc = 1;
    447433                                        hints.ai_flags &= ~ AI_NUMERICHOST;
    448434                                        ret = getaddrinfo($4, NULL, &hints, &ai);
    449435                                }
    450                                 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); free(ep); YYERROR; }
     436                                if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; }
    451437                               
    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 );
    453439                                free($4);
    454440                                freeaddrinfo(ai);
    455                                 fd_list_insert_before(&fddpi.pi_endpoints, &ep->chain);
    456441                        }
    457442                        ;
Note: See TracChangeset for help on using the changeset viewer.