WORKING WORKING WOOOHOOO!!!!!!!!!
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Wed, 31 Aug 2011 18:08:38 +0000 (20:08 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Wed, 31 Aug 2011 18:08:38 +0000 (20:08 +0200)
I'm outa here... must... get... drunk...

src/nepi/testbeds/planetlab/multicast.py
src/nepi/testbeds/planetlab/scripts/mcastfwd.py
src/nepi/testbeds/planetlab/scripts/mrouted-3.9.5-pl.patch

index e42cc2f..71df64c 100644 (file)
@@ -120,7 +120,7 @@ class MulticastRouter(application.Application):
                 "for iface in %(nonifaces)s ; do echo \"phyint $iface disable\" >> ./mrouted.conf ; done ; "
                 "./mrouted -f %(debugbit)s -c ./mrouted.conf"
                 ,
-            'debugbit' : "-dpacket,igmp,routing,interface,pruning,membership",
+            'debugbit' : "-dpacket,igmp,routing,interface,pruning,membership,cache",
         }
     }
     
index d3380e7..77bab0c 100644 (file)
@@ -192,8 +192,6 @@ class FWDThread(threading.Thread):
         enumerate_ = enumerate
         fwd_sockets = self.fwd_sockets
         npending = 0
-        getnow = time.time
-        now = getnow()
         noent = (None,None)
         
         while not self._stop:
@@ -211,9 +209,8 @@ class FWDThread(threading.Thread):
             if not packet or len_(packet) < 24:
                 continue
             
-            now = getnow()
             fullpacket = packet
-            parent = buffer_(packet,0,4)
+            parent = packet[:4]
             packet = buffer_(packet,4)
             
             if packet[9] == '\x02':
@@ -226,16 +223,14 @@ class FWDThread(threading.Thread):
             # To-Do: PIM asserts
             
             # Get route
-            addrinfo = buffer_(packet,12,8)
-            fwd_targets, expire = rt_cache.get(parent+addrinfo, noent)
-            if fwd_targets is None:
-                fwd_targets, expire = rt_cache.get('\x00\x00\x00\x00'+str_(addrinfo), noent)
+            addrinfo = packet[12:20]
+            fwd_targets, rparent = rt_cache.get(addrinfo, noent)
             
-            if fwd_targets is not None and expire > now:
+            if fwd_targets is not None and (rparent == '\x00\x00\x00\x00' or rparent == parent):
                 # Forward
                 ttl = ord_(packet[8])
-                tgt_group = (addrinfo[4:],0)
-                print >>sys.stderr, socket.inet_ntoa(tgt_group[0]), "->", ttl, map(ord,fwd_targets),
+                tgt_group = (socket.inet_ntoa(addrinfo[4:]),0)
+                print >>sys.stderr, map(socket.inet_ntoa, (parent, addrinfo[:4], addrinfo[4:])), "-> ttl", ttl,
                 nfwd_targets = len_(fwd_targets)
                 for vifi, vif in vifs.iteritems():
                     if vifi < nfwd_targets:
@@ -250,7 +245,7 @@ class FWDThread(threading.Thread):
                 # Mark pending
                 if len_(pending) < self.maxpending:
                     tgt_group = addrinfo[4:]
-                    print >>sys.stderr, socket.inet_ntoa(tgt_group), "-> ?"
+                    print >>sys.stderr, map(socket.inet_ntoa, (parent, addrinfo[:4], addrinfo[4:])), "-> ?"
                     
                     pending.append(fullpacket)
                     
@@ -320,16 +315,16 @@ class RouterThread(threading.Thread):
                 parent_addr = vifs[parent][4]
             else:
                 parent_addr = '\x00\x00\x00\x00'
-            addrinfo = ''.join((parent_addr,origin,mcastgrp))
-            rt_cache[addrinfo] = (ttls, time.time() + options.refresh_delay)
-            print >>sys.stderr, "Added RT", '-'.join(map(socket.inet_ntoa,(parent_addr,origin,mcastgrp)))
+            addrinfo = origin + mcastgrp
+            rt_cache[addrinfo] = (ttls, parent_addr)
+            print >>sys.stderr, "Added RT", '-'.join(map(socket.inet_ntoa,(parent_addr,origin,mcastgrp))), map(ord,ttls)
         def del_mfc(cmd):
             origin,mcastgrp,parent,ttls,pkt_cnt,byte_cnt,wrong_if,expire = mfcctl(data)
             if parent in vifs:
                 parent_addr = vifs[parent][4]
             else:
                 parent_addr = '\x00\x00\x00\x00'
