Skip to content

Use ip monitor for gateway connectivity #939

Description

@sonnyp

Motivation

In #938 we improved connectivity check by replacing ping with arp lookup.

But we still poll every 5 seconds which delays the update of the ip address on the display (and reconfiguring cockpit / mediamtx)

ToDo

We can probably use ip monitor instead. e.g:

async function watchNeighbor(ip, dev = wired_interface, onChange) {
  for await (const line of $`ip --json monitor neigh dev ${dev}`) {
   // bug not actually json 
  // https://bugs.launchpad.net/ubuntu/+source/iproute2/+bug/2116779
    if (line.includes(ip)) {
      const reachable = line.includes('lladdr') && !line.includes('FAILED')
      onChange(reachable)
    }
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions