Changeset 379:7337305ee51e in freeDiameter
- Timestamp:
- Jul 5, 2010, 5:04:46 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- freeDiameter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/endpoints.c
r258 r379 193 193 } 194 194 195 /* Remove any endpoint from the exclude list in the list */ 196 int fd_ep_filter_list( struct fd_list * list, struct fd_list * exclude_list ) 197 { 198 struct fd_list * li_out, *li_ex, *li; 199 struct fd_endpoint * out, * ex; 200 201 TRACE_ENTRY("%p %p", list, exclude_list); 202 CHECK_PARAMS(list && exclude_list); 203 204 /* initialize. Both lists are ordered */ 205 li_out = list->next; 206 li_ex = exclude_list; 207 208 /* Now browse both lists in parallel */ 209 while ((li_out != list) && (li_ex != exclude_list)) { 210 int cmp; 211 212 out = (struct fd_endpoint *)li_out; 213 ex = (struct fd_endpoint *)li_ex; 214 215 /* Compare the next elements families */ 216 if (out->sa.sa_family < ex->sa.sa_family) { 217 li_out = li_out->next; 218 continue; 219 } 220 if (out->sa.sa_family > ex->sa.sa_family) { 221 li_ex = li_ex->next; 222 continue; 223 } 224 225 /* Then compare the address fields */ 226 switch (out->sa.sa_family) { 227 case AF_INET: 228 cmp = memcmp(&out->sin.sin_addr, &ex->sin.sin_addr, sizeof(struct in_addr)); 229 break; 230 case AF_INET6: 231 cmp = memcmp(&out->sin6.sin6_addr, &ex->sin6.sin6_addr, sizeof(struct in6_addr)); 232 break; 233 default: 234 /* Filter this out */ 235 cmp = 0; 236 } 237 if (cmp < 0) { 238 li_out = li_out->next; 239 continue; 240 } 241 if (cmp > 0) { 242 li_ex = li_ex->next; 243 continue; 244 } 245 246 /* We remove this element then loop */ 247 li = li_out; 248 li_out = li->next; 249 fd_list_unlink(li); 250 free(li); 251 } 252 return 0; 253 254 } 255 256 195 257 /* Reset the given flag(s) from all items in the list */ 196 258 int fd_ep_clearflags( struct fd_list * list, uint32_t flags ) -
freeDiameter/p_cnx.c
r375 r379 118 118 } 119 119 120 /* Remove any local address that would be here, it should not happen but it does sometimes... */ 121 CHECK_FCT( fd_ep_filter_list(&peer->p_hdr.info.pi_endpoints, &fd_g_config->cnf_endpoints) ); 122 120 123 /* Now check we have at least one address to attempt */ 121 124 if (FD_IS_LIST_EMPTY(&peer->p_hdr.info.pi_endpoints)) {
Note: See TracChangeset
for help on using the changeset viewer.