| 314 | /* pru_accept is EOPNOTSUPP */ |
| 315 | |
| 316 | static int |
| 317 | rts_attach(struct socket *so, int proto, struct thread *td) |
| 318 | { |
| 319 | struct rawcb *rp; |
| 320 | int error; |
| 321 | |
| 322 | KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL")); |
| 323 | |
| 324 | /* XXX */ |
| 325 | rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO); |
| 326 | |
| 327 | so->so_pcb = (caddr_t)rp; |
| 328 | so->so_fibnum = td->td_proc->p_fibnum; |
| 329 | error = raw_attach(so, proto); |
| 330 | rp = sotorawcb(so); |
| 331 | if (error) { |
| 332 | so->so_pcb = NULL; |
| 333 | free(rp, M_PCB); |
| 334 | return error; |
| 335 | } |
| 336 | RTSOCK_LOCK(); |
| 337 | switch(rp->rcb_proto.sp_protocol) { |
| 338 | case AF_INET: |
| 339 | V_route_cb.ip_count++; |
| 340 | break; |
| 341 | case AF_INET6: |
| 342 | V_route_cb.ip6_count++; |
| 343 | break; |
| 344 | } |
| 345 | V_route_cb.any_count++; |
| 346 | RTSOCK_UNLOCK(); |
| 347 | soisconnected(so); |
| 348 | so->so_options |= SO_USELOOPBACK; |
| 349 | return 0; |
| 350 | } |
| 351 | |
| 352 | static int |
| 353 | rts_bind(struct socket *so, struct sockaddr *nam, struct thread *td) |
nothing calls this directly
no test coverage detected