summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGrant Erickson <marathon96@gmail.com>2011-07-15 10:21:33 -0700
committerMarcel Holtmann <marcel@holtmann.org>2011-07-15 22:33:27 +0200
commited074699bb0a55a26e9cccd3e42285fba2107cb7 (patch)
treefb47afba9ee850e1d5373547b8ad0e50e1d585bb /plugins
parent6427539c5b7b040d902384af6ca0fb2b6c536e3e (diff)
downloadconnman-ed074699bb0a55a26e9cccd3e42285fba2107cb7.tar.gz
connman-ed074699bb0a55a26e9cccd3e42285fba2107cb7.tar.bz2
connman-ed074699bb0a55a26e9cccd3e42285fba2107cb7.zip
loopback: Improve Error Reporting when Recovering Loopback
When fixing up the loopback address or netmask, log what is being fixed up.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/loopback.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/loopback.c b/plugins/loopback.c
index 8e6d8cbd..ac3e2fcf 100644
--- a/plugins/loopback.c
+++ b/plugins/loopback.c
@@ -186,6 +186,7 @@ static gboolean valid_loopback(int sk, struct ifreq *ifr)
{
struct sockaddr_in *addr;
int err;
+ char buf[INET_ADDRSTRLEN];
err = ioctl(sk, SIOCGIFADDR, ifr);
if (err < 0) {
@@ -195,8 +196,11 @@ static gboolean valid_loopback(int sk, struct ifreq *ifr)
}
addr = (struct sockaddr_in *) &ifr->ifr_addr;
- if (addr->sin_addr.s_addr != loopback_address)
+ if (addr->sin_addr.s_addr != loopback_address) {
+ connman_warn("Invalid loopback address %s",
+ inet_ntop(AF_INET, &addr->sin_addr, buf, sizeof(buf)));
return FALSE;
+ }
err = ioctl(sk, SIOCGIFNETMASK, ifr);
if (err < 0) {
@@ -206,8 +210,11 @@ static gboolean valid_loopback(int sk, struct ifreq *ifr)
}
addr = (struct sockaddr_in *) &ifr->ifr_netmask;
- if (addr->sin_addr.s_addr != loopback_netmask)
+ if (addr->sin_addr.s_addr != loopback_netmask) {
+ connman_warn("Invalid loopback netmask %s",
+ inet_ntop(AF_INET, &addr->sin_addr, buf, sizeof(buf)));
return FALSE;
+ }
return TRUE;
}