]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
options: Don't log unknown option errors when printing the pidfile
authorRoy Marples <roy@marples.name>
Mon, 2 Nov 2020 17:03:31 +0000 (17:03 +0000)
committerRoy Marples <roy@marples.name>
Mon, 2 Nov 2020 17:03:58 +0000 (17:03 +0000)
src/if-options.c

index 9b2c74fb695d86db274c11b3063c037f7a27d691..23797bb1087e561a34d996ac7645ab46cceb4445 100644 (file)
@@ -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;
 }