faucetsdn / ryu

Ryu component-based software defined networking framework
https://ryu-sdn.org
Apache License 2.0
1.5k stars 1.16k forks source link

Suggestion for OFPQueueGetConfigReply parser with queue.len=0 #118

Open winstonhic opened 3 years ago

winstonhic commented 3 years ago

In /ryu/ofproto/ofproto_v1_3_parser.py about line=6073

If queue with len=0, while loop will not stop.

class OFPQueueGetConfigReply(MsgBase):
....
        offset = ofproto.OFP_QUEUE_GET_CONFIG_REPLY_SIZE
        while offset < msg_len:
            queue = OFPPacketQueue.parser(msg.buf, offset)
            msg.queues.append(queue)
            offset += queue.len
literkid commented 3 years ago

The same questions are as follows:

In /ryu/ofproto/ofproto_v1_0_parser.py about line=2077

class OFPQueueGetConfigReply(MsgBase):
....
        offset = ofproto.OFP_QUEUE_GET_CONFIG_REPLY_SIZE
        while offset + ofproto.OFP_PACKET_QUEUE_SIZE <= msg_len:
            queue = OFPPacketQueue.parser(msg.buf, offset)
            msg.queues.append(queue)

            offset += queue.len

In /ryu/ofproto/ofproto_v1_2_parser.py about line=3187

class OFPQueueGetConfigReply(MsgBase):
....
        length = ofproto.OFP_QUEUE_GET_CONFIG_REPLY_SIZE
        offset = ofproto.OFP_QUEUE_GET_CONFIG_REPLY_SIZE
        while length < msg.msg_len:
            queue = OFPPacketQueue.parser(msg.buf, offset)
            msg.queues.append(queue)

            offset += queue.len
            length += queue.len

In /ryu/ofproto/ofproto_v1_4_parser.py about line=5763

class OFPBundleCtrlMsg(MsgBase):
....
        msg.bundle_id = bundle_id
        msg.type = type_
        msg.flags = flags
        msg.properties = []
        rest = msg.buf[ofproto.OFP_BUNDLE_CTRL_MSG_SIZE:]
        while rest:
            p, rest = OFPBundleProp.parse(rest)
            msg.properties.append(p)

In /ryu/ofproto/ofproto_v1_5_parser.py about line=6864

class OFPBundleCtrlMsg(MsgBase):
....
        msg.bundle_id = bundle_id
        msg.type = type_
        msg.flags = flags
        msg.properties = []
        rest = msg.buf[ofproto.OFP_BUNDLE_CTRL_MSG_SIZE:]
        while rest:
            p, rest = OFPBundleProp.parse(rest)
            msg.properties.append(p)
facutuesca commented 11 months ago

@gizmoguy Would you be open to a PR that fixes this issue?

gizmoguy commented 11 months ago

Hi @facutuesca

Unfortunately I don't have enough free time right now to help review PRs for this project.

However we are looking for new maintainers, so if you or anyone else in the community are interested in being a maintainer and helping by reviewing/merging PRs let me know and I can grant you the appropriate access to the github.

Thanks.