-            addrinfo = ''.join((parent_addr,origin,mcastgrp))
+            addrinfo = origin + mcastgrp
             del rt_cache[addrinfo]
             print >>sys.stderr, "Removed RT", '-'.join(map(socket.inet_ntoa,(parent_addr,origin,mcastgrp)))
         
index 247a7bc..f22175f 100644 (file)
@@ -112,7 +112,7 @@ diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/igmp.c
  
 diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/kern.c mrouted-3.9.5-pl/kern.c
 --- mrouted-3.9.5/kern.c       2011-03-05 21:45:25.000000000 +0100
-+++ mrouted-3.9.5-pl/kern.c    2011-08-30 15:30:10.508700000 +0200
++++ mrouted-3.9.5-pl/kern.c    2011-08-31 15:09:21.457071000 +0200
 @@ -7,16 +7,26 @@
   * Leland Stanford Junior University.
   */
@@ -253,7 +253,7 @@ diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/kern.c
      {
          if (errno == EADDRNOTAVAIL || errno == EINVAL)
              return;
-@@ -238,31 +309,50 @@
+@@ -238,31 +309,57 @@
   */
  void k_add_rg(u_int32 origin, struct gtable *g)
  {
@@ -286,6 +286,13 @@ diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/kern.c
 +
 +#ifdef PLANETLAB
 +
++      logit(LOG_DEBUG, 0, "setsockopt MRT_ADD_MFC %s-%s %d[%d %d %d %d %d %d]", 
++          inet_fmt(origin, s1, sizeof(s1)),
++          inet_fmt(g->gt_mcastgrp, s2, sizeof(s2)),
++          numvifs,
++          op.mc.mfcc_ttls[0], op.mc.mfcc_ttls[1], op.mc.mfcc_ttls[2],
++          op.mc.mfcc_ttls[3], op.mc.mfcc_ttls[4], op.mc.mfcc_ttls[5] );
++
 +    /* Send to PlanetLab's user-space MRT daemon */
 +    op.op = MRT_ADD_MFC;
 +    op.len = sizeof(op.mc);
@@ -311,7 +318,7 @@ diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/kern.c
  }
  
  
-@@ -271,20 +361,37 @@
+@@ -271,20 +368,37 @@
   */
  int k_del_rg(u_int32 origin, struct gtable *g)
  {
@@ -497,7 +504,7 @@ diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/pathna
 Only in mrouted-3.9.5-pl: vers.c
 diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/vif.c mrouted-3.9.5-pl/vif.c
 --- mrouted-3.9.5/vif.c        2011-03-05 21:45:25.000000000 +0100
-+++ mrouted-3.9.5-pl/vif.c     2011-08-30 10:18:29.223147000 +0200
++++ mrouted-3.9.5-pl/vif.c     2011-08-31 19:26:52.955453000 +0200
 @@ -139,6 +139,7 @@
      v->uv_lcl_addr    = 0;
      v->uv_rmt_addr    = 0;
@@ -506,7 +513,16 @@ diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/vif.c
      v->uv_subnet      = 0;
      v->uv_subnetmask  = 0;
      v->uv_subnetbcast = 0;
-@@ -526,6 +527,8 @@
+@@ -379,6 +380,8 @@
+           start_route_updates();
+           update_route(p->pa_subnet, p->pa_subnetmask, 0, 0, vifi, NULL);
+       }
++      if (v->uv_ptp_addr)
++          update_route(v->uv_ptp_addr, 0xffffffff, 0, 0, vifi, NULL);
+       /*
+        * Until neighbors are discovered, assume responsibility for sending
+@@ -526,6 +529,8 @@
                    return(vifi);
            }
            else {
@@ -515,7 +531,7 @@ diff -ur --exclude='*.o' --exclude=cfparse.c --exclude='*~' mrouted-3.9.5/vif.c
                if ((src & v->uv_subnetmask) == v->uv_subnet &&
                    ((v->uv_subnetmask == 0xffffffff) ||
                     (src != v->uv_subnetbcast)))
-@@ -1666,6 +1669,10 @@
+@@ -1666,6 +1671,10 @@
                        scaletime(now - v->uv_querier->al_ctime),
                        scaletime(v->uv_querier->al_timer));
        }