version 1.33, 1996/09/15 18:11:08 |
version 1.36, 1997/01/11 05:21:13 |
Line 100 rip_input(m, va_alist) |
|
Line 100 rip_input(m, va_alist) |
|
{ |
{ |
register struct ip *ip = mtod(m, struct ip *); |
register struct ip *ip = mtod(m, struct ip *); |
register struct inpcb *inp; |
register struct inpcb *inp; |
struct socket *last = 0; |
struct inpcb *last = 0; |
|
struct mbuf *opts = 0; |
struct sockaddr_in ripsrc; |
struct sockaddr_in ripsrc; |
|
|
ripsrc.sin_family = AF_INET; |
ripsrc.sin_family = AF_INET; |
ripsrc.sin_len = sizeof(struct sockaddr_in); |
ripsrc.sin_len = sizeof(struct sockaddr_in); |
ripsrc.sin_addr = ip->ip_src; |
ripsrc.sin_addr = ip->ip_src; |
|
ripsrc.sin_port = 0; |
|
bzero((caddr_t)ripsrc.sin_zero, sizeof(ripsrc.sin_zero)); |
|
|
for (inp = rawcbtable.inpt_queue.cqh_first; |
for (inp = rawcbtable.inpt_queue.cqh_first; |
inp != (struct inpcb *)&rawcbtable.inpt_queue; |
inp != (struct inpcb *)&rawcbtable.inpt_queue; |
Line 121 rip_input(m, va_alist) |
|
Line 124 rip_input(m, va_alist) |
|
if (last) { |
if (last) { |
struct mbuf *n; |
struct mbuf *n; |
if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { |
if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { |
if (sbappendaddr(&last->so_rcv, |
if (last->inp_flags & INP_CONTROLOPTS || |
sintosa(&ripsrc), n, |
last->inp_socket->so_options & SO_TIMESTAMP) |
(struct mbuf *)0) == 0) |
ip_savecontrol(last, &opts, ip, n); |
|
if (sbappendaddr(&last->inp_socket->so_rcv, |
|
sintosa(&ripsrc), n, opts) == 0) { |
/* should notify about lost packet */ |
/* should notify about lost packet */ |
m_freem(n); |
m_freem(n); |
else |
if (opts) |
sorwakeup(last); |
m_freem(opts); |
|
} else |
|
sorwakeup(last->inp_socket); |
} |
} |
} |
} |
last = inp->inp_socket; |
last = inp; |
} |
} |
if (last) { |
if (last) { |
if (sbappendaddr(&last->so_rcv, sintosa(&ripsrc), m, |
if (last->inp_flags & INP_CONTROLOPTS || |
(struct mbuf *)0) == 0) |
last->inp_socket->so_options & SO_TIMESTAMP) |
|
ip_savecontrol(last, &opts, ip, m); |
|
if (sbappendaddr(&last->inp_socket->so_rcv, |
|
sintosa(&ripsrc), m, opts) == 0) { |
m_freem(m); |
m_freem(m); |
else |
if (opts) |
sorwakeup(last); |
m_freem(opts); |
|
} else |
|
sorwakeup(last->inp_socket); |
} else { |
} else { |
m_freem(m); |
m_freem(m); |
ipstat.ips_noproto++; |
ipstat.ips_noproto++; |
Line 176 rip_output(m, va_alist) |
|
Line 188 rip_output(m, va_alist) |
|
* Otherwise, allocate an mbuf for a header and fill it in. |
* Otherwise, allocate an mbuf for a header and fill it in. |
*/ |
*/ |
if ((inp->inp_flags & INP_HDRINCL) == 0) { |
if ((inp->inp_flags & INP_HDRINCL) == 0) { |
|
if ((m->m_pkthdr.len + sizeof(struct ip)) > IP_MAXPACKET) { |
|
m_freem(m); |
|
return (EMSGSIZE); |
|
} |
M_PREPEND(m, sizeof(struct ip), M_WAIT); |
M_PREPEND(m, sizeof(struct ip), M_WAIT); |
ip = mtod(m, struct ip *); |
ip = mtod(m, struct ip *); |
ip->ip_tos = 0; |
ip->ip_tos = 0; |
Line 187 rip_output(m, va_alist) |
|
Line 203 rip_output(m, va_alist) |
|
ip->ip_ttl = MAXTTL; |
ip->ip_ttl = MAXTTL; |
opts = inp->inp_options; |
opts = inp->inp_options; |
} else { |
} else { |
|
if (m->m_pkthdr.len > IP_MAXPACKET) { |
|
m_freem(m); |
|
return (EMSGSIZE); |
|
} |
ip = mtod(m, struct ip *); |
ip = mtod(m, struct ip *); |
if (ip->ip_id == 0) |
if (ip->ip_id == 0) |
ip->ip_id = htons(ip_id++); |
ip->ip_id = htons(ip_id++); |