From 7b19da497887e908f285996b3b1c95471a68a8d8 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 2 Nov 2020 17:03:31 +0000 Subject: [PATCH] options: Don't log unknown option errors when printing the pidfile --- src/if-options.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/if-options.c b/src/if-options.c index 9b2c74fb..23797bb1 100644 --- a/src/if-options.c +++ b/src/if-options.c @@ -782,6 +782,8 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, 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 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, 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 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, 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 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, 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 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo, 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 @@ parse_config_line(struct dhcpcd_ctx *ctx, const char *ifname, ldop, edop); } - logerrx("unknown option: %s", opt); + if (!(ctx->options & DHCPCD_PRINT_PIDFILE)) + logerrx("unknown option: %s", opt); return -1; } -- 2.47.3