summaryrefslogtreecommitdiffstats
path: root/src/if.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-02-14 06:47:40 +0000
committerRoy Marples <roy@marples.name>2020-02-14 06:47:40 +0000
commit700899cab6d32660f8759ae79212e2b2151bace2 (patch)
tree98a543779123eb69eac14d56e634a02b287de8c3 /src/if.c
parent096d770bdc1f5f5dca66cad2f6bb56611d48e6fb (diff)
downloaddhcpcd-700899cab6d32660f8759ae79212e2b2151bace2.tar.xz
net: If if_learnaddrs fails unexpectedly, log address and interface
This will greatly aid debugging.
Diffstat (limited to 'src/if.c')
-rw-r--r--src/if.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/if.c b/src/if.c
index 44559337..bc0241af 100644
--- a/src/if.c
+++ b/src/if.c
@@ -283,8 +283,15 @@ if_learnaddrs(struct dhcpcd_ctx *ctx, struct if_head *ifs,
addrflags = if_addrflags(ifp, &addr->sin_addr,
ifa->ifa_name);
if (addrflags == -1) {
- if (errno != EEXIST && errno != EADDRNOTAVAIL)
- logerr("%s: if_addrflags", __func__);
+ if (errno != EEXIST && errno != EADDRNOTAVAIL) {
+ char dbuf[INET_ADDRSTRLEN];
+ const char *dbp;
+
+ dbp = inet_ntop(AF_INET, &addr->sin_addr,
+ dbuf, sizeof(dbuf));
+ logerr("%s: if_addrflags: %s%%%s",
+ __func__, dbp, ifp->name);
+ }
continue;
}
#endif
@@ -308,8 +315,15 @@ if_learnaddrs(struct dhcpcd_ctx *ctx, struct if_head *ifs,
addrflags = if_addrflags6(ifp, &sin6->sin6_addr,
ifa->ifa_name);
if (addrflags == -1) {
- if (errno != EEXIST && errno != EADDRNOTAVAIL)
- logerr("%s: if_addrflags6", __func__);
+ if (errno != EEXIST && errno != EADDRNOTAVAIL) {
+ char dbuf[INET6_ADDRSTRLEN];
+ const char *dbp;
+
+ dbp = inet_ntop(AF_INET6, &sin6->sin6_addr,
+ dbuf, sizeof(dbuf));
+ logerr("%s: if_addrflags6: %s%%%s",
+ __func__, dbp, ifp->name);
+ }
continue;
}
#endif