* Add the address to the endpoint local address list There is nothing to be * done if we are bound to all addresses */
| 5298 | * done if we are bound to all addresses |
| 5299 | */ |
| 5300 | void |
| 5301 | sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t action) |
| 5302 | { |
| 5303 | struct sctp_laddr *laddr; |
| 5304 | struct sctp_tcb *stcb; |
| 5305 | int fnd, error = 0; |
| 5306 | |
| 5307 | fnd = 0; |
| 5308 | |
| 5309 | if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { |
| 5310 | /* You are already bound to all. You have it already */ |
| 5311 | return; |
| 5312 | } |
| 5313 | #ifdef INET6 |
| 5314 | if (ifa->address.sa.sa_family == AF_INET6) { |
| 5315 | if (ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) { |
| 5316 | /* Can't bind a non-useable addr. */ |
| 5317 | return; |
| 5318 | } |
| 5319 | } |
| 5320 | #endif |
| 5321 | /* first, is it already present? */ |
| 5322 | LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { |
| 5323 | if (laddr->ifa == ifa) { |
| 5324 | fnd = 1; |
| 5325 | break; |
| 5326 | } |
| 5327 | } |
| 5328 | |
| 5329 | if (fnd == 0) { |
| 5330 | /* Not in the ep list */ |
| 5331 | error = sctp_insert_laddr(&inp->sctp_addr_list, ifa, action); |
| 5332 | if (error != 0) |
| 5333 | return; |
| 5334 | inp->laddr_count++; |
| 5335 | /* update inp_vflag flags */ |
| 5336 | switch (ifa->address.sa.sa_family) { |
| 5337 | #ifdef INET6 |
| 5338 | case AF_INET6: |
| 5339 | inp->ip_inp.inp.inp_vflag |= INP_IPV6; |
| 5340 | break; |
| 5341 | #endif |
| 5342 | #ifdef INET |
| 5343 | case AF_INET: |
| 5344 | inp->ip_inp.inp.inp_vflag |= INP_IPV4; |
| 5345 | break; |
| 5346 | #endif |
| 5347 | default: |
| 5348 | break; |
| 5349 | } |
| 5350 | LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { |
| 5351 | sctp_add_local_addr_restricted(stcb, ifa); |
| 5352 | } |
| 5353 | } |
| 5354 | return; |
| 5355 | } |
| 5356 | |
| 5357 | /* |
no test coverage detected