]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Remove the gateway and nogateway options.
authorRoy Marples <roy@marples.name>
Tue, 28 Mar 2017 21:08:59 +0000 (22:08 +0100)
committerRoy Marples <roy@marples.name>
Tue, 28 Mar 2017 21:08:59 +0000 (22:08 +0100)
These can be controlled via the nooption directives instead.

src/dhcpcd.8.in
src/dhcpcd.conf.5.in
src/if-options.c
src/if-options.h
src/ipv4.c
src/route.c

index 1af877341cd05568896a04983a62b8709b88403e..5dff549beabb93b00b918d34785b730f19f32e2d 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd March 24, 2017
+.Dd March 28, 2017
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -597,8 +597,6 @@ So to stop
 .Nm
 from touching your DNS settings you would do:-
 .D1 dhcpcd -C resolv.conf eth0
-.It Fl G , Fl Fl nogateway
-Don't set any default routes.
 .It Fl H , Fl Fl xidhwaddr
 Use the last four bytes of the hardware address as the DHCP xid instead
 of a randomly generated number.
index 7e3db0ffc2978771db5c9048cc9f47de699e29fb..97d2f811e43c0b5a349c24d78c62afa03ad5c9d8 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd March 24, 2017
+.Dd March 28, 2017
 .Dt DHCPCD.CONF 5
 .Os
 .Sh NAME
@@ -445,10 +445,6 @@ This is only useful when allowing IPv4LL.
 .It Ic nodhcp6
 Don't start DHCPv6 or listen to DHCPv6 messages.
 Normally DHCPv6 is started by a RA instruction or configuration.
-.It Ic nogateway
-Don't install any default routes.
-.It Ic gateway
-Install a default route if available (default).
 .It Ic nohook Ar script
 Don't run this hook script.
 Matches full name, or prefixed with 2 numbers optionally ending with
index 7f171486388378f35b838bbbbc5fe61bffd75a6f..dd0738f9500a4f8ce2a35611626067c938f29967 100644 (file)
@@ -93,7 +93,7 @@
 #define O_IPV6                 O_BASE + 33
 #define O_CONTROLGRP           O_BASE + 34
 #define O_SLAAC                        O_BASE + 35
-#define O_GATEWAY              O_BASE + 36
+// unused                      O_BASE + 36
 #define O_NOUP                 O_BASE + 37
 #define O_IPV6RA_AUTOCONF      O_BASE + 38
 #define O_IPV6RA_NOAUTOCONF    O_BASE + 39
