From 1f177e3aec91c5eac8429ae329994f9fdbfbfca9 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 18 Nov 2013 15:22:05 +0100 Subject: [PATCH] Get the route for the correct address family. --- src/preferences/network/Settings.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/preferences/network/Settings.cpp b/src/preferences/network/Settings.cpp index 9fb7ea2096..9290ab0002 100644 --- a/src/preferences/network/Settings.cpp +++ b/src/preferences/network/Settings.cpp @@ -87,8 +87,12 @@ Settings::ReadConfiguration() fIP = address.Address().ToString(); fNetmask = address.Mask().ToString(); + int family = AF_INET; + if (address.Address().Family() != AF_UNSPEC) + family = address.Address().Family(); + BNetworkAddress gatewayAddress; - if (interface.GetDefaultRoute(AF_INET, gatewayAddress) != B_OK) + if (interface.GetDefaultRoute(family, gatewayAddress) != B_OK) return; fGateway = gatewayAddress.ToString();