Closed ndeloof closed 4 years ago
Hi, I'm looking into how to determined which one's the default gateway from /proc/net/route
, I stumbled upon this PR, does this mean that the first entry in the file is the default gateway? Sorry for the noise :)
Shouldn't you search for the entry with Destination = 0? That would give you the default and then parse the gateway from that entry.
I don't know, I don't know enough about Linux networking. I would certainly consider a pull request.
Linux implementation relies on a set if netutils commands expecting at least one of them to be available. Proposed solution is to use the standard procfs
/proc/net/route
which exposes this information is a portable way.