diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-11-03 13:01:21 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-11-03 13:01:21 +0000 |
commit | f925a46bc179ad7c727ade31c2ee0b4714245e76 (patch) | |
tree | 851a73b9016b9f824a14b915406a29ecee8e8b76 /sys/net/rtsock.c | |
parent | ba187e812aff7c2cf0c997fa8b1c002d42a2167f (diff) |
Inline trivial functions from raw_cb.c and tedu it.
Suggested by and OK mpi, OK visa
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r-- | sys/net/rtsock.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index c2adc8d26ce..7f9e2012e9b 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.252 2017/11/02 14:01:18 florian Exp $ */ +/* $OpenBSD: rtsock.c,v 1.253 2017/11/03 13:01:20 florian Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -224,12 +224,16 @@ route_attach(struct socket *so, int proto) if (curproc == NULL) error = EACCES; - else - error = raw_attach(so, proto); + else + error = soreserve(so, RAWSNDQ, RAWRCVQ); if (error) { free(rop, M_PCB, sizeof(struct routecb)); return (error); } + rp->rcb_socket = so; + rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family; + rp->rcb_proto.sp_protocol = proto; + rop->rtableid = curproc->p_p->ps_rtableid; switch (rp->rcb_proto.sp_protocol) { case AF_INET: @@ -259,6 +263,7 @@ int route_detach(struct socket *so) { struct routecb *rop; + struct rawcb *rp; int af; soassertlocked(so); @@ -267,6 +272,10 @@ route_detach(struct socket *so) if (rop == NULL) return (EINVAL); + rp = sotorawcb(so); + if (rp == NULL) + return (EINVAL); + timeout_del(&rop->timeout); af = rop->rcb.rcb_proto.sp_protocol; if (af == AF_INET) @@ -279,7 +288,12 @@ route_detach(struct socket *so) #endif route_cb.any_count--; LIST_REMOVE(rop, rcb_list); - return (raw_detach(so)); + + so->so_pcb = NULL; + sofree(so); + free(rp, M_PCB, 0); + + return (0); } int |