changeset 5379:ca610debb37b draft

script: Make visible some link level parameters to lease dumping protocol, ssid and profile are now visible
author Roy Marples <roy@marples.name>
date Mon, 22 Jun 2020 12:45:37 +0100
parents ab1aeca76c73
children c8d7d4d5dd1c
files src/script.c
diffstat 1 files changed, 22 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/script.c	Sun Jun 21 15:06:14 2020 +0100
+++ b/src/script.c	Mon Jun 22 12:45:37 2020 +0100
@@ -342,8 +342,13 @@
 	if (!is_stdin) {
 		if (efprintf(fp, "interface=%s", ifp->name) == -1)
 			goto eexit;
+		if (protocols[protocol] != NULL) {
+			if (efprintf(fp, "protocol=%s",
+			    protocols[protocol]) == -1)
+				goto eexit;
+		}
 	}
-	if (ifp->ctx->options & DHCPCD_DUMPLEASE)
+	if (ifp->ctx->options & DHCPCD_DUMPLEASE && protocol != PROTO_LINK)
 		goto dumplease;
 	if (efprintf(fp, "ifcarrier=%s",
 	    ifp->carrier == LINK_UNKNOWN ? "unknown" :
@@ -357,6 +362,22 @@
 		goto eexit;
 	if (efprintf(fp, "ifmtu=%d", if_getmtu(ifp)) == -1)
 		goto eexit;
+	if (ifp->wireless) {
+		char pssid[IF_SSIDLEN * 4];
+
+		if (print_string(pssid, sizeof(pssid), OT_ESCSTRING,
+		    ifp->ssid, ifp->ssid_len) != -1)
+		{
+			if (efprintf(fp, "ifssid=%s", pssid) == -1)
+				goto eexit;
+		}
+	}
+	if (*ifp->profile != '\0') {
+		if (efprintf(fp, "profile=%s", ifp->profile) == -1)
+			goto eexit;
+	}
+	if (ifp->ctx->options & DHCPCD_DUMPLEASE)
+		goto dumplease;
 
 	if (fprintf(fp, "interface_order=") == -1)
 		goto eexit;
@@ -412,10 +433,6 @@
 		if (efprintf(fp, "if_down=true") == -1)
 			goto eexit;
 	}
-	if (protocols[protocol] != NULL) {
-		if (efprintf(fp, "protocol=%s", protocols[protocol]) == -1)
-			goto eexit;
-	}
 	if ((af = dhcpcd_ifafwaiting(ifp)) != AF_MAX) {
 		if (efprintf(fp, "if_afwaiting=%d", af) == -1)
 			goto eexit;
@@ -434,20 +451,6 @@
 		if (efprintf(fp, "syslog_debug=true") == -1)
 			goto eexit;
 	}
-	if (*ifp->profile != '\0') {
-		if (efprintf(fp, "profile=%s", ifp->profile) == -1)
-			goto eexit;
-	}
-	if (ifp->wireless) {
-		char pssid[IF_SSIDLEN * 4];
-
-		if (print_string(pssid, sizeof(pssid), OT_ESCSTRING,
-		    ifp->ssid, ifp->ssid_len) != -1)
-		{
-			if (efprintf(fp, "ifssid=%s", pssid) == -1)
-				goto eexit;
-		}
-	}
 #ifdef INET
 	if (protocol == PROTO_DHCP && state && state->old) {
 		if (dhcp_env(fp, "old", ifp,