changeset 5532:e6620d8e18bb draft

options: Don't log unknown option errors when printing the pidfile
author Roy Marples <roy@marples.name>
date Mon, 02 Nov 2020 17:03:31 +0000
parents 68571e2fc30d
children 8f117781bb06
files src/if-options.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/if-options.c	Sun Nov 01 14:07:38 2020 +0000
+++ b/src/if-options.c	Mon Nov 02 17:03:31 2020 +0000
@@ -782,6 +782,8 @@
 		break;
 	case 'o':
 		ARG_REQUIRED;
+		if (ctx->options & DHCPCD_PRINT_PIDFILE)
+			break;
 		set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
 		    &request, &require, &no, &reject);
 		if (make_option_mask(d, dl, od, odl, request, arg, 1) != 0 ||
@@ -794,6 +796,8 @@
 		break;
 	case O_REJECT:
 		ARG_REQUIRED;
+		if (ctx->options & DHCPCD_PRINT_PIDFILE)
+			break;
 		set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
 		    &request, &require, &no, &reject);
 		if (make_option_mask(d, dl, od, odl, reject, arg, 1) != 0 ||
@@ -1057,6 +1061,8 @@
 		break;
 	case 'O':
 		ARG_REQUIRED;
+		if (ctx->options & DHCPCD_PRINT_PIDFILE)
+			break;
 		set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
 		    &request, &require, &no, &reject);
 		if (make_option_mask(d, dl, od, odl, request, arg, -1) != 0 ||
@@ -1069,6 +1075,8 @@
 		break;
 	case 'Q':
 		ARG_REQUIRED;
+		if (ctx->options & DHCPCD_PRINT_PIDFILE)
+			break;
 		set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
 		    &request, &require, &no, &reject);
 		if (make_option_mask(d, dl, od, odl, require, arg, 1) != 0 ||
@@ -1307,6 +1315,8 @@
 		break;
 	case O_DESTINATION:
 		ARG_REQUIRED;
+		if (ctx->options & DHCPCD_PRINT_PIDFILE)
+			break;
 		set_option_space(ctx, arg, &d, &dl, &od, &odl, ifo,
 		    &request, &require, &no, &reject);
 		if (make_option_mask(d, dl, od, odl,
@@ -2269,7 +2279,8 @@
 		    ldop, edop);
 	}
 
-	logerrx("unknown option: %s", opt);
+	if (!(ctx->options & DHCPCD_PRINT_PIDFILE))
+		logerrx("unknown option: %s", opt);
 	return -1;
 }