Fix from Mostyn Lewis for this:
[unix-history] / sys / net / if_loop.c
index df561d1..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: if_loop.c,v 1.4 1993/11/15 20:45:58 wollman Exp $
+ *     $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"
@@ -71,8 +72,8 @@
 
 #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
 
@@ -94,7 +95,11 @@ loattach(void)
 
        ifp->if_name = "lo";
        ifp->if_mtu = LOMTU;
 
        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;
@@ -106,6 +111,8 @@ loattach(void)
 #endif
 }
 
 #endif
 }
 
+TEXT_SET(pseudo_set, loattach);
+
 int
 looutput(ifp, m, dst, rt)
        struct ifnet *ifp;
 int
 looutput(ifp, m, dst, rt)
        struct ifnet *ifp;
@@ -213,6 +220,9 @@ loioctl(ifp, cmd, data)
        caddr_t data;
 {
        register struct ifaddr *ifa;
        caddr_t data;
 {
        register struct ifaddr *ifa;
+#ifdef MULTICAST
+       register struct ifreq *ifr;
+#endif
        int error = 0;
 
        switch (cmd) {
        int error = 0;
 
        switch (cmd) {
@@ -227,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;
        }