| 458 | } |
| 459 | |
| 460 | static int |
| 461 | sctp_attach(struct socket *so, int proto SCTP_UNUSED, struct thread *p SCTP_UNUSED) |
| 462 | { |
| 463 | struct sctp_inpcb *inp; |
| 464 | struct inpcb *ip_inp; |
| 465 | int error; |
| 466 | uint32_t vrf_id = SCTP_DEFAULT_VRFID; |
| 467 | |
| 468 | inp = (struct sctp_inpcb *)so->so_pcb; |
| 469 | if (inp != NULL) { |
| 470 | SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); |
| 471 | return (EINVAL); |
| 472 | } |
| 473 | if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { |
| 474 | error = SCTP_SORESERVE(so, SCTP_BASE_SYSCTL(sctp_sendspace), SCTP_BASE_SYSCTL(sctp_recvspace)); |
| 475 | if (error) { |
| 476 | return (error); |
| 477 | } |
| 478 | } |
| 479 | error = sctp_inpcb_alloc(so, vrf_id); |
| 480 | if (error) { |
| 481 | return (error); |
| 482 | } |
| 483 | inp = (struct sctp_inpcb *)so->so_pcb; |
| 484 | SCTP_INP_WLOCK(inp); |
| 485 | inp->sctp_flags &= ~SCTP_PCB_FLAGS_BOUND_V6; /* I'm not v6! */ |
| 486 | ip_inp = &inp->ip_inp.inp; |
| 487 | ip_inp->inp_vflag |= INP_IPV4; |
| 488 | ip_inp->inp_ip_ttl = MODULE_GLOBAL(ip_defttl); |
| 489 | SCTP_INP_WUNLOCK(inp); |
| 490 | return (0); |
| 491 | } |
| 492 | |
| 493 | static int |
| 494 | sctp_bind(struct socket *so, struct sockaddr *addr, struct thread *p) |
nothing calls this directly
no test coverage detected