SCCS-vsn: sys/net/raw_cb.c 4.8
SCCS-vsn: sys/deprecated/netimp/raw_imp.c 4.11
SCCS-vsn: sys/netinet/raw_ip.c 4.11
SCCS-vsn: sys/net/raw_usrreq.c 4.14
-/* raw_imp.c 4.10 82/04/10 */
+/* raw_imp.c 4.11 82/04/11 */
#include "../h/param.h"
#include "../h/mbuf.h"
#include "../h/param.h"
#include "../h/mbuf.h"
len += n->m_len;
ip->il_length = htons((u_short)(len << 3));
sin = (struct sockaddr_in *)&rp->rcb_faddr;
len += n->m_len;
ip->il_length = htons((u_short)(len << 3));
sin = (struct sockaddr_in *)&rp->rcb_faddr;
ip->il_network = sin->sin_addr.s_net;
ip->il_network = sin->sin_addr.s_net;
+#else
+ ip->il_network = 0;
+#endif
ip->il_host = sin->sin_addr.s_host;
ip->il_imp = sin->sin_addr.s_imp;
/* no routing here */
ip->il_host = sin->sin_addr.s_host;
ip->il_imp = sin->sin_addr.s_imp;
/* no routing here */
- ifp = if_ifonnetof(ip->il_network);
+ ifp = if_ifonnetof(sin->sin_addr.s_net);
if (ifp)
return (impoutput(ifp, m, (struct sockaddr *)sin));
error = ENETUNREACH;
if (ifp)
return (impoutput(ifp, m, (struct sockaddr *)sin));
error = ENETUNREACH;
-/* raw_cb.c 4.7 82/04/10 */
+/* raw_cb.c 4.8 82/04/11 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
insque(rp, &rawcb);
so->so_pcb = (caddr_t)rp;
rp->rcb_pcb = 0;
insque(rp, &rawcb);
so->so_pcb = (caddr_t)rp;
rp->rcb_pcb = 0;
bcopy((caddr_t)addr, (caddr_t)&rp->rcb_laddr, sizeof(*addr));
bcopy((caddr_t)addr, (caddr_t)&rp->rcb_laddr, sizeof(*addr));
- rp->rcb_flags |= RAW_LADDR;
+ rp->rcb_flags |= RAW_LADDR;
+ }
return (0);
bad2:
sbrelease(&so->so_snd);
return (0);
bad2:
sbrelease(&so->so_snd);
-/* raw_usrreq.c 4.13 82/04/10 */
+/* raw_usrreq.c 4.14 82/04/11 */
#include "../h/param.h"
#include "../h/mbuf.h"
#include "../h/param.h"
#include "../h/mbuf.h"
/*
* Raw protocol interface.
*/
/*
* Raw protocol interface.
*/
-raw_input(m0, proto, dst, src)
+raw_input(m0, proto, src, dst)
struct mbuf *m0;
struct sockproto *proto;
struct mbuf *m0;
struct sockproto *proto;
- struct sockaddr *dst, *src;
+ struct sockaddr *src, *dst;
{
register struct mbuf *m;
struct raw_header *rh;
{
register struct mbuf *m;
struct raw_header *rh;
int s;
struct mbuf *m;
register struct rawcb *rp;
int s;
struct mbuf *m;
register struct rawcb *rp;
- register struct sockaddr *laddr;
register struct protosw *lproto;
register struct protosw *lproto;
+ register struct raw_header *rh;
struct socket *last;
COUNT(RAWINTR);
struct socket *last;
COUNT(RAWINTR);
if (m == 0)
return;
rh = mtod(m, struct raw_header *);
if (m == 0)
return;
rh = mtod(m, struct raw_header *);
-
- /*
- * Find the appropriate socket(s) in which to place this
- * packet. This is done by matching the protocol and
- * address information prepended by raw_input against
- * the info stored in the control block structures.
- */
last = 0;
for (rp = rawcb.rcb_next; rp != &rawcb; rp = rp->rcb_next) {
lproto = rp->rcb_socket->so_proto;
last = 0;
for (rp = rawcb.rcb_next; rp != &rawcb; rp = rp->rcb_next) {
lproto = rp->rcb_socket->so_proto;
if (lproto->pr_protocol &&
lproto->pr_protocol != rh->raw_proto.sp_protocol)
continue;
if (lproto->pr_protocol &&
lproto->pr_protocol != rh->raw_proto.sp_protocol)
continue;
- laddr = &rp->rcb_laddr;
- if (laddr->sa_family &&
- laddr->sa_family != rh->raw_dst.sa_family)
- continue;
/*
* We assume the lower level routines have
* placed the address in a canonical format
* suitable for a structure comparison.
*/
/*
* We assume the lower level routines have
* placed the address in a canonical format
* suitable for a structure comparison.
*/
+#define equal(a1, a2) \
+ (bcmp((caddr_t)&(a1), (caddr_t)&(a2), sizeof (struct sockaddr)) == 0)
if ((rp->rcb_flags & RAW_LADDR) &&
if ((rp->rcb_flags & RAW_LADDR) &&
- bcmp(laddr->sa_data, rh->raw_dst.sa_data, 14) != 0)
+ !equal(rp->rcb_laddr, rh->raw_dst))
continue;
if ((rp->rcb_flags & RAW_FADDR) &&
continue;
if ((rp->rcb_flags & RAW_FADDR) &&
- bcmp(rp->rcb_faddr.sa_data, rh->raw_src.sa_data, 14) != 0)
+ !equal(rp->rcb_faddr, rh->raw_src))
- /*
- * To avoid extraneous packet copies, we keep
- * track of the last socket the packet should be
- * placed in, and make copies only after finding a
- * socket which "collides".
- */
if (last) {
struct mbuf *n;
if (last) {
struct mbuf *n;
if (n = m_copy(m->m_next, 0, (int)M_COPYALL))
goto nospace;
if (sbappendaddr(&last->so_rcv, &rh->raw_src, n)==0) {
if (n = m_copy(m->m_next, 0, (int)M_COPYALL))
goto nospace;
if (sbappendaddr(&last->so_rcv, &rh->raw_src, n)==0) {
-/* raw_ip.c 4.10 82/04/10 */
+/* raw_ip.c 4.11 82/04/11 */
#include "../h/param.h"
#include "../h/mbuf.h"
#include "../h/param.h"
#include "../h/mbuf.h"
ripproto.sp_protocol = ip->ip_p;
ripdst.sin_addr = ip->ip_dst;
ripsrc.sin_addr = ip->ip_src;
ripproto.sp_protocol = ip->ip_p;
ripdst.sin_addr = ip->ip_dst;
ripsrc.sin_addr = ip->ip_src;
- raw_input(m, &ripproto, (struct sockaddr *)&ripdst,
- (struct sockaddr *)&ripsrc);
+ raw_input(m, &ripproto, (struct sockaddr *)&ripsrc,
+ (struct sockaddr *)&ripdst);