comparison src/dhcpcd.c @ 5550:dba7608e00b3 draft

options: allow --ia_na=1 and --ia_pd=2 on the command line This only works for non master mode.
author Roy Marples <roy@marples.name>
date Wed, 25 Nov 2020 14:05:18 +0000
parents c9182c3618e6
children 0c4608a6cc2a
comparison
equal deleted inserted replaced
5549:6d72dc67a984 5550:dba7608e00b3
1881 logopts = LOGERR_LOG | LOGERR_LOG_DATE | LOGERR_LOG_PID; 1881 logopts = LOGERR_LOG | LOGERR_LOG_DATE | LOGERR_LOG_PID;
1882 if (ctx.stderr_valid) 1882 if (ctx.stderr_valid)
1883 logopts |= LOGERR_ERR; 1883 logopts |= LOGERR_ERR;
1884 1884
1885 i = 0; 1885 i = 0;
1886
1886 while ((opt = getopt_long(argc, argv, 1887 while ((opt = getopt_long(argc, argv,
1887 ctx.options & DHCPCD_PRINT_PIDFILE ? NOERR_IF_OPTS : IF_OPTS, 1888 ctx.options & DHCPCD_PRINT_PIDFILE ? NOERR_IF_OPTS : IF_OPTS,
1888 cf_options, &oi)) != -1) 1889 cf_options, &oi)) != -1)
1889 { 1890 {
1890 switch (opt) { 1891 switch (opt) {
1955 usage(); 1956 usage();
1956 goto exit_failure; 1957 goto exit_failure;
1957 } 1958 }
1958 } 1959 }
1959 1960
1961 if (optind != argc - 1)
1962 ctx.options |= DHCPCD_MASTER;
1963
1960 logsetopts(logopts); 1964 logsetopts(logopts);
1961 logopen(ctx.logfile); 1965 logopen(ctx.logfile);
1962 1966
1963 ctx.argv = argv; 1967 ctx.argv = argv;
1964 ctx.argc = argc; 1968 ctx.argc = argc;
1971 if (ifo == NULL) { 1975 if (ifo == NULL) {
1972 if (ctx.options & DHCPCD_PRINT_PIDFILE) 1976 if (ctx.options & DHCPCD_PRINT_PIDFILE)
1973 goto printpidfile; 1977 goto printpidfile;
1974 goto exit_failure; 1978 goto exit_failure;
1975 } 1979 }
1980
1976 opt = add_options(&ctx, NULL, ifo, argc, argv); 1981 opt = add_options(&ctx, NULL, ifo, argc, argv);
1977 if (opt != 1) { 1982 if (opt != 1) {
1978 if (ctx.options & DHCPCD_PRINT_PIDFILE) 1983 if (ctx.options & DHCPCD_PRINT_PIDFILE)
1979 goto printpidfile; 1984 goto printpidfile;
1980 if (opt == 0) 1985 if (opt == 0)
2011 } 2016 }
2012 #endif 2017 #endif
2013 goto exit_success; 2018 goto exit_success;
2014 } 2019 }
2015 ctx.options |= ifo->options; 2020 ctx.options |= ifo->options;
2021
2016 if (i == 1 || i == 3) { 2022 if (i == 1 || i == 3) {
2017 if (i == 1) 2023 if (i == 1)
2018 ctx.options |= DHCPCD_TEST; 2024 ctx.options |= DHCPCD_TEST;
2019 else 2025 else
2020 ctx.options |= DHCPCD_DUMPLEASE; 2026 ctx.options |= DHCPCD_DUMPLEASE;