From: Roy Marples Date: Tue, 12 Nov 2019 16:01:50 +0000 (+0000) Subject: dhcpcd: report SSID connected to when we gain carrier X-Git-Tag: v8.1.2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3cfb1ea178bc0dd21d0d34eb3f2a0af4fae82cf;p=thirdparty%2Fdhcpcd.git dhcpcd: report SSID connected to when we gain carrier Helps debugging without the need for explicit debug. --- 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");