dbus: Use the new /net/connman/iwd root path

This commit is contained in:
Denis Kenzior 2019-10-28 11:32:57 -05:00
parent ab5a1d5d7d
commit ccc114fa5f
4 changed files with 16 additions and 7 deletions

View File

@ -36,7 +36,8 @@
#define IWD_ADHOC_INTERFACE "net.connman.iwd.AdHoc"
#define IWD_STATION_INTERFACE "net.connman.iwd.Station"
#define IWD_AGENT_MANAGER_PATH "/"
#define IWD_BASE_PATH "/net/connman/iwd"
#define IWD_AGENT_MANAGER_PATH IWD_BASE_PATH
struct l_dbus;

View File

@ -77,7 +77,8 @@ static const char *known_network_get_path(const struct network_info *network)
static char path[256];
unsigned int pos = 0, i;
path[pos++] = '/';
L_WARN_ON((pos = snprintf(path, sizeof(path), "%s/",
IWD_BASE_PATH)) >= (int) sizeof(path));
for (i = 0; network->ssid[i] && pos < sizeof(path); i++)
pos += snprintf(path + pos, sizeof(path) - pos, "%02x",
@ -85,6 +86,7 @@ static const char *known_network_get_path(const struct network_info *network)
snprintf(path + pos, sizeof(path) - pos, "_%s",
security_to_str(network->type));
path[sizeof(path) - 1] = '\0';
return path;
}

View File

@ -310,10 +310,13 @@ struct device *netdev_get_device(struct netdev *netdev)
const char *netdev_get_path(struct netdev *netdev)
{
static char path[26];
static char path[256];
L_WARN_ON(snprintf(path, sizeof(path), "%s/%u",
wiphy_get_path(netdev->wiphy),
netdev->index) >= (int) sizeof(path));
path[sizeof(path) - 1] = '\0';
snprintf(path, sizeof(path), "%s/%u", wiphy_get_path(netdev->wiphy),
netdev->index);
return path;
}

View File

@ -267,9 +267,12 @@ check_blacklist:
const char *wiphy_get_path(struct wiphy *wiphy)
{
static char path[15];
static char path[256];
L_WARN_ON(snprintf(path, sizeof(path), "%s/%d", IWD_BASE_PATH,
wiphy->id) >= (int) sizeof(path));
path[sizeof(path) - 1] = '\0';
snprintf(path, sizeof(path), "/%d", wiphy->id);
return path;
}