version 1.22, 1995/11/30 16:42:18 |
version 1.25.4.1, 1996/11/10 21:57:53 |
|
|
#include <netinet/ip_var.h> |
#include <netinet/ip_var.h> |
#include <netinet/ip_mroute.h> |
#include <netinet/ip_mroute.h> |
#include <netinet/in_pcb.h> |
#include <netinet/in_pcb.h> |
|
#include <netinet/in_var.h> |
|
|
|
#include <machine/stdarg.h> |
|
|
struct inpcbtable rawcbtable; |
struct inpcbtable rawcbtable; |
|
|
|
|
rip_init() |
rip_init() |
{ |
{ |
|
|
in_pcbinit(&rawcbtable); |
in_pcbinit(&rawcbtable, 1); |
} |
} |
|
|
struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; |
struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; |
Line 83 struct sockaddr_in ripsrc = { sizeof(rip |
|
Line 86 struct sockaddr_in ripsrc = { sizeof(rip |
|
* mbuf chain. |
* mbuf chain. |
*/ |
*/ |
void |
void |
rip_input(m) |
#if __STDC__ |
|
rip_input(struct mbuf *m, ...) |
|
#else |
|
rip_input(m, va_alist) |
struct mbuf *m; |
struct mbuf *m; |
|
va_dcl |
|
#endif |
{ |
{ |
register struct ip *ip = mtod(m, struct ip *); |
register struct ip *ip = mtod(m, struct ip *); |
register struct inpcb *inp; |
register struct inpcb *inp; |
|
|
continue; |
continue; |
if (last) { |
if (last) { |
struct mbuf *n; |
struct mbuf *n; |
if (n = m_copy(m, 0, (int)M_COPYALL)) { |
if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { |
if (sbappendaddr(&last->so_rcv, |
if (sbappendaddr(&last->so_rcv, |
sintosa(&ripsrc), n, |
sintosa(&ripsrc), n, |
(struct mbuf *)0) == 0) |
(struct mbuf *)0) == 0) |
|
|
* Tack on options user may have setup with control call. |
* Tack on options user may have setup with control call. |
*/ |
*/ |
int |
int |
rip_output(m, so, dst) |
#if __STDC__ |
register struct mbuf *m; |
rip_output(struct mbuf *m, ...) |
|
#else |
|
rip_output(m, va_alist) |
|
struct mbuf *m; |
|
va_dcl |
|
#endif |
|
{ |
struct socket *so; |
struct socket *so; |
u_long dst; |
u_long dst; |
{ |
|
register struct ip *ip; |
register struct ip *ip; |
register struct inpcb *inp = sotoinpcb(so); |
register struct inpcb *inp; |
struct mbuf *opts; |
struct mbuf *opts; |
int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST; |
int flags; |
|
va_list ap; |
|
|
|
va_start(ap, m); |
|
so = va_arg(ap, struct socket *); |
|
dst = va_arg(ap, u_long); |
|
va_end(ap); |
|
|
|
inp = sotoinpcb(so); |
|
flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST; |
|
|
/* |
/* |
* If the user handed us a complete IP packet, use it. |
* If the user handed us a complete IP packet, use it. |
* 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 160 rip_output(m, so, dst) |
|
Line 186 rip_output(m, so, dst) |
|
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++); |
Line 182 rip_ctloutput(op, so, level, optname, m) |
|
Line 212 rip_ctloutput(op, so, level, optname, m) |
|
struct mbuf **m; |
struct mbuf **m; |
{ |
{ |
register struct inpcb *inp = sotoinpcb(so); |
register struct inpcb *inp = sotoinpcb(so); |
register int error; |
#ifdef MROUTING |
|
int error; |
|
#endif |
|
|
if (level != IPPROTO_IP) { |
if (level != IPPROTO_IP) { |
if (m != 0 && *m != 0) |
if (m != 0 && *m != 0) |