Hi, "bfd.bfd" packet parser seems not to be registered to the UDP packet parser. How about the following patch?
diff --git a/ryu/lib/packet/bfd.py b/ryu/lib/packet/bfd.py index 1082f9c0..73c076f3 100644 --- a/ryu/lib/packet/bfd.py +++ b/ryu/lib/packet/bfd.py @@ -85,6 +85,10 @@ from . import packet_base from ryu.lib import addrconv from ryu.lib import stringify +UDP_DST_PORT = 3784 +UDP_SRC_PORT_MIN = 49152 +UDP_SRC_PORT_MAX = 65535 + BFD_STATE_ADMIN_DOWN = 0 BFD_STATE_DOWN = 1 BFD_STATE_INIT = 2 diff --git a/ryu/lib/packet/udp.py b/ryu/lib/packet/udp.py index 0e25f418..0a51b086 100644 --- a/ryu/lib/packet/udp.py +++ b/ryu/lib/packet/udp.py @@ -17,6 +17,7 @@ import struct from . import packet_base from . import packet_utils +from . import bfd from . import dhcp from . import dhcp6 from . import vxlan @@ -65,6 +66,9 @@ class udp(packet_base.PacketBase): return vxlan.vxlan if dst_port == geneve.UDP_DST_PORT: return geneve.geneve + if (dst_port == bfd.UDP_DST_PORT and + bfd.UDP_SRC_PORT_MIN < src_port < bfd.UDP_SRC_PORT_MAX): + return bfd.bfd return None @classmethod 2019年6月24日(月) 12:59 knet solutions <knetsolutio...@gmail.com>: > > Hi, > > I am not able to decode the BFD packets using get_protocol function. > > >b = pkt.get_protocol(bfd.bfd) > >self.logger.info(b) > > The above code prints NONE. bfd packet parsing library couldnot parse the > > But I used another approach to decode the BFD protocol. > > >payload = pkt.protocols[-1] > >print bfd.bfd.parser(payload)[0] > This works. > Refer the logs below. > > Question.: > - Does pkt.get_protocol(bfd.bfd) should work? or am i doing something wrong? > > > LOGS > ======= > None > bfd(auth_cls=None,desired_min_tx_interval=1000000,detect_mult=3,diag=0,flags=0,length=24,my_discr=4221102142,required_min_echo_rx_interval=0,required_min_rx_interval=10000,state=1,ver=1,your_discr=0) > > > -- > Regards, > Knet solutions. > UDEMY RYU SDN Training Course: UDEMY LINK > Whatsapp/Mobile: +919445042007 > website: http://knetsolutions.in/ > Facebook Page : https://www.facebook.com/sdntraining/ > > > > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel