MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rts_attach

Function rts_attach

freebsd/net/rtsock.c:316–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314/* pru_accept is EOPNOTSUPP */
315
316static int
317rts_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
352static int
353rts_bind(struct socket *so, struct sockaddr *nam, struct thread *td)

Callers

nothing calls this directly

Calls 4

mallocFunction · 0.85
raw_attachFunction · 0.85
soisconnectedFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected