]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add -M, --master to force dhcpcd into master mode.
authorRoy Marples <roy@marples.name>
Fri, 7 Mar 2014 10:22:37 +0000 (10:22 +0000)
committerRoy Marples <roy@marples.name>
Fri, 7 Mar 2014 10:22:37 +0000 (10:22 +0000)
dhcpcd.8.in
dhcpcd.c
if-options.c
if-options.h

index 0f4480775119a5102a7ae0543e80a159c199ebf5..6033ea9e4622d725bf597ab85e2b0e7618ac4827 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd March 3, 2014
+.Dd March 7, 2014
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -30,7 +30,7 @@
 .Nd a DHCP client
 .Sh SYNOPSIS
 .Nm
-.Op Fl 46ABbDdEGgHJKLpqTV
+.Op Fl 46ABbDdEGgHJKLMpqTV
 .Op Fl C , Fl Fl nohook Ar hook
 .Op Fl c , Fl Fl script Ar script
 .Op Fl e , Fl Fl env Ar value
@@ -326,6 +326,10 @@ By default
 .Nm
 does not request any lease time and leaves it in the hands of the
 DHCP server.
+.It Fl M , Fl Fl master
+Start
+.Nm
+in master mode even if only one interface specified on the command line.
 .It Fl m , Fl Fl metric Ar metric
 Metrics are used to prefer an interface over another one, lowest wins.
 .Nm
index f4aa4ada6006ba53da2d1cd25df52cbb23f585ef..bbdeba9ac1d43d507ca37046f4804be9bd2d0039 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1248,7 +1248,7 @@ main(int argc, char **argv)
        if (!(ctx.options & (DHCPCD_TEST | DHCPCD_DUMPLEASE))) {
                /* If we have any other args, we should run as a single dhcpcd
                 *  instance for that interface. */
-               if (optind == argc - 1) {
+               if (optind == argc - 1 && !(ctx.options & DHCPCD_MASTER)) {
                        if (strlen(argv[optind]) > IF_NAMESIZE) {
                                syslog(LOG_ERR, "%s: interface name too long",
                                    argv[optind]);
index 3c3acce79d604ff20a9894d252fb2fb0f31844f9..ca311702bccfda5d50130f3aa7b07c16037bff5a 100644 (file)
@@ -124,6 +124,7 @@ const struct option cf_options[] = {
        {"broadcast",       no_argument,       NULL, 'J'},
        {"nolink",          no_argument,       NULL, 'K'},
        {"noipv4ll",        no_argument,       NULL, 'L'},
+       {"master",          no_argument,       NULL, 'M'},
        {"nooption",        optional_argument, NULL, 'O'},
        {"require",         required_argument, NULL, 'Q'},
        {"static",          required_argument, NULL, 'S'},
@@ -926,6 +927,9 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
        case 'L':
                ifo->options &= ~DHCPCD_IPV4LL;
                break;
+       case 'M':
+               ifo->options |= DHCPCD_MASTER;
+               break;
        case 'O':
                arg = set_option_space(ctx, arg, &d, &dl, ifo,
                    &request, &require, &no);
index bba7f9d34b678aec04124c85f3716b6ad8174d84..a7cfa5e6cee27d3c58c6ccd0a1d7ff331c2d5a79 100644 (file)
@@ -40,7 +40,7 @@
 
 /* Don't set any optional arguments here so we retain POSIX
  * compatibility with getopt */
-#define IF_OPTS "46bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GHI:JKLO:Q:S:TUVW:X:Z:"
+#define IF_OPTS "46bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GHI:JKLMO:Q:S:TUVW:X:Z:"
 
 #define DEFAULT_TIMEOUT                30
 #define DEFAULT_REBOOT         5