Example #1
0
void forward_unified_sniff(struct packet_object *po)
{
   /* if it was not initialized, no packet are forwardable */
   if (!GBL_LNET->lnet_L3)
      return;

   /* if the interface was not configured, no packet are forwardable */
   if (!GBL_IFACE->configured)
      return;
   
   /* if unoffensive is set, don't forward any packet */
   if (GBL_OPTIONS->unoffensive || GBL_OPTIONS->read)
      return;

   /* 
    * forward the packet to Layer 3, the kernel
    * will route them to the correct destination (host or gw)
    */

   /* don't forward dropped packets */
   if ((po->flags & PO_DROPPED) == 0)
      send_to_L3(po);

    /* 
     * if the packet was modified and it exceeded the mtu,
     * we have to inject the exceeded data
     */
    if (po->DATA.inject) 
       inject_buffer(po); 
}
Example #2
0
void forward_unified_sniff(struct packet_object *po)
{
   /* if it was not initialized, no packet are forwardable */
   switch(ntohs(po->L3.proto)) {
      case LL_TYPE_IP:
         if(!GBL_LNET->lnet_IP4)
            return;
         if(!(GBL_IFACE->has_ipv4))
            return;
         break;
      case LL_TYPE_IP6:
         if(!GBL_LNET->lnet_IP6)
            return;
         if(!(GBL_IFACE->has_ipv6))
            return;
         break;
   }
   
   /* if unoffensive is set, don't forward any packet */
   if (GBL_OPTIONS->unoffensive || GBL_OPTIONS->read)
      return;

   /* 
    * forward the packet to Layer 3, the kernel
    * will route them to the correct destination (host or gw)
    */

   /* don't forward dropped packets */
   if ((po->flags & PO_DROPPED) == 0)
      send_to_L3(po);

    /* 
     * if the packet was modified and it exceeded the mtu,
     * we have to inject the exceeded data
     */
    if (po->DATA.inject) 
       inject_buffer(po); 
}