diff src/if-options.c @ 5551:0c4608a6cc2a draft

options: Allow duid to take a value If a value is given, it overrides /var/db/dhcpcd/duid.
author Roy Marples <roy@marples.name>
date Wed, 25 Nov 2020 14:19:55 +0000
parents dba7608e00b3
children 2a519da0f1a2
line wrap: on
line diff
--- a/src/if-options.c	Wed Nov 25 14:05:18 2020 +0000
+++ b/src/if-options.c	Wed Nov 25 14:19:55 2020 +0000
@@ -1002,8 +1002,16 @@
 		else if (strcmp(arg, "uuid") == 0)
 			ctx->duid_type = DUID_UUID;
 		else {
-			logwarnx("%s: invalid duid type", arg);
-			ctx->duid_type = DUID_DEFAULT;
+			dl = hwaddr_aton(NULL, arg);
+			if (dl != 0) {
+				no = realloc(ctx->duid, dl);
+				if (no == NULL)
+					logerrx(__func__);
+				else {
+					ctx->duid = no;
+					ctx->duid_len = hwaddr_aton(no, arg);
+				}
+			}
 		}
 		break;
 	case 'E':