summaryrefslogtreecommitdiffstats
path: root/src/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-11-12 16:01:50 +0000
committerRoy Marples <roy@marples.name>2019-11-12 16:01:50 +0000
commitcb7a57d59c38444ed40fb1bb2d3e489e02862875 (patch)
treedcc7228ef5fe78795aa0e234253fe135918bd4bf /src/dhcpcd.c
parent7752bf8bf65b1ccb714899364c5d3eb4f7aedaa4 (diff)
downloaddhcpcd-cb7a57d59c38444ed40fb1bb2d3e489e02862875.tar.xz
dhcpcd: report SSID connected to when we gain carrier
Helps debugging without the need for explicit debug.
Diffstat (limited to 'src/dhcpcd.c')
-rw-r--r--src/dhcpcd.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index 474b6abe..11e81980 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -708,6 +708,21 @@ dhcpcd_initstate(struct interface *ifp, unsigned long long options)
dhcpcd_initstate1(ifp, ifp->ctx->argc, ifp->ctx->argv, options);
}
+static void
+dhcpcd_reportssid(struct interface *ifp)
+{
+ char pssid[IF_SSIDLEN * 4];
+
+ if (print_string(pssid, sizeof(pssid), OT_ESCSTRING,
+ ifp->ssid, ifp->ssid_len) == -1)
+ {
+ logerr(__func__);
+ return;
+ }
+
+ loginfox("%s: connected to Access Point `%s'", ifp->name, pssid);
+}
+
void
dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
const char *ifname)
@@ -779,6 +794,7 @@ dhcpcd_handlecarrier(struct dhcpcd_ctx *ctx, int carrier, unsigned int flags,
if (ifp->ssid_len != olen ||
memcmp(ifp->ssid, ossid, ifp->ssid_len))
{
+ dhcpcd_reportssid(ifp);
#ifdef NOCARRIER_PRESERVE_IP
dhcpcd_drop(ifp, 0);
#endif
@@ -976,7 +992,8 @@ run_preinit(struct interface *ifp)
return;
script_runreason(ifp, "PREINIT");
-
+ if (ifp->wireless)
+ dhcpcd_reportssid(ifp);
if (ifp->options->options & DHCPCD_LINK && ifp->carrier != LINK_UNKNOWN)
script_runreason(ifp,
ifp->carrier == LINK_UP ? "CARRIER" : "NOCARRIER");