Deleted Added
full compact
31c31
< * $FreeBSD: head/sys/net/raw_usrreq.c 180305 2008-07-05 18:03:39Z rwatson $
---
> * $FreeBSD: head/sys/net/raw_usrreq.c 180385 2008-07-09 15:48:16Z rwatson $
70,71c70
< raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src,
< struct sockaddr *dst)
---
> raw_input(struct mbuf *m0, struct sockproto *proto, struct sockaddr *src)
85,97d83
< /*
< * We assume the lower level routines have placed the address
< * in a canonical format suitable for a structure comparison.
< *
< * Note that if the lengths are not the same the comparison
< * will fail at the first byte.
< */
< #define equal(a1, a2) \
< (bcmp((caddr_t)(a1), (caddr_t)(a2), a1->sa_len) == 0)
< if (rp->rcb_laddr && !equal(rp->rcb_laddr, dst))
< continue;
< if (rp->rcb_faddr && !equal(rp->rcb_faddr, src))
< continue;
136d121
< struct rawcb *rp = sotorawcb(so);
138,139c123,124
< KASSERT(rp != NULL, ("raw_uabort: rp == NULL"));
< raw_disconnect(rp);
---
> KASSERT(sotorawcb(so) != NULL, ("raw_uabort: rp == NULL"));
>
146d130
< struct rawcb *rp = sotorawcb(so);
148,149c132,133
< KASSERT(rp != NULL, ("raw_uabort: rp == NULL"));
< raw_disconnect(rp);
---
> KASSERT(sotorawcb(so) != NULL, ("raw_uabort: rp == NULL"));
>
162c146
< * so it must be non-NULL here.
---
> * so it must be non-NULL here.
169c153
< return error;
---
> return (error);
171c155
< return raw_attach(so, proto);
---
> return (raw_attach(so, proto));
196a181
>
203d187
< struct rawcb *rp = sotorawcb(so);
205,210c189,191
< KASSERT(rp != NULL, ("raw_udisconnect: rp == NULL"));
< if (rp->rcb_faddr == 0)
< return (ENOTCONN);
< raw_disconnect(rp);
< soisdisconnected(so);
< return (0);
---
> KASSERT(sotorawcb(so) != NULL, ("raw_udisconnect: rp == NULL"));
>
> return (ENOTCONN);
218d198
< struct rawcb *rp = sotorawcb(so);
220,224c200,202
< KASSERT(rp != NULL, ("raw_upeeraddr: rp == NULL"));
< if (rp->rcb_faddr == 0)
< return (ENOTCONN);
< *nam = sodupsockaddr(rp->rcb_faddr, M_WAITOK);
< return (0);
---
> KASSERT(sotorawcb(so) != NULL, ("raw_upeeraddr: rp == NULL"));
>
> return (ENOTCONN);
234,235d211
< int error;
< struct rawcb *rp = sotorawcb(so);
237c213
< KASSERT(rp != NULL, ("raw_usend: rp == NULL"));
---
> KASSERT(sotorawcb(so) != NULL, ("raw_usend: rp == NULL"));
239,241c215,219
< if (flags & PRUS_OOB) {
< error = EOPNOTSUPP;
< goto release;
---
> if ((flags & PRUS_OOB) || (control && control->m_len)) {
> /* XXXRW: Should control also be freed here? */
> if (m != NULL)
> m_freem(m);
> return (EOPNOTSUPP);
244,265c222,226
< if (control && control->m_len) {
< error = EOPNOTSUPP;
< goto release;
< }
< if (nam) {
< if (rp->rcb_faddr) {
< error = EISCONN;
< goto release;
< }
< rp->rcb_faddr = nam;
< } else if (rp->rcb_faddr == 0) {
< error = ENOTCONN;
< goto release;
< }
< error = (*so->so_proto->pr_output)(m, so);
< m = NULL;
< if (nam)
< rp->rcb_faddr = 0;
< release:
< if (m != NULL)
< m_freem(m);
< return (error);
---
> /*
> * For historical (bad?) reasons, we effectively ignore the address
> * argument to sendto(2). Perhaps we should return an error instead?
> */
> return ((*so->so_proto->pr_output)(m, so));
274a236
>
282d243
< struct rawcb *rp = sotorawcb(so);
284,288c245,247
< KASSERT(rp != NULL, ("raw_usockaddr: rp == NULL"));
< if (rp->rcb_laddr == 0)
< return (EINVAL);
< *nam = sodupsockaddr(rp->rcb_laddr, M_WAITOK);
< return (0);
---
> KASSERT(sotorawcb(so) != NULL, ("raw_usockaddr: rp == NULL"));
>
> return (EINVAL);