-
-/*
- * Intercept connects and sends to verify interface
- * exists for destination address. Disconnects are
- * also looked at to insure pointer is invalidated.
- */
-rawpup_usrreq(so, req, m, addr)
- struct socket *so;
- int req;
- struct mbuf *m;
- caddr_t addr;
-{
- register struct rawcb *rp = sotorawcb(so);
-
-COUNT(RAWPUP_USRREQ);
- if (rp == 0 && req != PRU_ATTACH)
- return (EINVAL);
-
- switch (req) {
-
- /*
- * Verify address has an interface to go with it
- * and record information for use in output routine.
- */
- case PRU_SEND:
- case PRU_CONNECT: {
- register struct sockaddr_pup *spup;
- register struct ifnet *ifp;
-
- spup = (struct sockaddr_pup *)addr;
- ifp = if_ifonnetof(spup->spup_addr);
- if (ifp == 0) {
- ifp = if_gatewayfor(spup->spup_addr);
- if (ifp == 0)
- return (EADDRNOTAVAIL); /* XXX */
- }
- rp->rcb_pcb = (caddr_t)ifp;
- break;
- }
-
- case PRU_DISCONNECT:
- rp->rcb_pcb = 0;
- break;
-
- case PRU_CONTROL:
- return (EOPNOTSUPP);
- }
- return (raw_usrreq(so, req, m, addr));
-}