rtsock.c (108277) | rtsock.c (109623) |
---|---|
1/* 2 * Copyright (c) 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 | 1/* 2 * Copyright (c) 1988, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)rtsock.c 8.7 (Berkeley) 10/12/95 |
34 * $FreeBSD: head/sys/net/rtsock.c 108277 2002-12-26 03:35:57Z hsu $ | 34 * $FreeBSD: head/sys/net/rtsock.c 109623 2003-01-21 08:56:16Z alfred $ |
35 */ 36 37 38#include <sys/param.h> 39#include <sys/domain.h> 40#include <sys/kernel.h> 41#include <sys/jail.h> 42#include <sys/malloc.h> --- 62 unchanged lines hidden (view full) --- 105rts_attach(struct socket *so, int proto, struct thread *td) 106{ 107 struct rawcb *rp; 108 int s, error; 109 110 if (sotorawcb(so) != 0) 111 return EISCONN; /* XXX panic? */ 112 /* XXX */ | 35 */ 36 37 38#include <sys/param.h> 39#include <sys/domain.h> 40#include <sys/kernel.h> 41#include <sys/jail.h> 42#include <sys/malloc.h> --- 62 unchanged lines hidden (view full) --- 105rts_attach(struct socket *so, int proto, struct thread *td) 106{ 107 struct rawcb *rp; 108 int s, error; 109 110 if (sotorawcb(so) != 0) 111 return EISCONN; /* XXX panic? */ 112 /* XXX */ |
113 MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK | M_ZERO); | 113 MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_ZERO); |
114 if (rp == 0) 115 return ENOBUFS; 116 117 /* 118 * The splnet() is necessary to block protocols from sending 119 * error notifications (like RTM_REDIRECT or RTM_LOSING) while 120 * this PCB is extant but incompletely initialized. 121 * Probably we should try to do more of this work beforehand and --- 481 unchanged lines hidden (view full) --- 603 len = sizeof(struct if_announcemsghdr); 604 break; 605 606 default: 607 len = sizeof(struct rt_msghdr); 608 } 609 if (len > MCLBYTES) 610 panic("rt_msg1"); | 114 if (rp == 0) 115 return ENOBUFS; 116 117 /* 118 * The splnet() is necessary to block protocols from sending 119 * error notifications (like RTM_REDIRECT or RTM_LOSING) while 120 * this PCB is extant but incompletely initialized. 121 * Probably we should try to do more of this work beforehand and --- 481 unchanged lines hidden (view full) --- 603 len = sizeof(struct if_announcemsghdr); 604 break; 605 606 default: 607 len = sizeof(struct rt_msghdr); 608 } 609 if (len > MCLBYTES) 610 panic("rt_msg1"); |
611 m = m_gethdr(M_DONTWAIT, MT_DATA); | 611 m = m_gethdr(M_NOWAIT, MT_DATA); |
612 if (m && len > MHLEN) { | 612 if (m && len > MHLEN) { |
613 MCLGET(m, M_DONTWAIT); | 613 MCLGET(m, M_NOWAIT); |
614 if ((m->m_flags & M_EXT) == 0) { 615 m_free(m); 616 m = NULL; 617 } 618 } 619 if (m == 0) 620 return (m); 621 m->m_pkthdr.len = m->m_len = len; --- 462 unchanged lines hidden --- | 614 if ((m->m_flags & M_EXT) == 0) { 615 m_free(m); 616 m = NULL; 617 } 618 } 619 if (m == 0) 620 return (m); 621 m->m_pkthdr.len = m->m_len = len; --- 462 unchanged lines hidden --- |