Navigation


Changeset 1136:140450615773 in freeDiameter for libfdcore/endpoints.c


Ignore:
Timestamp:
May 16, 2013, 3:56:31 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Revert changeset 1122 (ADDRESS_AVP_INCLUDE_PORT) as this will create too much interop issues. The Host-IP-Address AVP is not normally used to discover peer address, but only for validation of the addresses where a packet is received from -- which is quite useless with a connected transport connection, but anyway...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/endpoints.c

    r1127 r1136  
    203203}
    204204
    205 /* Remove any endpoint from the exclude list in the list */
    206 int fd_ep_filter_list( struct fd_list * list, struct fd_list * exclude_list )
    207 {
    208         struct fd_list * li_out, *li_ex, *li;
    209         struct fd_endpoint * out, * ex;
    210        
    211         TRACE_ENTRY("%p %p", list, exclude_list);
    212         CHECK_PARAMS(list && exclude_list);
    213        
    214         /* initialize. Both lists are ordered */
    215         li_out = list->next;
    216         li_ex = exclude_list->next;
    217        
    218         /* Now browse both lists in parallel */
    219         while ((li_out != list) && (li_ex != exclude_list)) {
    220                 int cmp;
    221                 in_port_t * port_out, *port_ex;
    222                
    223                 out = (struct fd_endpoint *)li_out;
    224                 ex = (struct fd_endpoint *)li_ex;
    225 
    226                 /* Compare the next elements families */
    227                 if (out->sa.sa_family < ex->sa.sa_family) {
    228                         li_out = li_out->next;
    229                         continue;
    230                 }
    231                 if (out->sa.sa_family > ex->sa.sa_family) {
    232                         li_ex = li_ex->next;
    233                         continue;
    234                 }
    235 
    236                 /* Then compare the address fields */
    237                 switch (out->sa.sa_family) {
    238                         case AF_INET:
    239                                 cmp = memcmp(&out->sin.sin_addr, &ex->sin.sin_addr, sizeof(struct in_addr));
    240                                 port_out = &out->sin.sin_port;
    241                                 port_ex = &ex->sin.sin_port;
    242                                 break;
    243                         case AF_INET6:
    244                                 cmp = memcmp(&out->sin6.sin6_addr, &ex->sin6.sin6_addr, sizeof(struct in6_addr));
    245                                 port_out = &out->sin6.sin6_port;
    246                                 port_ex = &ex->sin6.sin6_port;
    247                                 break;
    248                         default:
    249                                 /* Filter this out */
    250                                 cmp = 0;
    251                 }
    252                 if (cmp < 0) {
    253                         li_out = li_out->next;
    254                         continue;
    255                 }
    256                 if (cmp > 0) {
    257                         li_ex = li_ex->next;
    258                         continue;
    259                 }
    260                
    261                 if (port_out && (*port_out != 0) && (*port_ex != 0)) {
    262                         if (*port_out < *port_ex) {
    263                                 li_out = li_out->next;
    264                                 continue;
    265                         }
    266                         if (*port_out > *port_ex) {
    267                                 li_ex = li_ex->next;
    268                                 continue;
    269                         }
    270                 }
    271        
    272                 /* We remove this element then loop */
    273                 li = li_out;
    274                 li_out = li->next;
    275                 fd_list_unlink(li);
    276                 free(li);
    277         }
    278        
    279         return 0;
    280 
    281 }
    282 
    283 
    284205/* Reset the given flag(s) from all items in the list */
    285206int fd_ep_clearflags( struct fd_list * list, uint32_t flags )
Note: See TracChangeset for help on using the changeset viewer.