Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
getifaddrs()またはその他の方法を使用して、インターフェイスのルートゲートウェイ情報を(プログラミングで)取得できますか?
はい、できます。のマニュアルページを参照してくださいroute(4)。
route(4)
sysctl()ルーティング情報をダンプするために使用できます。MIBでは、最初の値をに設定しCTL_NET、2番目の値をに設定する必要がありAF_ROUTEます。
sysctl()
CTL_NET
AF_ROUTE
もしavailabel(freebsdなので)なら、あなたは読むことができます/proc/net/route。
/proc/net/route