@@ -195,7 +195,6 @@ const struct option cf_options[] = {
        {"nodhcp6",         no_argument,       NULL, O_NODHCP6},
        {"controlgroup",    required_argument, NULL, O_CONTROLGRP},
        {"slaac",           required_argument, NULL, O_SLAAC},
-       {"gateway",         no_argument,       NULL, O_GATEWAY},
        {"reject",          required_argument, NULL, O_REJECT},
        {"bootp",           no_argument,       NULL, O_BOOTP},
        {"nodelay",         no_argument,       NULL, O_NODELAY},
@@ -968,9 +967,6 @@ parse_option(struct dhcpcd_ctx *ctx, const char *ifname, struct if_options *ifo,
                        return -1;
                }
                break;
-       case 'G':
-               ifo->options &= ~DHCPCD_GATEWAY;
-               break;
        case 'H':
                ifo->options |= DHCPCD_XID_HWADDR;
                break;
@@ -2082,9 +2078,6 @@ err_sla:
                ctx->control_group = grp->gr_gid;
 #endif
                break;
-       case O_GATEWAY:
-               ifo->options |= DHCPCD_GATEWAY;
-               break;
        case O_NOUP:
                ifo->options &= ~DHCPCD_IF_UP;
                break;
@@ -2271,8 +2264,7 @@ read_config(struct dhcpcd_ctx *ctx,
        ifo->options |= DHCPCD_DEV;
 #endif
 #ifdef INET
-       ifo->options |= DHCPCD_IPV4 | DHCPCD_DHCP | DHCPCD_IPV4LL;
-       ifo->options |= DHCPCD_GATEWAY | DHCPCD_ARP;
+       ifo->options |= DHCPCD_IPV4 | DHCPCD_ARP | DHCPCD_DHCP | DHCPCD_IPV4LL;
 #endif
 #ifdef INET6
        ifo->options |= DHCPCD_IPV6 | DHCPCD_IPV6RS;
index be1325b7979e554a3e34addbdb5ee14678de88f9..81f727b0bf825c9a2f97e3d4d87e9abab6c84516 100644 (file)
@@ -43,7 +43,7 @@
 /* Don't set any optional arguments here so we retain POSIX
  * compatibility with getopt */
 #define IF_OPTS "146bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:" \
-               "ABC:DEF:GHI:JKLMNO:PQ:S:TUVW:X:Z:"
+               "ABC:DEF:HI:JKLMNO:PQ:S:TUVW:X:Z:"
 #define NOERR_IF_OPTS          ":" IF_OPTS
 
 #define DEFAULT_TIMEOUT                30
@@ -61,7 +61,7 @@
 #define DHCPCD_ARP                     (1ULL << 0)
 #define DHCPCD_RELEASE                 (1ULL << 1)
 #define DHCPCD_DOMAIN                  (1ULL << 2)
-#define DHCPCD_GATEWAY                 (1ULL << 3)
+// unused                              (1ULL << 3)
 #define DHCPCD_STATIC                  (1ULL << 4)
 #define DHCPCD_DEBUG                   (1ULL << 5)
 #define DHCPCD_LASTLEASE               (1ULL << 7)
index e6d7c55949c9ef16fbdd662d74227195faf29192..aa1f20c7e05f19fc6ae12d9a5ca054a94e277a6a 100644 (file)
@@ -299,7 +299,6 @@ inet_dhcproutes(struct rt_head *routes, struct interface *ifp)
        /* If configured, Install a gateway to the desintion
         * for P2P interfaces. */
        if (ifp->flags & IFF_POINTOPOINT &&
-           ifp->options->options & DHCPCD_GATEWAY &&
            has_option_mask(ifp->options->dstmask, DHO_ROUTER))
        {
                if ((rt = rt_new(ifp)) == NULL)
@@ -432,10 +431,8 @@ inet_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes)
                        return false;
                if (ipv4ll_subnetroute(routes, ifp) == -1)
                        return false;
-               if (ifp->options->options & DHCPCD_GATEWAY) {
-                       if (inet_routerhostroute(routes, ifp) == -1)
-                               return false;
-               }
+               if (inet_routerhostroute(routes, ifp) == -1)
+                       return false;
        }
 
        /* If there is no default route, see if we can use an IPv4LL one. */
@@ -445,7 +442,6 @@ inet_getroutes(struct dhcpcd_ctx *ctx, struct rt_head *routes)
        if (!have_default) {
                TAILQ_FOREACH(ifp, ctx->ifaces, next) {
                        if (ifp->active &&
-                           ifp->options->options & DHCPCD_GATEWAY &&
                            ipv4ll_defaultroute(routes, ifp) == 1)
                                break;
                }
index c91c224de3dde4114e02833c255d308bad179ba6..d3a51d69f3dcc80b32fef027178b6e85ac9bebff 100644 (file)
@@ -277,19 +277,10 @@ rt_add(struct rt *nrt, struct rt *ort)
 {
        struct dhcpcd_ctx *ctx;
        bool change;
-       unsigned long long options;
 
        assert(nrt != NULL);
        ctx = nrt->rt_ifp->ctx;
 
-       /* Don't set default routes if not asked to */
-       options = nrt->rt_ifp->options == NULL ?
-           ctx->options : nrt->rt_ifp->options->options;
-       if (!(options & DHCPCD_GATEWAY) &&
-           sa_is_unspecified(&nrt->rt_dest) &&
-           sa_is_unspecified(&nrt->rt_netmask))
-               return false;
-
        rt_desc(ort == NULL ? "adding" : "changing", nrt);
 
        change = false;