1. Remove a rather strangely gratuitous bit of profanity
[unix-history] / sys / net / if_loop.c
index b2bf1cb..037d99f 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)if_loop.c     7.13 (Berkeley) 4/26/91
  * SUCH DAMAGE.
  *
  *     from: @(#)if_loop.c     7.13 (Berkeley) 4/26/91
- *     $Id$
+ *     $Id: if_loop.c,v 1.6 1993/12/20 19:31:29 wollman Exp $
  */
 
 /*
  */
 
 /*
@@ -44,6 +44,7 @@
 #include "socket.h"
 #include "errno.h"
 #include "ioctl.h"
 #include "socket.h"
 #include "errno.h"
 #include "ioctl.h"
+#include "kernel.h"
 
 #include "../net/if.h"
 #include "../net/if_types.h"
 
 #include "../net/if.h"
 #include "../net/if_types.h"
 
 #include "bpfilter.h"
 #if NBPFILTER > 0
 
 #include "bpfilter.h"
 #if NBPFILTER > 0
-#include <sys/time.h>
-#include <net/bpf.h>
+#include "sys/time.h"
+#include "net/bpf.h"
 static caddr_t lo_bpf;
 #endif
 
 static caddr_t lo_bpf;
 #endif
 
+#ifdef TINY_LOMTU
 #define        LOMTU   (1024+512)
 #define        LOMTU   (1024+512)
+#else /* reasonable MTU */
+#define LOMTU  65535                   /* maximum MTU for IP */
+#endif /* reasonable MTU */
 
 struct ifnet loif;
 
 struct ifnet loif;
-int    looutput(), loioctl();
+int looutput(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *);
+int    loioctl(struct ifnet *, int, caddr_t);
+void lortrequest(int, struct rtentry *, struct sockaddr *);
 
 
-loattach()
+void
+loattach(void)
 {
        register struct ifnet *ifp = &loif;
 
        ifp->if_name = "lo";
        ifp->if_mtu = LOMTU;
 {
        register struct ifnet *ifp = &loif;
 
        ifp->if_name = "lo";
        ifp->if_mtu = LOMTU;
+#ifdef MULTICAST
+       ifp->if_flags = IFF_LOOPBACK|IFF_MULTICAST;
+#else
        ifp->if_flags = IFF_LOOPBACK;
        ifp->if_flags = IFF_LOOPBACK;
+#endif
        ifp->if_ioctl = loioctl;
        ifp->if_output = looutput;
        ifp->if_type = IFT_LOOP;
        ifp->if_ioctl = loioctl;
        ifp->if_output = looutput;
        ifp->if_type = IFT_LOOP;
@@ -99,6 +111,9 @@ loattach()
 #endif
 }
 
 #endif
 }
 
+TEXT_SET(pseudo_set, loattach);
+
+int
 looutput(ifp, m, dst, rt)
        struct ifnet *ifp;
        register struct mbuf *m;
 looutput(ifp, m, dst, rt)
        struct ifnet *ifp;
        register struct mbuf *m;
@@ -179,24 +194,35 @@ looutput(ifp, m, dst, rt)
 }
 
 /* ARGSUSED */
 }
 
 /* ARGSUSED */
+void
 lortrequest(cmd, rt, sa)
 lortrequest(cmd, rt, sa)
-struct rtentry *rt;
-struct sockaddr *sa;
+       int cmd;
+       struct rtentry *rt;
+       struct sockaddr *sa;
 {
 {
-       if (rt)
+       if (rt) {
+#ifdef DEBUG
+               printf("lo0: lortrequest: setting route MTU to %u\n",
+                      LOMTU);
+#endif
                rt->rt_rmx.rmx_mtu = LOMTU;
                rt->rt_rmx.rmx_mtu = LOMTU;
+       }
 }
 
 /*
  * Process an ioctl request.
  */
 /* ARGSUSED */
 }
 
 /*
  * Process an ioctl request.
  */
 /* ARGSUSED */
+int
 loioctl(ifp, cmd, data)
        register struct ifnet *ifp;
        int cmd;
        caddr_t data;
 {
        register struct ifaddr *ifa;
 loioctl(ifp, cmd, data)
        register struct ifnet *ifp;
        int cmd;
        caddr_t data;
 {
        register struct ifaddr *ifa;
+#ifdef MULTICAST
+       register struct ifreq *ifr;
+#endif
        int error = 0;
 
        switch (cmd) {
        int error = 0;
 
        switch (cmd) {
@@ -211,6 +237,27 @@ loioctl(ifp, cmd, data)
                 */
                break;
 
                 */
                break;
 
+#ifdef MULTICAST
+       case SIOCADDMULTI:
+       case SIOCDELMULTI:
+               ifr = (struct ifreq *)data;
+               if (ifr == 0) {
+                       error = EAFNOSUPPORT;           /* XXX */
+                       break;
+               }
+               switch (ifr->ifr_addr.sa_family) {
+
+#ifdef INET
+               case AF_INET:
+                       break;
+#endif
+
+               default:
+                       error = EAFNOSUPPORT;
+                       break;
+               }
+               break;
+#endif
        default:
                error = EINVAL;
        }
        default:
                error = EINVAL;
        }