-
Notifications
You must be signed in to change notification settings - Fork 1k
Bug:bfd_responder crash when process partial packet sent by itself #17418
Description
Is it platform specific
generic
Importance or Severity
Critical
Description of the bug
These 2 cases may cause BFD related mgmt test fails:
bfd responder can receive the packet it sent. and at the time of restart, partial packet could be process and cause it crash:
Traceback (most recent call last):
File "/opt/bfd_responder.py", line 205, in <module>
main()
File "/opt/bfd_responder.py", line 200, in main
p.poll()
File "/opt/bfd_responder.py", line 80, in poll
self.responder.action(self.mapping[handler])
File "/opt/bfd_responder.py", line 92, in action
data)
File "/opt/bfd_responder.py", line 127, in extract_bfd_info
bfdpkt = BFD(ether.payload.payload.payload.load)
File "/usr/local/lib/python2.7/dist-packages/scapy/packet.py", line 1070, in __getattr__
raise AttributeError, attr
And also bfd responder initialize it's packet when receive DOWN bfd packet. In the case of bfd_responder restart and it get BFD UP packet, the packet become uninitialized, it cause socket sending packet error:
Traceback (most recent call last):
File "/opt/bfd_responder.py", line 224, in <module>
main()
File "/opt/bfd_responder.py", line 219, in main
p.poll()
File "/opt/bfd_responder.py", line 81, in poll
self.responder.action(self.mapping[handler])
File "/opt/bfd_responder.py", line 106, in action
interface.send(session["pkt"])
File "/opt/bfd_responder.py", line 60, in send
scapy2.sendp(data, iface=self.iface)
File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 259, in sendp
__gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime)
File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 234, in __gen_send
s.send(p)
File "/usr/local/lib/python2.7/dist-packages/scapy/supersocket.py", line 35, in send
return self.outs.send(sx)
socket.error: [Errno 22] Invalid argument
Steps to Reproduce
using a python script craft bfd packet:
send an incomplete BFD packet or send UP state BFD packet to bfd_responder can trigger the issue.
Actual Behavior and Expected Behavior
1, for partial packet just ignore the packet.
2, for the UP BFD packet right after bfd_responder start or restart, ignore the packet per RFC5880 FSM.
treat the bfd_responder in DOWN state by default right after start or restart.
Relevant log output
Traceback (most recent call last):
File "/opt/bfd_responder.py", line 224, in <module>
main()
File "/opt/bfd_responder.py", line 219, in main
p.poll()
File "/opt/bfd_responder.py", line 81, in poll
self.responder.action(self.mapping[handler])
File "/opt/bfd_responder.py", line 106, in action
interface.send(session["pkt"])
File "/opt/bfd_responder.py", line 60, in send
scapy2.sendp(data, iface=self.iface)
File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 259, in sendp
__gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, loop=loop, count=count, verbose=verbose, realtime=realtime)
File "/usr/local/lib/python2.7/dist-packages/scapy/sendrecv.py", line 234, in __gen_send
s.send(p)
File "/usr/local/lib/python2.7/dist-packages/scapy/supersocket.py", line 35, in send
return self.outs.send(sx)
socket.error: [Errno 22] Invalid argumentOutput of show version
Attach files (if any)
No response