Uninett / zinolib

Python library for zino
Apache License 2.0
1 stars 3 forks source link

BUG: malformed bfd message #37

Closed hmpf closed 10 months ago

hmpf commented 10 months ago
Traceback (most recent call last):                                                 
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)                                  
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 2193, in wsgi_app
    response = self.handle_exception(e)                                            
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()                                        
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)                                             
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()                                                   
  File "/VENV/howitz/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)       
  File "/../howitz/src/howitz/endpoints.py", line 221, in get_events               
    table_events = get_current_events()                                            
  File "/../howitz/src/howitz/endpoints.py", line 75, in get_current_events        
    current_app.event_manager.get_events()                                         
  File "/../zinolib/src/zinolib/controllers/zino1.py", line 454, in get_events  
    event = self.create_event_from_id(event_id)                                 
  File "/../zinolib/src/zinolib/controllers/zino1.py", line 465, in create_event_from_id
    return Event.create(attrdict)                                                  
  File "/../zinolib/src/zinolib/event_types.py", line 144, in create                        
    eventobj = subtype(**attrdict)                                                 
  File "/VENV/howitz/lib/python3.10/site-packages/pydantic/main.py", line 165, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for BFDEvent   
bfd_addr                                                                        
  value is not a valid IPv4 or IPv6 address [type=ip_any_address, input_value='unknown(bad type (0))', input_type=str]
hmpf commented 10 months ago

The problem is that bfd_addr sometimes can be a non-ipadress string, this example is "unknown(bad type (0))". This can hopefully be fixed with altering how that field is validated and setting it to None in such cases.