raw_ip.c (169179) | raw_ip.c (169454) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 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 --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 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 --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 |
30 * $FreeBSD: head/sys/netinet/raw_ip.c 169179 2007-05-01 16:31:02Z rwatson $ | 30 * $FreeBSD: head/sys/netinet/raw_ip.c 169454 2007-05-10 15:58:48Z rwatson $ |
31 */ 32 33#include "opt_inet6.h" 34#include "opt_ipsec.h" 35#include "opt_mac.h" 36 37#include <sys/param.h> 38#include <sys/jail.h> --- 85 unchanged lines hidden (view full) --- 124{ 125 struct inpcb *inp = mem; 126 127 INP_LOCK_INIT(inp, "inp", "rawinp"); 128 return (0); 129} 130 131void | 31 */ 32 33#include "opt_inet6.h" 34#include "opt_ipsec.h" 35#include "opt_mac.h" 36 37#include <sys/param.h> 38#include <sys/jail.h> --- 85 unchanged lines hidden (view full) --- 124{ 125 struct inpcb *inp = mem; 126 127 INP_LOCK_INIT(inp, "inp", "rawinp"); 128 return (0); 129} 130 131void |
132rip_init() | 132rip_init(void) |
133{ | 133{ |
134 |
|
134 INP_INFO_LOCK_INIT(&ripcbinfo, "rip"); 135 LIST_INIT(&ripcb); 136 ripcbinfo.ipi_listhead = &ripcb; 137 /* 138 * XXX We don't use the hash list for raw IP, but it's easier 139 * to allocate a one entry hash list than it is to check all 140 * over the place for hashbase == NULL. 141 */ --- 643 unchanged lines hidden (view full) --- 785 INP_LOCK(inp); 786 socantsendmore(so); 787 INP_UNLOCK(inp); 788 return 0; 789} 790 791static int 792rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, | 135 INP_INFO_LOCK_INIT(&ripcbinfo, "rip"); 136 LIST_INIT(&ripcb); 137 ripcbinfo.ipi_listhead = &ripcb; 138 /* 139 * XXX We don't use the hash list for raw IP, but it's easier 140 * to allocate a one entry hash list than it is to check all 141 * over the place for hashbase == NULL. 142 */ --- 643 unchanged lines hidden (view full) --- 786 INP_LOCK(inp); 787 socantsendmore(so); 788 INP_UNLOCK(inp); 789 return 0; 790} 791 792static int 793rip_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, |
793 struct mbuf *control, struct thread *td) | 794 struct mbuf *control, struct thread *td) |
794{ 795 struct inpcb *inp; 796 u_long dst; 797 798 inp = sotoinpcb(so); 799 KASSERT(inp != NULL, ("rip_send: inp == NULL")); 800 /* 801 * Note: 'dst' reads below are unlocked. --- 108 unchanged lines hidden (view full) --- 910 911/* 912 * This is the wrapper function for in_setsockaddr. We just pass down 913 * the pcbinfo for in_setpeeraddr to lock. 914 */ 915static int 916rip_sockaddr(struct socket *so, struct sockaddr **nam) 917{ | 795{ 796 struct inpcb *inp; 797 u_long dst; 798 799 inp = sotoinpcb(so); 800 KASSERT(inp != NULL, ("rip_send: inp == NULL")); 801 /* 802 * Note: 'dst' reads below are unlocked. --- 108 unchanged lines hidden (view full) --- 911 912/* 913 * This is the wrapper function for in_setsockaddr. We just pass down 914 * the pcbinfo for in_setpeeraddr to lock. 915 */ 916static int 917rip_sockaddr(struct socket *so, struct sockaddr **nam) 918{ |
919 |
|
918 return (in_setsockaddr(so, nam)); 919} 920 921/* 922 * This is the wrapper function for in_setpeeraddr. We just pass down 923 * the pcbinfo for in_setpeeraddr to lock. 924 */ 925static int 926rip_peeraddr(struct socket *so, struct sockaddr **nam) 927{ | 920 return (in_setsockaddr(so, nam)); 921} 922 923/* 924 * This is the wrapper function for in_setpeeraddr. We just pass down 925 * the pcbinfo for in_setpeeraddr to lock. 926 */ 927static int 928rip_peeraddr(struct socket *so, struct sockaddr **nam) 929{ |
930 |
|
928 return (in_setpeeraddr(so, nam)); 929} 930 931 932SYSCTL_PROC(_net_inet_raw, OID_AUTO/*XXX*/, pcblist, CTLFLAG_RD, 0, 0, 933 rip_pcblist, "S,xinpcb", "List of active raw IP sockets"); 934 935struct pr_usrreqs rip_usrreqs = { --- 14 unchanged lines hidden --- | 931 return (in_setpeeraddr(so, nam)); 932} 933 934 935SYSCTL_PROC(_net_inet_raw, OID_AUTO/*XXX*/, pcblist, CTLFLAG_RD, 0, 0, 936 rip_pcblist, "S,xinpcb", "List of active raw IP sockets"); 937 938struct pr_usrreqs rip_usrreqs = { --- 14 unchanged lines hidden --- |