Thanks everyone.
I realize that what I should actually be doing is modifying the existing
openflow protocols with additional fields, not defining new protocols.
Sorry for the confusion and thanks again for taking the time to help. I
will create a new thread if I run into new problems in that approach.
Sam
On Wed, Jul 6, 2016 at 7:48 AM, Sam Snodgrass <[email protected]>
wrote:
> Thank you for the response Iwase,
>
> Originally my protocol did not reserve any tcp ports. However, in order to
> test your solution, I added TCP ports with unique values to the protocol,
> and implemented your changes.
>
> Unfortunately, the result is the same (albeit with additional fields):
>
>
> '\xad\x9c\xd9\x03\x00\x00\x00\x05\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00'
>
> Do you have any other suggestions or ideas about what may be causing this?
>
> Thank you again,
>
> Sam
>
> On Wed, Jul 6, 2016 at 2:51 AM, Iwase Yusuke <[email protected]>
> wrote:
>
>> Hi,
>>
>> Does your custom protocol reserve any TCP src/dst port?
>> If you can define it, please modify the following to return your protocol
>> class.
>> https://github.com/osrg/ryu/blob/master/ryu/lib/packet/tcp.py#L135
>>
>> e.g.)
>> $ git diff
>> diff --git a/ryu/lib/packet/tcp.py b/ryu/lib/packet/tcp.py
>> index 1771b9a..1c3a15e 100644
>> --- a/ryu/lib/packet/tcp.py
>> +++ b/ryu/lib/packet/tcp.py
>> @@ -108,6 +108,13 @@ class tcp(packet_base.PacketBase):
>> mask = sum(flags)
>> return (self.bits & mask) == mask
>> + @staticmethod
>> + def get_packet_type(src_port, dst_port):
>> + if (src_port == YOUR_PROTOCOL_PORT_NO or
>> + dst_port == YOUR_PROTOCOL_PORT_NO):
>> + return YourProtocolClass
>> + return None
>> +
>> @classmethod
>> def parser(cls, buf):
>> (src_port, dst_port, seq, ack, offset, bits, window_size,
>> @@ -132,7 +139,7 @@ class tcp(packet_base.PacketBase):
>> msg = cls(src_port, dst_port, seq, ack, offset, bits,
>> window_size, csum, urgent, option)
>> - return msg, None, buf[length:]
>> + return msg, cls.get_packet_type(src_port, dst_port), buf[length:]
>> def serialize(self, payload, prev):
>> offset = self.offset << 4
>>
>> Thanks,
>> Iwase
>>
>>
>>
>> On 2016年07月06日 03:04, Sam Snodgrass wrote:
>>
>>> Good afternoon everyone,
>>>
>>> I am experimenting with handling custom protocols with Ryu, but am
>>> unable to parse the new protocols at the switch or controller.
>>>
>>> I have created a custom protocol with Scapy that simple holds 3
>>> IntFields (4 bytes each) and 2 ShortFields (2 bytes each). I create a
>>> packet with Scapy that has several standard protocols (ethernet, ipv4, tcp,
>>> etc.) as well as our custom created protocol.
>>>
>>> I modified the Ryu switch to print out all the protocols of each packet
>>> received during a "Packet_In" event. The standard protocols get printed
>>> naturally:
>>>
>>> ethernet(dst='ea:b1:d3:52:39:b5',ethertype=2048,src='2e:3a:92:b5:df:c0')
>>>
>>> ipv4(csum=25275,dst='10.0.2.3',flags=0,header_length=5,identification=1,offset=0,option=None,proto=6,src='10.0.2.2',tos=0,total_length=56,ttl=64,version=4)
>>>
>>> tcp(ack=0,bits=2,csum=48080,dst_port=14450,offset=5,option=None,seq=0,src_port=33666,urgent=0,window_size=8192),
>>>
>>> but the custom protocol gets printed as:
>>>
>>> '\x00\x00\x00\x05\x00\x00\x00\x03\x00\x00\x00\x01\x00\x00\x00\x00'
>>>
>>> Where 5, 3, 1, 0, 0 are the values set for the fields in the custom
>>> protocol.
>>>
>>>
>>> In the Ryu code base, I defined my custom protocol class (in a new file
>>> saved in the packet subfolder), using the other protocols as a guide.
>>>
>>> Any help you could provide in this regard would be greatly appreciated.
>>>
>>> Sam
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
>>> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
>>> present their vision of the future. This family event has something for
>>> everyone, including kids. Get more information and register today.
>>> http://sdm.link/attshape
>>>
>>>
>>>
>>> _______________________________________________
>>> Ryu-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>>>
>
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel