Hi, > Here is a fix. I can confirm that your fix works fine. Ryu no longer encounters an issue when the truncated LLDP packet gets in. Thank you!
> The maximu size of a packet that the switch sends to a controller is > 128 bytes? It is not that we couldn't send more from our OmniSwitch, but I guess our implementation follows the OF v1.3.1 specifications. Please let me cite the OpenFlow v1.3.1 spec for details: 6.1.2 Asynchronous // Page 26 of 128 > ... > If the packet-in event is configured to buffer packets and the switch has sufficient memory to buffer them, the packet-in events contain only some fraction of the packet > header and a buffer ID to be used by a controller when it is ready for the switch to forward the packet. > ... > If the packet is buffered, the number of bytes of the original packet to include in the packet-in can be configured. By default, it is 128 bytes. > For packet-in generated by an output action in a flow entries or group bucket, it can be specified individually in the output action itself (see A.2.5), for other packet-in > it can be configured in the switch configuration (see A.3.2). I couldn't find any specifics on "control packets that are supposed to be treated in a special way", please advise if there is an official documentation / recommendation that I could use to get back to my R&D colleagues. Thanks a lot for your support, Regards, Benny On Thu, Oct 23, 2014 at 7:27 AM, FUJITA Tomonori < [email protected]> wrote: > On Wed, 22 Oct 2014 20:47:47 +0200 > Benjamin Eggerstedt <[email protected]> wrote: > > > Hi, > > > >> I think so unless such flow is installed. What flows are installed on > >> your switch? > > > > Flow 2 was added afterwards to discard the packet that Ryu didn't like. > > Basically just the "Send everything to the controller" flow. > > > > OS6900-OF-> debug openflow flow-id all > > > > Flow ID: 1 > > Logical Switch: vswitch > > Priority: 0 > > Idle Timeout: 0 > > Hard Timeout: 0 > > Flow Type: Wildcard > > Match: > > Action: Out: Controller; > > The maximu size of a packet that the switch sends to a controller is > 128 bytes? > > > Flow ID: 2 > > Logical Switch: vswitch > > Priority: 1 > > Idle Timeout: 0 > > Hard Timeout: 0 > > Flow Type: Wildcard > > Match: Dst MAC: 01:80:c2:00:00:0e/ff:ff:ff:ff:ff:ff, Ether-type: 88cc > > Action: Drop > > > >>> b) The lldp.py needs to handle this? > >> Yeap, it should. I'll take care of it shortly. > > > > Very good, I shall be able to test that in my lab and confirm the > > behaviour/fix. > > Here is a fix. > > Thanks! > > diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py > index 1202225..d0cae2f 100644 > --- a/ryu/lib/packet/lldp.py > +++ b/ryu/lib/packet/lldp.py > @@ -124,7 +124,7 @@ class lldp(packet_base.PacketBase): > self.tlvs[-1].tlv_type == LLDP_TLV_END) > > @classmethod > - def parser(cls, buf): > + def _parser(cls, buf): > tlvs = [] > > while buf: > @@ -144,6 +144,13 @@ class lldp(packet_base.PacketBase): > > return lldp_pkt, None, buf > > + @classmethod > + def parser(cls, buf): > + try: > + return cls._parser(buf) > + except: > + return None, None, buf > + > def serialize(self, payload, prev): > data = bytearray() > for tlv in self.tlvs: > diff --git a/ryu/tests/unit/packet/test_lldp.py > b/ryu/tests/unit/packet/test_lldp.py > index 646af1e..c8daf58 100644 > --- a/ryu/tests/unit/packet/test_lldp.py > +++ b/ryu/tests/unit/packet/test_lldp.py > @@ -286,6 +286,10 @@ class TestLLDPOptionalTLV(unittest.TestCase): > # End > eq_(tlvs[16].tlv_type, lldp.LLDP_TLV_END) > > + def test_parse_corrupted(self): > + buf = self.data > + pkt = packet.Packet(buf[:128]) > + > def test_serialize(self): > pkt = packet.Packet() > >
------------------------------------------------------------------------------
_______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
