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.3 retrieving revision 1.7 diff -u -p -r1.3 -r1.7 --- src/sys/netinet/raw_ip.c 1993/05/18 18:20:12 1.3 +++ src/sys/netinet/raw_ip.c 1993/12/18 00:42:00 1.7 @@ -31,27 +31,26 @@ * SUCH DAMAGE. * * from: @(#)raw_ip.c 7.8 (Berkeley) 7/25/90 - * $Id: raw_ip.c,v 1.3 1993/05/18 18:20:12 cgd Exp $ + * $Id: raw_ip.c,v 1.7 1993/12/18 00:42:00 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 /* * Raw interface to IP protocol. @@ -97,9 +96,12 @@ rip_output(m, so) * If the user handed us a complete IP packet, use it. * Otherwise, allocate an mbuf for a header and fill it in. */ - if (rp->rinp_flags & RINPF_HDRINCL) + if (rp->rinp_flags & RINPF_HDRINCL) { ip = mtod(m, struct ip *); - else { + if (ip->ip_len > m->m_pkthdr.len) + return EMSGSIZE; + ip->ip_len = m->m_pkthdr.len; + } else { M_PREPEND(m, sizeof(struct ip), M_WAIT); ip = mtod(m, struct ip *); ip->ip_tos = 0; @@ -117,7 +119,11 @@ rip_output(m, so) 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)); + (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST +#ifdef MULTICAST + | IP_MULTICASTOPTS, rp->rinp_rcb.rcb_moptions +#endif + )); } /* @@ -152,10 +158,27 @@ rip_ctloutput(op, so, level, optname, m) else rp->rinp_flags &= ~RINPF_HDRINCL; break; - +#ifdef MULTICAST + 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; +#else default: error = EINVAL; break; +#endif } break; @@ -176,7 +199,16 @@ rip_ctloutput(op, so, level, optname, m) (*m)->m_len = sizeof (int); *mtod(*m, int *) = rp->rinp_flags & RINPF_HDRINCL; break; - +#ifdef MULTICAST + 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; +#endif default: error = EINVAL; m_freem(*m); @@ -198,7 +230,9 @@ rip_usrreq(so, req, m, nam, control) { register int error = 0; register struct raw_inpcb *rp = sotorawinpcb(so); - +#if defined(MULTICAST) && defined(MROUTING) + extern struct socket *ip_mrouter; +#endif switch (req) { case PRU_ATTACH: @@ -214,8 +248,16 @@ rip_usrreq(so, req, m, nam, control) case PRU_DETACH: if (rp == 0) panic("rip_detach"); +#if defined(MULTICAST) && defined(MROUTING) + if (so == ip_mrouter) + ip_mrouter_done(); +#endif if (rp->rinp_options) m_freem(rp->rinp_options); +#ifdef MULTICAST + if (rp->rinp_rcb.rcb_moptions) + ip_freemoptions(rp->rinp_rcb.rcb_moptions); +#endif if (rp->rinp_route.ro_rt) RTFREE(rp->rinp_route.ro_rt); if (rp->rinp_rcb.rcb_laddr)