bug 2158: Fix flooding of packets on input port, for packets received on in!=0
When you have the action OFPP_FLOOD on a flow, and the received packet is
not coming into the switch through port 0, then the packet will be flooded on
all ports, including the receiving port! This is especially bad if
you have broadcasts as packets will get replicated indefinitely (ARP req for
e.g.). This is caused by missing ntohs() that fails to convert port numbers
to their correct values. The switch works correctly for broadcast packets
received on port zero.
Example: The ReceivePacketOut() gets 0 if the input port is 0 and it works.
But will get 512 if the input port is 1 and since 512 is not our real input
port the check will fail and the packet will also be replicated on the input
port.
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/test.h"
int main (int argc, char *argv[])
{
return ns3::TestRunner::Run (argc, argv);
}