NSIS-ka
A free C++ implementation of NSIS protocols

Changeset 6703

Show
Ignore:
Timestamp:
07/18/12 14:03:51 (10 months ago)
Author:
bless@…
Message:

- punt packet to IP stack processing when no interception necessary

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • protlib/trunk/src/tp_queryencap.cpp

    r6595 r6703  
    533533         
    534534          // We have to look for RAO option in Hop-by-Hop extension header, if it is NOT set to a value we look for, don't intercept 
     535          // Hbh-Extension and Destination Option headers have this format: 
     536          // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 
     537          // |  Option Type  |  Opt Data Len |  Option Data 
     538          // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- - - - - - - - - 
     539 
    535540          if (intercept) 
    536541          { 
     
    594599          } 
    595600          else 
    596           { 
     601          { // either intercept or no interception yet but maybe rao matching not necessary 
    597602            if (intercept) 
    598603            { 
     
    607612          } 
    608613 
    609           int offset = ip6_headerlen; // will point to IP payload, initially size of IPv6 header 
     614          int offset = ip6_headerlen; // will point to IP payload or next extension header, initially size of IPv6 header 
    610615 
    611616          // one RAO value matched (or we do not require strict RAO checking), now check for magic number 
     
    617622            // Now to do: iterate over extension headers to find the start of the UDP header 
    618623            // the first extension header is the hop-by-hop options header and it is present 
    619             // if RAO was used 
     624            // if RAO was used. 
    620625            struct ip6_ext *extheader = (struct ip6_ext *) (m->payload + offset); 
    621626                 
     
    627632            else 
    628633            { 
    629               // assume that some extension header is present 
     634              // assume that some extension header is present (at least the RAO) 
    630635              next_header= extheader->ip6e_nxt; 
    631636              // iterate if next header is not UDP 
     
    633638              { 
    634639                // advance to next extension header 
     640                // Note that the Length of the Hop-by-Hop Options header is given in 8-octet units,  
     641                // not including the first 8 octets. 
     642 
    635643                offset = offset + 8 + (extheader->ip6e_len * 8); 
    636644                if (offset > 20000) // sanity check 
     
    645653              } // end while 
    646654            } 
     655            // now next_header points to UDP content 
     656 
    647657            // set offset to next header following the last extension header that we saw 
    648658            offset = offset + 8 + (extheader->ip6e_len * 8); 
     
    737747            tpmsg = new (nothrow) TPMsg (netmsg, peer_addr->copy(), own_addr->copy()); 
    738748 
    739             Log (DEBUG_LOG, LOG_NORMAL, tpparam.name, 
     749            DLog(tpparam.name, 
    740750                 "[IPv6catcher] - receipt of PDU now complete, sending msg#" << tpmsg->get_id() << " to signaling module"); 
    741751                 
     
    750760            } // endif 
    751761          } // endif intercept 
     762          else 
     763          { // this module should not intercept the packet -> pass it on to the normal IP stack processing 
     764            DLog(tpparam.name, 
     765                 "[IPv6catcher] - no interception here, will pass it on to IP stack for further processing"); 
     766 
     767            status = ipq_set_verdict (h, m->packet_id, NF_ACCEPT, 0, NULL); 
     768            if (status < 0) 
     769                    die (h); 
     770 
     771          } 
    752772        } // end case IQM_PACKET 
    753773        break;