X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..5d5c5d0d5b79ade9a973d55186ffda2638ba2b6e:/bsd/netat/ddp_usrreq.c?ds=sidebyside diff --git a/bsd/netat/ddp_usrreq.c b/bsd/netat/ddp_usrreq.c index fde242f78..e7e2cb531 100644 --- a/bsd/netat/ddp_usrreq.c +++ b/bsd/netat/ddp_usrreq.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. - * + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code @@ -88,7 +88,7 @@ int ddp_pru_control(struct socket *so, u_long cmd, caddr_t data, int ddp_pru_attach(struct socket *so, int proto, struct proc *p) { - int s, error = 0; + int error = 0; at_ddp_t *ddp = NULL; struct atpcb *pcb = (struct atpcb *)((so)->so_pcb); @@ -96,9 +96,7 @@ int ddp_pru_attach(struct socket *so, int proto, if (error != 0) return error; - s = splnet(); error = at_pcballoc(so, &ddp_head); - splx(s); if (error) return error; pcb = (struct atpcb *)((so)->so_pcb); @@ -113,7 +111,7 @@ int ddp_pru_attach(struct socket *so, int proto, int ddp_pru_disconnect(struct socket *so) { - int s, error = 0; + int error = 0; at_ddp_t *ddp = NULL; struct atpcb *pcb = (struct atpcb *)((so)->so_pcb); @@ -124,9 +122,7 @@ int ddp_pru_disconnect(struct socket *so) return ENOTCONN; soisdisconnected(so); - s = splnet(); at_pcbdetach(pcb); - splx(s); return error; } @@ -134,31 +130,25 @@ int ddp_pru_disconnect(struct socket *so) int ddp_pru_abort(struct socket *so) { - int s; struct atpcb *pcb = (struct atpcb *)((so)->so_pcb); if (pcb == NULL) return (EINVAL); soisdisconnected(so); - s = splnet(); at_pcbdetach(pcb); - splx(s); return 0; } int ddp_pru_detach(struct socket *so) { - int s; struct atpcb *pcb = (struct atpcb *)((so)->so_pcb); if (pcb == NULL) return (EINVAL); - s = splnet(); at_pcbdetach(pcb); - splx(s); return 0; } @@ -231,8 +221,8 @@ int ddp_pru_send(struct socket *so, int flags, struct mbuf *m, } } if (ddp) { - ddp->length = m->m_pkthdr.len; - UAS_ASSIGN(ddp->checksum, + DDPLEN_ASSIGN(ddp, m->m_pkthdr.len); + UAS_ASSIGN_HTON(ddp->checksum, (pcb->ddp_flags & DDPFLG_CHKSUM)? 1: 0); ddp->type = (pcb->ddptype)? pcb->ddptype: DEFAULT_OT_DDPTYPE; #ifdef NOT_YET @@ -261,8 +251,8 @@ int ddp_pru_send(struct socket *so, int flags, struct mbuf *m, NET_ASSIGN(ddp->src_net, ifID->ifThisNode.s_net); ddp->src_node = ifID->ifThisNode.s_node; ddp->src_socket = pcb->lport; - if (UAS_VALUE(ddp->checksum)) - UAS_ASSIGN(ddp->checksum, ddp_checksum(m, 4)); + if (UAS_VALUE_NTOH(ddp->checksum)) + UAS_ASSIGN_HTON(ddp->checksum, ddp_checksum(m, 4)); ddp_input(n, ifID); } } @@ -272,7 +262,6 @@ int ddp_pru_send(struct socket *so, int flags, struct mbuf *m, int ddp_pru_sockaddr(struct socket *so, struct sockaddr **nam) { - int s; struct atpcb *pcb; struct sockaddr_at *sat; @@ -281,9 +270,7 @@ int ddp_pru_sockaddr(struct socket *so, return(ENOMEM); bzero((caddr_t)sat, sizeof(*sat)); - s = splnet(); if ((pcb = sotoatpcb(so)) == NULL) { - splx(s); FREE(sat, M_SONAME); return(EINVAL); } @@ -292,7 +279,6 @@ int ddp_pru_sockaddr(struct socket *so, sat->sat_len = sizeof(*sat); sat->sat_port = pcb->lport; sat->sat_addr = pcb->laddr; - splx(s); *nam = (struct sockaddr *)sat; return(0); @@ -302,7 +288,6 @@ int ddp_pru_sockaddr(struct socket *so, int ddp_pru_peeraddr(struct socket *so, struct sockaddr **nam) { - int s; struct atpcb *pcb; struct sockaddr_at *sat; @@ -311,9 +296,7 @@ int ddp_pru_peeraddr(struct socket *so, return (ENOMEM); bzero((caddr_t)sat, sizeof(*sat)); - s = splnet(); if ((pcb = sotoatpcb(so)) == NULL) { - splx(s); FREE(sat, M_SONAME); return(EINVAL); } @@ -322,7 +305,6 @@ int ddp_pru_peeraddr(struct socket *so, sat->sat_len = sizeof(*sat); sat->sat_port = pcb->rport; sat->sat_addr = pcb->raddr; - splx(s); *nam = (struct sockaddr *)sat; return(0);