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;
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.

Thanks,
Regards,
Benny


On Wed, Oct 22, 2014 at 4:29 PM, FUJITA Tomonori <
[email protected]> wrote:

> On Sat, 18 Oct 2014 16:03:41 +0200
> Benjamin Eggerstedt <[email protected]> wrote:
>
> > Hi Ryu-Team,
> >
> > I noticed the following on one of my laboratory networks.
> >
> > If you run the simple_switch_13.py application and you receive an LLDP
> > packet that is truncated you'll receive an AssertionError. I have
> attached
> > a packet capture of the concerning packets and the following behaviour
> seen
> > on console.
> >
> > *Packet capture taken with:*
> > $ sudo tcpdump -lnni eth0 -s 0 -w filename.pcap
> > (-s 0 lets tcpdump default to 65535, so it means to capture the full
> packet)
> >
> > *Console log:*
> > $ ryu-manager --verbose ryu/ryu/app/simple_switch_13.py
> > loading app ryu/ryu/app/simple_switch_13.py
> > loading app ryu.controller.ofp_handler
> > instantiating app ryu/ryu/app/simple_switch_13.py of SimpleSwitch13
> > instantiating app ryu.controller.ofp_handler of OFPHandler
> > BRICK SimpleSwitch13
> >   CONSUMES EventOFPPacketIn
> >   CONSUMES EventOFPSwitchFeatures
> > BRICK ofp_event
> >   PROVIDES EventOFPPacketIn TO {'SimpleSwitch13': set(['main'])}
> >   PROVIDES EventOFPSwitchFeatures TO {'SimpleSwitch13': set(['config'])}
> >   CONSUMES EventOFPPortDescStatsReply
> >   CONSUMES EventOFPSwitchFeatures
> >   CONSUMES EventOFPEchoRequest
> >   CONSUMES EventOFPHello
> >   CONSUMES EventOFPErrorMsg
> > connected socket:<eventlet.greenio.GreenSocket object at 0x7f45515d7fd0>
> > address:('192.168.120.71', 32962)
> > hello ev <ryu.controller.ofp_event.EventOFPHello object at
> 0x7f45515ea510>
> > move onto config mode
> > EVENT ofp_event->SimpleSwitch13 EventOFPSwitchFeatures
> > switch features ev version: 0x4 msg_type 0x6 xid 0x5d6c86fd
> >
> OFPSwitchFeatures(auxiliary_id=0,capabilities=79,datapath_id=537554655993737,n_buffers=256,n_tables=3)
> > move onto main mode
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:f4:7a:fd e8:e7:32:51:5f:89 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:f4:7a:fd e8:e7:32:51:5f:89 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:f4:7a:fd e8:e7:32:51:5f:89 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > hub: uncaught exception: Traceback (most recent call last):
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/hub.py", line 52,
> in
> > _launch
> >     func(*args, **kwargs)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
> > line 274, in _event_loop
> >     handler(ev)
> >   File "/home/alu4u/ryu/ryu/app/simple_switch_13.py", line 69, in
> > _packet_in_handler
> >     pkt = packet.Packet(msg.data)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/packet.py",
> > line 45, in __init__
> >     self._parser(parse_cls)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/packet.py",
> > line 51, in _parser
> >     proto, cls, rest_data = cls.parser(rest_data)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/lldp.py",
> > line 132, in parser
> >     tlv = cls._tlv_parsers[tlv_type](buf)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/lldp.py",
> > line 336, in __init__
> >     super(SystemDescription, self).__init__(buf, *args, **kwargs)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/lldp.py",
> > line 89, in __init__
> >     assert len(buf) >= self.len + LLDP_TLV_SIZE
> > AssertionError
> >
> > ###
> >
> > The packet in question is #31 of the packet capture (attached). This is
> my
> > upstream switch sending me some information via LLDP (but it appears to
> be
> > truncated to 128 bytes as it is buffered).
> >
> > I added a print statements and the assert fails as 61 is not equal or
> > greater than 76.
> >
> > *Edited in:*
> > /usr/local/lib/python2.7/dist-packages/ryu/lib/packet/lldp.py
> >
> > *Console log (with my print statements):*
> > $ ryu-manager --verbose ryu/ryu/app/simple_switch_13.py
> > loading app ryu/ryu/app/simple_switch_13.py
> > loading app ryu.controller.ofp_handler
> > instantiating app ryu/ryu/app/simple_switch_13.py of SimpleSwitch13
> > instantiating app ryu.controller.ofp_handler of OFPHandler
> > BRICK SimpleSwitch13
> >   CONSUMES EventOFPSwitchFeatures
> >   CONSUMES EventOFPPacketIn
> > BRICK ofp_event
> >   PROVIDES EventOFPSwitchFeatures TO {'SimpleSwitch13': set(['config'])}
> >   PROVIDES EventOFPPacketIn TO {'SimpleSwitch13': set(['main'])}
> >   CONSUMES EventOFPHello
> >   CONSUMES EventOFPPortDescStatsReply
> >   CONSUMES EventOFPEchoRequest
> >   CONSUMES EventOFPSwitchFeatures
> >   CONSUMES EventOFPErrorMsg
> > connected socket:<eventlet.greenio.GreenSocket object at 0x7fabcd9fbed0>
> > address:('192.168.120.71', 33301)
> > hello ev <ryu.controller.ofp_event.EventOFPHello object at
> 0x7fabcda0e410>
> > move onto config mode
> > EVENT ofp_event->SimpleSwitch13 EventOFPSwitchFeatures
> > switch features ev version: 0x4 msg_type 0x6 xid 0xbfe66b2e
> >
> OFPSwitchFeatures(auxiliary_id=0,capabilities=79,datapath_id=537554655993737,n_buffers=256,n_tables=3)
> > move onto main mode
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:f4:7a:fd e8:e7:32:51:5f:89 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:f4:7a:fd e8:e7:32:51:5f:89 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:f4:7a:fd e8:e7:32:51:5f:89 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:c8:6b:21 01:80:c2:00:00:00 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > packet in 537554655993737 00:e0:b1:f4:7a:fd e8:e7:32:51:5f:89 1
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > self.typelen = 519
> > LLDP_TLV_LENGTH_MASK = 511
> > self.len = 7
> > len(buf) = 114
> > self.len + LLDP_TLV_SIZE = 9
> > self.typelen = 1029
> > LLDP_TLV_LENGTH_MASK = 511
> > self.len = 5
> > len(buf) = 105
> > self.len + LLDP_TLV_SIZE = 7
> > self.typelen = 1538
> > LLDP_TLV_LENGTH_MASK = 511
> > self.len = 2
> > len(buf) = 98
> > self.len + LLDP_TLV_SIZE = 4
> > self.typelen = 2067
> > LLDP_TLV_LENGTH_MASK = 511
> > self.len = 19
> > len(buf) = 94
> > self.len + LLDP_TLV_SIZE = 21
> > self.typelen = 2570
> > LLDP_TLV_LENGTH_MASK = 511
> > self.len = 10
> > len(buf) = 73
> > self.len + LLDP_TLV_SIZE = 12
> >
> >
> >
> >
> > *self.typelen = 3146LLDP_TLV_LENGTH_MASK = 511self.len = 74len(buf) =
> > 61self.len + LLDP_TLV_SIZE = 76*
> > hub: uncaught exception: Traceback (most recent call last):
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/hub.py", line 52,
> in
> > _launch
> >     func(*args, **kwargs)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py",
> > line 274, in _event_loop
> >     handler(ev)
> >   File "/home/alu4u/ryu/ryu/app/simple_switch_13.py", line 69, in
> > _packet_in_handler
> >     pkt = packet.Packet(msg.data)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/packet.py",
> > line 45, in __init__
> >     self._parser(parse_cls)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/packet.py",
> > line 51, in _parser
> >     proto, cls, rest_data = cls.parser(rest_data)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/lldp.py",
> > line 137, in parser
> >     tlv = cls._tlv_parsers[tlv_type](buf)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/lldp.py",
> > line 341, in __init__
> >     super(SystemDescription, self).__init__(buf, *args, **kwargs)
> >   File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/lldp.py",
> > line 94, in __init__
> >     assert len(buf) >= self.len + LLDP_TLV_SIZE
> > AssertionError
> >
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> > EVENT ofp_event->SimpleSwitch13 EventOFPPacketIn
> >
> > ###
> >
> > W
> > ​here does the issue come from?​
> >
> > a) The OF switch should not send an apparently truncated packet?
>
> I think so unless such flow is installed. What flows are installed on
> your switch?
>
> > b) The lldp.py needs to handle this?
>
> Yeap, it should. I'll take care of it shortly.
>
> > c) I should avoid receiving LLDP with simple_switch_13.py?
>
> If you know what you want to receive, you could use:
>
> https://github.com/osrg/ryu/blob/master/ryu/lib/ofp_pktinfilter.py
>
>
> > My switch is supposed to work up to the specs of OF v1.3.1 and when I
> > reviewed page 92 (Appendix 4.1 Packet In), it appears that it is allowed
> to
> > truncate the packet down to 128 bytes (which is what is part of DATA in
> > packet #31) if it is buffered.
> >
> > ​I'm running Ryu 3.13 on this host.
> > $ ryu-manager --version
> > ryu-manager 3.13​
> >
> >
> > ​Just in case the mailing-list doesn't allow me to attach a file, you can
> > also get it from the following URL:
> >
> https://ale.files.wimi.pro/download.php?id=30176716&code=7hjy6rcnfios808kcgk4s0ss8
> >
> > Thanks,
> > Regards,
> > Benny
>
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to