Deleted Added
sdiff udiff text old ( 24659 ) new ( 25345 )
full compact
1/*
2 * Copyright (c) 1995, Mike Mitchell
3 * Copyright (c) 1984, 1985, 1986, 1987, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 19 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)ipx_usrreq.c
35 *
36 * $Id: ipx_usrreq.c,v 1.11 1997/02/22 09:41:57 peter Exp $
37 */
38
39#include <sys/param.h>
40#include <sys/queue.h>
41#include <sys/systm.h>
42#include <sys/kernel.h>
43#include <sys/malloc.h>
44#include <sys/mbuf.h>
45#include <sys/protosw.h>
46#include <sys/socket.h>
47#include <sys/socketvar.h>
48#include <sys/errno.h>
49#include <sys/stat.h>
50#include <sys/sysctl.h>
51
52#include <net/if.h>

--- 17 unchanged lines hidden (view full) ---

70int ipxsendspace = IPXSNDQ;
71SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxsendspace, CTLFLAG_RW,
72 &ipxsendspace, 0, "");
73int ipxrecvspace = IPXRCVQ;
74SYSCTL_INT(_net_ipx_ipx, OID_AUTO, ipxrecvspace, CTLFLAG_RW,
75 &ipxrecvspace, 0, "");
76
77static int ipx_usr_abort(struct socket *so);
78static int ipx_attach(struct socket *so, int proto);
79static int ipx_bind(struct socket *so, struct mbuf *nam);
80static int ipx_connect(struct socket *so, struct mbuf *nam);
81static int ipx_detach(struct socket *so);
82static int ipx_disconnect(struct socket *so);
83static int ipx_send(struct socket *so, int flags, struct mbuf *m,
84 struct mbuf *addr, struct mbuf *control);
85static int ipx_shutdown(struct socket *so);
86static int ripx_attach(struct socket *so, int proto);
87
88struct pr_usrreqs ipx_usrreqs = {
89 ipx_usr_abort, pru_accept_notsupp, ipx_attach, ipx_bind,
90 ipx_connect, pru_connect2_notsupp, ipx_control, ipx_detach,
91 ipx_disconnect, pru_listen_notsupp, ipx_peeraddr, pru_rcvd_notsupp,
92 pru_rcvoob_notsupp, ipx_send, pru_sense_null, ipx_shutdown,
93 ipx_sockaddr
94};

--- 212 unchanged lines hidden (view full) ---

307#endif /* ancient_history */
308 if (noipxRoute)
309 ro = 0;
310 return (ipx_outputfl(m, ro, so->so_options & SO_BROADCAST));
311}
312
313/* ARGSUSED */
314int
315ipx_ctloutput(req, so, level, name, value)
316 int req, level;
317 struct socket *so;
318 int name;
319 struct mbuf **value;
320{
321 register struct mbuf *m;
322 struct ipxpcb *ipxp = sotoipxpcb(so);
323 int mask, error = 0;
324 /*extern long ipx_pexseq;*/ /*XXX*//*JRE*/
325
326 if (ipxp == NULL)
327 return (EINVAL);

--- 75 unchanged lines hidden (view full) ---

403 {
404 register struct ipx *ipx
405 = mtod(*value, struct ipx *);
406 ipxp->ipxp_dpt = ipx->ipx_pt;
407 }
408 break;
409#ifdef IPXIP
410 case SO_IPXIP_ROUTE:
411 error = ipxip_route(so, *value);
412 break;
413#endif /* IPXIP */
414#ifdef IPXTUNNEL
415 case SO_IPXTUNNEL_ROUTE
416 error = ipxtun_route(so, *value);
417 break;
418#endif
419 default:
420 error = EINVAL;
421 }
422 if (value && *value)
423 m_freem(*value);
424 break;

--- 12 unchanged lines hidden (view full) ---

437 ipx_pcbdetach(ipxp);
438 splx(s);
439 sofree(so);
440 soisdisconnected(so);
441 return (0);
442}
443
444static int
445ipx_attach(so, proto)
446 struct socket *so;
447 int proto;
448{
449 int error;
450 int s;
451 struct ipxpcb *ipxp = sotoipxpcb(so);
452
453 if (ipxp != NULL)
454 return (EINVAL);
455 s = splnet();
456 error = ipx_pcballoc(so, &ipxpcb);
457 splx(s);
458 if (error == 0)
459 error = soreserve(so, ipxsendspace, ipxrecvspace);
460 return (error);
461}
462
463static int
464ipx_bind(so, nam)
465 struct socket *so;
466 struct mbuf *nam;
467{
468 struct ipxpcb *ipxp = sotoipxpcb(so);
469
470 return (ipx_pcbbind(ipxp, nam));
471}
472
473static int
474ipx_connect(so, nam)
475 struct socket *so;
476 struct mbuf *nam;
477{
478 int error;
479 int s;
480 struct ipxpcb *ipxp = sotoipxpcb(so);
481
482 if (!ipx_nullhost(ipxp->ipxp_faddr))
483 return (EISCONN);
484 s = splnet();
485 error = ipx_pcbconnect(ipxp, nam);
486 splx(s);
487 if (error == 0)
488 soisconnected(so);
489 return (error);
490}
491
492static int
493ipx_detach(so)

--- 33 unchanged lines hidden (view full) ---

527{
528 struct ipxpcb *ipxp = sotoipxpcb(so);
529
530 ipx_setpeeraddr(ipxp, nam);
531 return (0);
532}
533
534static int
535ipx_send(so, flags, m, nam, control)
536 struct socket *so;
537 int flags;
538 struct mbuf *m;
539 struct mbuf *nam;
540 struct mbuf *control;
541{
542 int error;
543 struct ipxpcb *ipxp = sotoipxpcb(so);
544 struct ipx_addr laddr;
545 int s = 0;
546
547 if (nam) {
548 laddr = ipxp->ipxp_laddr;
549 if (!ipx_nullhost(ipxp->ipxp_faddr)) {
550 error = EISCONN;
551 goto send_release;
552 }
553 /*
554 * Must block input while temporarily connected.
555 */
556 s = splnet();
557 error = ipx_pcbconnect(ipxp, nam);
558 if (error) {
559 splx(s);
560 goto send_release;
561 }
562 } else {
563 if (ipx_nullhost(ipxp->ipxp_faddr)) {
564 error = ENOTCONN;
565 goto send_release;

--- 29 unchanged lines hidden (view full) ---

595{
596 struct ipxpcb *ipxp = sotoipxpcb(so);
597
598 ipx_setsockaddr(ipxp, nam);
599 return (0);
600}
601
602static int
603ripx_attach(so, proto)
604 struct socket *so;
605 int proto;
606{
607 int error = 0;
608 int s;
609 struct ipxpcb *ipxp = sotoipxpcb(so);
610
611 if (!(so->so_state & SS_PRIV) || (ipxp != NULL))
612 return (EINVAL);
613 s = splnet();
614 error = ipx_pcballoc(so, &ipxrawpcb);
615 splx(s);
616 if (error)
617 return (error);
618 error = soreserve(so, ipxsendspace, ipxrecvspace);
619 if (error)
620 return (error);
621 ipxp = sotoipxpcb(so);
622 ipxp->ipxp_faddr.x_host = ipx_broadhost;
623 ipxp->ipxp_flags = IPXP_RAWIN | IPXP_RAWOUT;
624 return (error);
625}