Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/netinet/raw_ip.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/netinet/raw_ip.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.4 retrieving revision 1.12 diff -u -p -r1.4 -r1.12 --- src/sys/netinet/raw_ip.c 1993/05/21 05:27:15 1.4 +++ src/sys/netinet/raw_ip.c 1994/02/10 18:46:05 1.12 @@ -31,40 +31,41 @@ * SUCH DAMAGE. * * from: @(#)raw_ip.c 7.8 (Berkeley) 7/25/90 - * $Id: raw_ip.c,v 1.4 1993/05/21 05:27:15 cgd Exp $ + * $Id: raw_ip.c,v 1.12 1994/02/10 18:46:05 mycroft Exp $ */ -#include "param.h" -#include "malloc.h" -#include "select.h" -#include "mbuf.h" -#include "socket.h" -#include "protosw.h" -#include "socketvar.h" -#include "errno.h" - -#include "../net/if.h" -#include "../net/route.h" -#include "../net/raw_cb.h" - -#include "in.h" -#include "in_systm.h" -#include "ip.h" -#include "ip_var.h" -#include "in_pcb.h" +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include /* * Raw interface to IP protocol. */ - struct sockaddr_in ripdst = { sizeof(ripdst), AF_INET }; struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; struct sockproto ripproto = { PF_INET }; + /* * Setup generic address and protocol structures * for raw_input routine, then pass them along with * mbuf chain. */ +void rip_input(m) struct mbuf *m; { @@ -85,6 +86,7 @@ rip_input(m) * Tack on options user may have setup with control call. */ #define satosin(sa) ((struct sockaddr_in *)(sa)) +int rip_output(m, so) register struct mbuf *m; struct socket *so; @@ -92,6 +94,7 @@ rip_output(m, so) register struct ip *ip; register struct raw_inpcb *rp = sotorawinpcb(so); register struct sockaddr_in *sin; + struct mbuf *opts; /* * If the user handed us a complete IP packet, use it. @@ -102,6 +105,7 @@ rip_output(m, so) if (ip->ip_len > m->m_pkthdr.len) return EMSGSIZE; ip->ip_len = m->m_pkthdr.len; + opts = NULL; } else { M_PREPEND(m, sizeof(struct ip), M_WAIT); ip = mtod(m, struct ip *); @@ -116,16 +120,17 @@ rip_output(m, so) if (sin = satosin(rp->rinp_rcb.rcb_faddr)) ip->ip_dst = sin->sin_addr; ip->ip_ttl = MAXTTL; + opts = rp->rinp_options; } - return (ip_output(m, - (rp->rinp_flags & RINPF_HDRINCL)? (struct mbuf *)0: rp->rinp_options, - &rp->rinp_route, - (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST)); + return (ip_output(m, opts, &rp->rinp_route, + (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST, + rp->rinp_rcb.rcb_moptions)); } /* * Raw IP socket option processing. */ +int rip_ctloutput(op, so, level, optname, m) int op; struct socket *so; @@ -155,9 +160,20 @@ rip_ctloutput(op, so, level, optname, m) else rp->rinp_flags &= ~RINPF_HDRINCL; break; - + case IP_MULTICAST_IF: + case IP_MULTICAST_TTL: + case IP_MULTICAST_LOOP: + case IP_ADD_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: + error = ip_setmoptions(optname, + &rp->rinp_rcb.rcb_moptions, *m); + break; default: +#ifdef MROUTING + error = ip_mrouter_cmd(optname, so, *m); +#else error = EINVAL; +#endif break; } break; @@ -179,7 +195,14 @@ rip_ctloutput(op, so, level, optname, m) (*m)->m_len = sizeof (int); *mtod(*m, int *) = rp->rinp_flags & RINPF_HDRINCL; break; - + case IP_MULTICAST_IF: + case IP_MULTICAST_TTL: + case IP_MULTICAST_LOOP: + case IP_ADD_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: + error = ip_getmoptions(optname, + rp->rinp_rcb.rcb_moptions, m); + break; default: error = EINVAL; m_freem(*m); @@ -194,6 +217,7 @@ rip_ctloutput(op, so, level, optname, m) } /*ARGSUSED*/ +int rip_usrreq(so, req, m, nam, control) register struct socket *so; int req; @@ -201,7 +225,9 @@ rip_usrreq(so, req, m, nam, control) { register int error = 0; register struct raw_inpcb *rp = sotorawinpcb(so); - +#if defined(MROUTING) + extern struct socket *ip_mrouter; +#endif switch (req) { case PRU_ATTACH: @@ -217,8 +243,14 @@ rip_usrreq(so, req, m, nam, control) case PRU_DETACH: if (rp == 0) panic("rip_detach"); +#if defined(MROUTING) + if (so == ip_mrouter) + ip_mrouter_done(); +#endif if (rp->rinp_options) m_freem(rp->rinp_options); + if (rp->rinp_rcb.rcb_moptions) + ip_freemoptions(rp->rinp_rcb.rcb_moptions); if (rp->rinp_route.ro_rt) RTFREE(rp->rinp_route.ro_rt); if (rp->rinp_rcb.rcb_laddr)