raw_ip.c (072b9b24e39abc64ec3519786e7a7cc100db0a82) raw_ip.c (e62b8c49396804bfac15dee17cf826a36041ef39)
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

--- 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 * @(#)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

--- 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 * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
34 * $Id: raw_ip.c,v 1.28 1996/03/11 15:13:24 davidg Exp $
34 * $Id: raw_ip.c,v 1.29 1996/03/13 08:02:45 pst Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/queue.h>
39#include <sys/malloc.h>
40#include <sys/mbuf.h>
41#include <sys/socket.h>
42#include <sys/protosw.h>

--- 45 unchanged lines hidden (view full) ---

88
89static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };
90/*
91 * Setup generic address and protocol structures
92 * for raw_input routine, then pass them along with
93 * mbuf chain.
94 */
95void
35 */
36
37#include <sys/param.h>
38#include <sys/queue.h>
39#include <sys/malloc.h>
40#include <sys/mbuf.h>
41#include <sys/socket.h>
42#include <sys/protosw.h>

--- 45 unchanged lines hidden (view full) ---

88
89static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };
90/*
91 * Setup generic address and protocol structures
92 * for raw_input routine, then pass them along with
93 * mbuf chain.
94 */
95void
96rip_input(m)
96rip_input(m, iphlen)
97 struct mbuf *m;
97 struct mbuf *m;
98 int iphlen;
98{
99 register struct ip *ip = mtod(m, struct ip *);
100 register struct inpcb *inp;
101 struct socket *last = 0;
102
103 ripsrc.sin_addr = ip->ip_src;
104 for (inp = ripcb.lh_first; inp != NULL; inp = inp->inp_list.le_next) {
105 if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p)

--- 38 unchanged lines hidden (view full) ---

144int
145rip_output(m, so, dst)
146 register struct mbuf *m;
147 struct socket *so;
148 u_long dst;
149{
150 register struct ip *ip;
151 register struct inpcb *inp = sotoinpcb(so);
99{
100 register struct ip *ip = mtod(m, struct ip *);
101 register struct inpcb *inp;
102 struct socket *last = 0;
103
104 ripsrc.sin_addr = ip->ip_src;
105 for (inp = ripcb.lh_first; inp != NULL; inp = inp->inp_list.le_next) {
106 if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p)

--- 38 unchanged lines hidden (view full) ---

145int
146rip_output(m, so, dst)
147 register struct mbuf *m;
148 struct socket *so;
149 u_long dst;
150{
151 register struct ip *ip;
152 register struct inpcb *inp = sotoinpcb(so);
152 struct mbuf *opts;
153 int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
154
155 /*
156 * If the user handed us a complete IP packet, use it.
157 * Otherwise, allocate an mbuf for a header and fill it in.
158 */
159 if ((inp->inp_flags & INP_HDRINCL) == 0) {
160 M_PREPEND(m, sizeof(struct ip), M_WAIT);

--- 282 unchanged lines hidden ---
153 int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST;
154
155 /*
156 * If the user handed us a complete IP packet, use it.
157 * Otherwise, allocate an mbuf for a header and fill it in.
158 */
159 if ((inp->inp_flags & INP_HDRINCL) == 0) {
160 M_PREPEND(m, sizeof(struct ip), M_WAIT);

--- 282 unchanged lines hidden ---