Skip to content

Shadow panics if a packet is sent to an unknown IP address #3148

@stevenengler

Description

@stevenengler

If a packet is sent to an IP address that is not 127.0.0.1 or an IP address in the configuration file, Shadow will panic.

general:
  stop_time: 10s

network:
  graph:
    type: 1_gbit_switch

hosts:
  client:
    network_node_id: 0
    processes:
    - path: python3
      args:
      - -c
      - |
        import socket
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        s.sendto(b"hello", ("1.2.3.4", 80))
thread 'shadow-worker' panicked at 'No host ID for dest address {dst_ip}', main/core/worker.rs:356:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'shadow-worker' panicked at 'assertion failed: self.shim_shmem_lock.borrow().is_none()', main/host/host.rs:996:9
thread '<unnamed>' panicked at 'A work thread panickedfatal runtime error: thread local panicked on drop
', main/core/scheduler/pools/unbounded.rs:193:17

We should probably just drop the packet instead of panicking. But we should also inform the user in some way, probably through a warn-level log message. It would probably be best to track which IP/port addresses we've already warned about so we don't flood the log with warnings. And also since this will show for some packets which should be delivered, but shadow doesn't support (such as 127.0.0.0/8, excluding 127.0.0.1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugError or flaw producing unexpected results

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions